Skip to content

Commit

Permalink
Updated rest of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcnn committed Oct 20, 2023
1 parent 9dfb80b commit 2c4039f
Show file tree
Hide file tree
Showing 6 changed files with 281 additions and 62 deletions.
124 changes: 102 additions & 22 deletions frontend-wasm/tests/expected/signed_arith.mir
Original file line number Diff line number Diff line change
Expand Up @@ -11,173 +11,234 @@ global external gv2 : i32 = 0x00100150 { id = gvar2 };

pub fn rust_begin_unwind(i32) {
block0(v0: i32):
{
br block2
}

block1:
{
}

block2:
{
br block2
}

block3:
{
}
}

pub fn div_s(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
{
v3 = eq v1, 0 : i1
v4 = cast v3 : i32
v5 = neq v4, 0 : i1
condbr v5, block3, block4
}

block1(v2: i32):
ret v2
{
ret (v2)
}

block2:
{
v22 = div v0, v1 : i32
br block1(v22)
}

block3:
{
v17 = const.i32 1048672 : i32
v18 = const.i32 25 : i32
v19 = const.i32 1048648 : i32
call noname::_ZN4core9panicking5panic17h62f53cc4db8dd7b3E(v17, v18, v19)
call noname::_ZN4core9panicking5panic17h0f0c05b20da93dd7E(v17, v18, v19)
unreachable
}

block4:
{
v6 = const.i32 -2147483648 : i32
v7 = neq v0, v6 : i1
v8 = cast v7 : i32
v9 = neq v8, 0 : i1
condbr v9, block2, block5
}

block5:
{
v10 = const.i32 -1 : i32
v11 = neq v1, v10 : i1
v12 = cast v11 : i32
v13 = neq v12, 0 : i1
condbr v13, block2, block6
}

block6:
{
v14 = const.i32 1048704 : i32
v15 = const.i32 31 : i32
v16 = const.i32 1048648 : i32
call noname::_ZN4core9panicking5panic17h62f53cc4db8dd7b3E(v14, v15, v16)
call noname::_ZN4core9panicking5panic17h0f0c05b20da93dd7E(v14, v15, v16)
unreachable
}
}

pub fn div_u(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
{
v3 = eq v1, 0 : i1
v4 = cast v3 : i32
v5 = neq v4, 0 : i1
condbr v5, block2, block3
}

block1(v2: i32):
{
}

block2:
{
v10 = const.i32 1048672 : i32
v11 = const.i32 25 : i32
v12 = const.i32 1048736 : i32
call noname::_ZN4core9panicking5panic17h62f53cc4db8dd7b3E(v10, v11, v12)
call noname::_ZN4core9panicking5panic17h0f0c05b20da93dd7E(v10, v11, v12)
unreachable
}

block3:
{
v6 = cast v0 : u32
v7 = cast v1 : u32
v8 = div v6, v7 : u32
v9 = cast v8 : i32
ret v9
ret (v9)
}
}

pub fn rem_s(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
{
v3 = eq v1, 0 : i1
v4 = cast v3 : i32
v5 = neq v4, 0 : i1
condbr v5, block3, block4
}

block1(v2: i32):
ret v2
{
ret (v2)
}

block2:
{
v22 = mod v0, v1 : i32
br block1(v22)
}

block3:
{
v17 = const.i32 1048768 : i32
v18 = const.i32 57 : i32
v19 = const.i32 1048752 : i32
call noname::_ZN4core9panicking5panic17h62f53cc4db8dd7b3E(v17, v18, v19)
call noname::_ZN4core9panicking5panic17h0f0c05b20da93dd7E(v17, v18, v19)
unreachable
}

block4:
{
v6 = const.i32 -2147483648 : i32
v7 = neq v0, v6 : i1
v8 = cast v7 : i32
v9 = neq v8, 0 : i1
condbr v9, block2, block5
}

block5:
{
v10 = const.i32 -1 : i32
v11 = neq v1, v10 : i1
v12 = cast v11 : i32
v13 = neq v12, 0 : i1
condbr v13, block2, block6
}

block6:
{
v14 = const.i32 1048832 : i32
v15 = const.i32 48 : i32
v16 = const.i32 1048752 : i32
call noname::_ZN4core9panicking5panic17h62f53cc4db8dd7b3E(v14, v15, v16)
call noname::_ZN4core9panicking5panic17h0f0c05b20da93dd7E(v14, v15, v16)
unreachable
}
}

pub fn rem_u(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
{
v3 = eq v1, 0 : i1
v4 = cast v3 : i32
v5 = neq v4, 0 : i1
condbr v5, block2, block3
}

block1(v2: i32):
{
}

block2:
{
v10 = const.i32 1048768 : i32
v11 = const.i32 57 : i32
v12 = const.i32 1048880 : i32
call noname::_ZN4core9panicking5panic17h62f53cc4db8dd7b3E(v10, v11, v12)
call noname::_ZN4core9panicking5panic17h0f0c05b20da93dd7E(v10, v11, v12)
unreachable
}

block3:
{
v6 = cast v0 : u32
v7 = cast v1 : u32
v8 = mod v6, v7 : u32
v9 = cast v8 : i32
ret v9
ret (v9)
}
}

pub fn shr_s(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
{
v3 = shr v0, v1 : i32
br block1(v3)
}

block1(v2: i32):
ret v2
{
ret (v2)
}
}

pub fn shr_u(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
{
v3 = cast v0 : u32
v4 = cast v1 : u32
v5 = shr v3, v4 : u32
v6 = cast v5 : i32
br block1(v6)
}

block1(v2: i32):
ret v2
{
ret (v2)
}
}

pub fn __main() -> i32 {
block0:
{
v1 = const.i32 -8 : i32
v2 = const.i32 -4 : i32
v3 = call noname::div_s(v1, v2) : i32
Expand All @@ -202,21 +263,29 @@ block0:
v22 = call noname::shr_u(v20, v21) : i32
v23 = add v19, v22 : i32
br block1(v23)
}

block1(v0: i32):
ret v0
{
ret (v0)
}
}

pub fn _ZN4core3ptr37drop_in_place$LT$core..fmt..Error$GT$17h282a1f10dc7e004dE(i32) {
pub fn _ZN4core3ptr37drop_in_place$LT$core..fmt..Error$GT$17h0739df0c73a7475cE(i32) {
block0(v0: i32):
{
br block1
}

block1:
ret
{
ret
}
}

pub fn _ZN4core9panicking9panic_fmt17h9f61a1f2faa523f9E(i32, i32) {
pub fn _ZN4core9panicking9panic_fmt17h3e1dd3d08288569eE(i32, i32) {
block0(v0: i32, v1: i32):
{
v2 = const.i32 0 : i32
v3 = global.load (@__stack_pointer) as *mut i8 : i32
v4 = const.i32 32 : i32
Expand Down Expand Up @@ -251,12 +320,16 @@ block0(v0: i32, v1: i32):
v27 = add v5, v26 : i32
call noname::rust_begin_unwind(v27)
unreachable
}

block1:
{
}
}

pub fn _ZN4core9panicking5panic17h62f53cc4db8dd7b3E(i32, i32, i32) {
pub fn _ZN4core9panicking5panic17h0f0c05b20da93dd7E(i32, i32, i32) {
block0(v0: i32, v1: i32, v2: i32):
{
v3 = const.i32 0 : i32
v4 = global.load (@__stack_pointer) as *mut i8 : i32
v5 = const.i32 32 : i32
Expand Down Expand Up @@ -292,25 +365,32 @@ block0(v0: i32, v1: i32, v2: i32):
v29 = cast v6 : u32
v30 = inttoptr v29 : *mut i32
store v30, v28
call noname::_ZN4core9panicking9panic_fmt17h9f61a1f2faa523f9E(v6, v2)
call noname::_ZN4core9panicking9panic_fmt17h3e1dd3d08288569eE(v6, v2)
unreachable
}

block1:
{
}
}

pub fn _ZN36_$LT$T$u20$as$u20$core..any..Any$GT$7type_id17h29327df37c6e3023E(i32, i32) {
pub fn _ZN36_$LT$T$u20$as$u20$core..any..Any$GT$7type_id17h35099cc04e33109dE(i32, i32) {
block0(v0: i32, v1: i32):
v2 = const.i64 -1688046730280208939 : i64
{
v2 = const.i64 -2015057253893374293 : i64
v3 = cast v0 : u32
v4 = add v3, 8 : u32
v5 = inttoptr v4 : *mut i64
store v5, v2
v6 = const.i64 -2518113060735759681 : i64
v6 = const.i64 4112024161530019576 : i64
v7 = cast v0 : u32
v8 = inttoptr v7 : *mut i64
store v8, v6
br block1
}

block1:
ret
{
ret
}
}
Loading

0 comments on commit 2c4039f

Please sign in to comment.