Files
wasmtime/cranelift/filetests/filetests/simple_preopt/sign_extend.clif
Trevor Elliott 32a7593c94 cranelift: Remove booleans (#5031)
Remove the boolean types from cranelift, and the associated instructions breduce, bextend, bconst, and bint. Standardize on using 1/0 for the return value from instructions that produce scalar boolean results, and -1/0 for boolean vector elements.

Fixes #3205

Co-authored-by: Afonso Bordado <afonso360@users.noreply.github.com>
Co-authored-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Co-authored-by: Chris Fallin <chris@cfallin.org>
2022-10-17 16:00:27 -07:00

41 lines
792 B
Plaintext

test simple_preopt
target aarch64
target x86_64
;; Tests for sign-extending immediates.
function %sign_extend_signed_icmp(i8) -> i8 {
block0(v0: i8):
; 255 = -1 as u8
v1 = iconst.i8 255
v2 = icmp sge v0, v1
; check: v2 = icmp_imm sge v0, -1
return v2
}
function %do_not_sign_extend_unsigned_icmp(i8) -> i8 {
block0(v0: i8):
v1 = iconst.i8 255
v2 = icmp uge v0, v1
; check: v2 = icmp_imm uge v0, 255
return v2
}
function %sign_extend_sdiv(i8) -> i8 {
block0(v0: i8):
; 255 = -1 as u8
v1 = iconst.i8 255
v2 = sdiv v0, v1
; check: v2 = sdiv_imm v0, -1
return v2
}
function %sign_extend_srem(i8) -> i8 {
block0(v0: i8):
; 255 = -1 as u8
v1 = iconst.i8 255
v2 = srem v0, v1
; check: v2 = srem_imm v0, -1
return v2
}