Files
wasmtime/cranelift/filetests/filetests/egraph/cprop.clif
Jamey Sharp ac4d28f4dd Constant-fold icmp instructions (#5666)
We found examples of icmp instructions with both operands constant in
spidermonkey.wasm.
2023-02-01 21:55:36 +00:00

168 lines
2.5 KiB
Plaintext

test optimize
set opt_level=speed
set use_egraphs=true
target x86_64
function %f0() -> i8 {
block0:
v1 = iconst.i8 51
v2 = imul.i8 v1, v1
return v2
}
; check: v9 = iconst.i8 41
; nextln: return v9
function %f1() -> i16 {
block0:
v1 = iconst.i16 1
v2 = bnot.i16 v1
return v2
}
; check: v3 = iconst.i16 0xfffe
; nextln: return v3
function %ishl() -> i8 {
block0:
v0 = iconst.i8 1
v1 = iconst.i8 2
v2 = ishl v0, v1
return v2
}
; check: v3 = iconst.i8 4
; check: return v3
function %ushr() -> i8 {
block0:
v0 = iconst.i8 -1
v1 = iconst.i8 2
v2 = ushr v0, v1
return v2
}
; check: v3 = iconst.i8 63
; check: return v3
function %sshr() -> i8 {
block0:
v0 = iconst.i8 0xf0
v1 = iconst.i8 2
v2 = sshr v0, v1
return v2
}
; check: v3 = iconst.i8 -4
; check: return v3
function %icmp_eq_i32() -> i8 {
block0:
v0 = iconst.i32 1
v1 = iconst.i32 2
v2 = icmp eq v0, v1
return v2
}
; check: v3 = iconst.i8 0
; nextln: return v3
function %icmp_ne_i32() -> i8 {
block0:
v0 = iconst.i32 1
v1 = iconst.i32 2
v2 = icmp ne v0, v1
return v2
}
; check: v3 = iconst.i8 1
; nextln: return v3
function %icmp_ult_i32() -> i8 {
block0:
v0 = iconst.i32 1
v1 = iconst.i32 2
v2 = icmp ult v0, v1
return v2
}
; check: v3 = iconst.i8 1
; nextln: return v3
function %icmp_ule_i32() -> i8 {
block0:
v0 = iconst.i32 1
v1 = iconst.i32 2
v2 = icmp ule v0, v1
return v2
}
; check: v3 = iconst.i8 1
; nextln: return v3
function %icmp_uge_i32() -> i8 {
block0:
v0 = iconst.i32 1
v1 = iconst.i32 2
v2 = icmp uge v0, v1
return v2
}
; check: v3 = iconst.i8 0
; nextln: return v3
function %icmp_ugt_i32() -> i8 {
block0:
v0 = iconst.i32 1
v1 = iconst.i32 2
v2 = icmp ugt v0, v1
return v2
}
; check: v3 = iconst.i8 0
; nextln: return v3
function %icmp_slt_i32() -> i8 {
block0:
v0 = iconst.i32 -1
v1 = iconst.i32 2
v2 = icmp slt v0, v1
return v2
}
; check: v3 = iconst.i8 1
; nextln: return v3
function %icmp_sle_i32() -> i8 {
block0:
v0 = iconst.i32 -1
v1 = iconst.i32 2
v2 = icmp sle v0, v1
return v2
}
; check: v3 = iconst.i8 1
; nextln: return v3
function %icmp_sge_i32() -> i8 {
block0:
v0 = iconst.i32 -1
v1 = iconst.i32 2
v2 = icmp sge v0, v1
return v2
}
; check: v3 = iconst.i8 0
; nextln: return v3
function %icmp_sgt_i32() -> i8 {
block0:
v0 = iconst.i32 -1
v1 = iconst.i32 2
v2 = icmp sgt v0, v1
return v2
}
; check: v3 = iconst.i8 0
; nextln: return v3