test preopt isa intel baseline ; -------- U32 -------- ; ignored function %t_urem32_p0(i32) -> i32 { ebb0(v0: i32): v1 = urem_imm v0, 0 ; check: urem_imm v0, 0 return v1 } ; converted to constant zero function %t_urem32_p1(i32) -> i32 { ebb0(v0: i32): v1 = urem_imm v0, 1 ; check: iconst.i32 0 return v1 } ; shift function %t_urem32_p2(i32) -> i32 { ebb0(v0: i32): v1 = urem_imm v0, 2 ; check: band_imm v0, 1 return v1 } ; shift function %t_urem32_p2p31(i32) -> i32 { ebb0(v0: i32): v1 = urem_imm v0, 0x8000_0000 ; check: band_imm v0, 0x7fff_ffff return v1 } ; -------- U64 -------- ; ignored function %t_urem64_p0(i64) -> i64 { ebb0(v0: i64): v1 = urem_imm v0, 0 ; check: urem_imm v0, 0 return v1 } ; converted to constant zero function %t_urem64_p1(i64) -> i64 { ebb0(v0: i64): v1 = urem_imm v0, 1 ; check: iconst.i64 0 return v1 } ; shift function %t_urem64_p2(i64) -> i64 { ebb0(v0: i64): v1 = urem_imm v0, 2 ; check: band_imm v0, 1 return v1 } ; shift function %t_urem64_p2p63(i64) -> i64 { ebb0(v0: i64): v1 = urem_imm v0, 0x8000_0000_0000_0000 ; check: band_imm v0, 0x7fff_ffff_ffff_ffff return v1 } ; -------- S32 -------- ; ignored function %t_srem32_n1(i32) -> i32 { ebb0(v0: i32): v1 = srem_imm v0, -1 ; check: srem_imm v0, -1 return v1 } ; ignored function %t_srem32_p0(i32) -> i32 { ebb0(v0: i32): v1 = srem_imm v0, 0 ; check: srem_imm v0, 0 return v1 } ; converted to constant zero function %t_srem32_p1(i32) -> i32 { ebb0(v0: i32): v1 = srem_imm v0, 1 ; check: iconst.i32 0 return v1 } ; shift function %t_srem32_p2(i32) -> i32 { ebb0(v0: i32): v1 = srem_imm v0, 2 ; check: ushr_imm v0, 31 ; check: iadd v0, v2 ; check: band_imm v3, -2 ; check: isub v0, v4 return v1 } ; shift function %t_srem32_n2(i32) -> i32 { ebb0(v0: i32): v1 = srem_imm v0, -2 ; check: ushr_imm v0, 31 ; check: iadd v0, v2 ; check: band_imm v3, -2 ; check: isub v0, v4 return v1 } ; shift function %t_srem32_p4(i32) -> i32 { ebb0(v0: i32): v1 = srem_imm v0, 4 ; check: sshr_imm v0, 1 ; check: ushr_imm v2, 30 ; check: iadd v0, v3 ; check: band_imm v4, -4 ; check: isub v0, v5 return v1 } ; shift function %t_srem32_n4(i32) -> i32 { ebb0(v0: i32): v1 = srem_imm v0, -4 ; check: sshr_imm v0, 1 ; check: ushr_imm v2, 30 ; check: iadd v0, v3 ; check: band_imm v4, -4 ; check: isub v0, v5 return v1 } ; shift function %t_srem32_p2p30(i32) -> i32 { ebb0(v0: i32): v1 = srem_imm v0, 0x4000_0000 ; check: sshr_imm v0, 29 ; check: ushr_imm v2, 2 ; check: iadd v0, v3 ; check: band_imm v4, 0xffff_ffff_c000_0000 ; check: isub v0, v5 return v1 } ; shift function %t_srem32_n2p30(i32) -> i32 { ebb0(v0: i32): v1 = srem_imm v0, -0x4000_0000 ; check: sshr_imm v0, 29 ; check: ushr_imm v2, 2 ; check: iadd v0, v3 ; check: band_imm v4, 0xffff_ffff_c000_0000 ; check: isub v0, v5 return v1 } ; there's no positive version of this, since -(-0x8000_0000) isn't ; representable. function %t_srem32_n2p31(i32) -> i32 { ebb0(v0: i32): v1 = srem_imm v0, -0x8000_0000 ; check: sshr_imm v0, 30 ; check: ushr_imm v2, 1 ; check: iadd v0, v3 ; check: band_imm v4, 0xffff_ffff_8000_0000 ; check: isub v0, v5 return v1 } ; -------- S64 -------- ; ignored function %t_srem64_n1(i64) -> i64 { ebb0(v0: i64): v1 = srem_imm v0, -1 ; check: srem_imm v0, -1 return v1 } ; ignored function %t_srem64_p0(i64) -> i64 { ebb0(v0: i64): v1 = srem_imm v0, 0 ; check: srem_imm v0, 0 return v1 } ; converted to constant zero function %t_srem64_p1(i64) -> i64 { ebb0(v0: i64): v1 = srem_imm v0, 1 ; check: iconst.i64 0 return v1 } ; shift function %t_srem64_p2(i64) -> i64 { ebb0(v0: i64): v1 = srem_imm v0, 2 ; check: ushr_imm v0, 63 ; check: iadd v0, v2 ; check: band_imm v3, -2 ; check: isub v0, v4 return v1 } ; shift function %t_srem64_n2(i64) -> i64 { ebb0(v0: i64): v1 = srem_imm v0, -2 ; check: ushr_imm v0, 63 ; check: iadd v0, v2 ; check: band_imm v3, -2 ; check: isub v0, v4 return v1 } ; shift function %t_srem64_p4(i64) -> i64 { ebb0(v0: i64): v1 = srem_imm v0, 4 ; check: sshr_imm v0, 1 ; check: ushr_imm v2, 62 ; check: iadd v0, v3 ; check: band_imm v4, -4 ; check: isub v0, v5 return v1 } ; shift function %t_srem64_n4(i64) -> i64 { ebb0(v0: i64): v1 = srem_imm v0, -4 ; check: sshr_imm v0, 1 ; check: ushr_imm v2, 62 ; check: iadd v0, v3 ; check: band_imm v4, -4 ; check: isub v0, v5 return v1 } ; shift function %t_srem64_p2p62(i64) -> i64 { ebb0(v0: i64): v1 = srem_imm v0, 0x4000_0000_0000_0000 ; check: sshr_imm v0, 61 ; check: ushr_imm v2, 2 ; check: iadd v0, v3 ; check: band_imm v4, 0xc000_0000_0000_0000 ; check: isub v0, v5 return v1 } ; shift function %t_srem64_n2p62(i64) -> i64 { ebb0(v0: i64): v1 = srem_imm v0, -0x4000_0000_0000_0000 ; check: sshr_imm v0, 61 ; check: ushr_imm v2, 2 ; check: iadd v0, v3 ; check: band_imm v4, 0xc000_0000_0000_0000 ; check: isub v0, v5 return v1 } ; there's no positive version of this, since -(-0x8000_0000_0000_0000) isn't ; representable. function %t_srem64_n2p63(i64) -> i64 { ebb0(v0: i64): v1 = srem_imm v0, -0x8000_0000_0000_0000 ; check: sshr_imm v0, 62 ; check: ushr_imm v2, 1 ; check: iadd v0, v3 ; check: band_imm v4, 0x8000_0000_0000_0000 ; check: isub v0, v5 return v1 }