[codegen] legalize icmp for 64 and 128 bit operands
Add legalizations for icmp and icmp_imm for i64 and i128 operands for the narrow legalization set, allowing 32-bit ISAs (like x86-32) to compare 64-bit integers and all ISAs to compare 128-bit integers. Fixes: https://github.com/bnjbvr/cranelift-x86/issues/2
This commit is contained in:
committed by
Benjamin Bouvier
parent
19444649e7
commit
c062f12d7c
52
cranelift/filetests/filetests/isa/x86/icmp-i128.clif
Normal file
52
cranelift/filetests/filetests/isa/x86/icmp-i128.clif
Normal file
@@ -0,0 +1,52 @@
|
||||
test run
|
||||
target x86_64 haswell
|
||||
|
||||
function %test_icmp_eq_i128() -> b1 {
|
||||
ebb0:
|
||||
v11 = iconst.i64 0x0
|
||||
v12 = iconst.i64 0x0
|
||||
v1 = iconcat v11, v12
|
||||
v21 = iconst.i64 0x0
|
||||
v22 = iconst.i64 0x0
|
||||
v2 = iconcat v21, v22
|
||||
v10 = icmp.i128 eq v1, v2
|
||||
return v10
|
||||
}
|
||||
|
||||
; run
|
||||
|
||||
function %test_icmp_imm_eq_i128() -> b1 {
|
||||
ebb0:
|
||||
v11 = iconst.i64 0x0
|
||||
v12 = iconst.i64 0x0
|
||||
v1 = iconcat v11, v12
|
||||
v10 = icmp_imm.i128 eq v1, 0x0
|
||||
return v10
|
||||
}
|
||||
|
||||
; run
|
||||
|
||||
function %test_icmp_ne_i128() -> b1 {
|
||||
ebb0:
|
||||
v11 = iconst.i64 0x0
|
||||
v12 = iconst.i64 0x0
|
||||
v1 = iconcat v11, v12
|
||||
v21 = iconst.i64 0x0
|
||||
v22 = iconst.i64 0x1
|
||||
v2 = iconcat v21, v22
|
||||
v10 = icmp.i128 ne v1, v2
|
||||
return v10
|
||||
}
|
||||
|
||||
; run
|
||||
|
||||
function %test_icmp_imm_ne_i128() -> b1 {
|
||||
ebb0:
|
||||
v11 = iconst.i64 0x0
|
||||
v12 = iconst.i64 0x0
|
||||
v1 = iconcat v11, v12
|
||||
v10 = icmp_imm.i128 ne v1, 0x1
|
||||
return v10
|
||||
}
|
||||
|
||||
; run
|
||||
Reference in New Issue
Block a user