This switches from a custom list of architectures to use the target-lexicon crate. - "set is_64bit=1; isa x86" is replaced with "target x86_64", and similar for other architectures, and the `is_64bit` flag is removed entirely. - The `is_compressed` flag is removed too; it's no longer being used to control REX prefixes on x86-64, ARM and Thumb are separate architectures in target-lexicon, and we can figure out how to select RISC-V compressed encodings when we're ready.
60 lines
1.3 KiB
Plaintext
60 lines
1.3 KiB
Plaintext
test preopt
|
|
target i686 baseline
|
|
|
|
; Cases where the denominator is created by an iconst
|
|
|
|
function %indir_udiv32(i32) -> i32 {
|
|
ebb0(v0: i32):
|
|
v1 = iconst.i32 7
|
|
v2 = udiv v0, v1
|
|
; check: iconst.i32 7
|
|
; check: iconst.i32 0x2492_4925
|
|
; check: umulhi v0, v3
|
|
; check: isub v0, v4
|
|
; check: ushr_imm v5, 1
|
|
; check: iadd v6, v4
|
|
; check: ushr_imm v7, 2
|
|
; check: copy v8
|
|
return v2
|
|
}
|
|
|
|
function %indir_sdiv32(i32) -> i32 {
|
|
ebb0(v0: i32):
|
|
v1 = iconst.i32 -17
|
|
v2 = sdiv v0, v1
|
|
; check: iconst.i32 -17
|
|
; check: iconst.i32 0xffff_ffff_8787_8787
|
|
; check: smulhi v0, v3
|
|
; check: sshr_imm v4, 3
|
|
; check: ushr_imm v5, 31
|
|
; check: iadd v5, v6
|
|
; check: copy v7
|
|
return v2
|
|
}
|
|
|
|
function %indir_udiv64(i64) -> i64 {
|
|
ebb0(v0: i64):
|
|
v1 = iconst.i64 1337
|
|
v2 = udiv v0, v1
|
|
; check: iconst.i64 1337
|
|
; check: iconst.i64 0xc411_9d95_2866_a139
|
|
; check: umulhi v0, v3
|
|
; check: ushr_imm v4, 10
|
|
; check: copy v5
|
|
return v2
|
|
}
|
|
|
|
function %indir_sdiv64(i64) -> i64 {
|
|
ebb0(v0: i64):
|
|
v1 = iconst.i64 -90210
|
|
v2 = sdiv v0, v1
|
|
; check: iconst.i64 0xffff_ffff_fffe_9f9e
|
|
; check: iconst.i64 0xd181_4ee8_939c_b8bb
|
|
; check: smulhi v0, v3
|
|
; check: sshr_imm v4, 14
|
|
; check: ushr_imm v5, 63
|
|
; check: iadd v5, v6
|
|
; check: copy v7
|
|
return v2
|
|
}
|