cranelift: Fix icmp_imm for small types in interpreter (#4506)

This commit is contained in:
Afonso Bordado
2022-07-23 01:26:56 +01:00
committed by GitHub
parent af62037f62
commit 446efd3e11
11 changed files with 87 additions and 3 deletions

View File

@@ -0,0 +1,77 @@
test interpret
test run
target aarch64
target x86_64
target s390x
function %icmp_imm_eq_i8(i8) -> b1 {
block0(v0: i8):
v1 = icmp_imm eq v0, 0x44
return v1
}
; run: %icmp_imm_eq_i8(0) == false
; run: %icmp_imm_eq_i8(-1) == false
; run: %icmp_imm_eq_i8(0x44) == true
function %icmp_neg_eq_i8(i8) -> b1 {
block0(v0: i8):
v1 = icmp_imm eq v0, 0xf4
return v1
}
; run: %icmp_neg_eq_i8(0) == false
; run: %icmp_neg_eq_i8(-1) == false
; run: %icmp_neg_eq_i8(0xf4) == true
function %icmp_imm_eq_i16(i16) -> b1 {
block0(v0: i16):
v1 = icmp_imm eq v0, 0x4444
return v1
}
; run: %icmp_imm_eq_i16(0) == false
; run: %icmp_imm_eq_i16(-1) == false
; run: %icmp_imm_eq_i16(0x4444) == true
function %icmp_neg_eq_i16(i16) -> b1 {
block0(v0: i16):
v1 = icmp_imm eq v0, 0xff44
return v1
}
; run: %icmp_neg_eq_i16(0) == false
; run: %icmp_neg_eq_i16(-1) == false
; run: %icmp_neg_eq_i16(0xff44) == true
function %icmp_imm_eq_i32(i32) -> b1 {
block0(v0: i32):
v1 = icmp_imm eq v0, 0x4444_4444
return v1
}
; run: %icmp_imm_eq_i32(0) == false
; run: %icmp_imm_eq_i32(-1) == false
; run: %icmp_imm_eq_i32(0x4444_4444) == true
function %icmp_neg_eq_i32(i32) -> b1 {
block0(v0: i32):
v1 = icmp_imm eq v0, 0xffff_4444
return v1
}
; run: %icmp_neg_eq_i32(0) == false
; run: %icmp_neg_eq_i32(-1) == false
; run: %icmp_neg_eq_i32(0xffff_4444) == true
function %icmp_imm_eq_i64(i64) -> b1 {
block0(v0: i64):
v1 = icmp_imm eq v0, 0x4444_4444_4444_4444
return v1
}
; run: %icmp_imm_eq_i64(0) == false
; run: %icmp_imm_eq_i64(-1) == false
; run: %icmp_imm_eq_i64(0x4444_4444_4444_4444) == true
function %icmp_neg_eq_i64(i64) -> b1 {
block0(v0: i64):
v1 = icmp_imm eq v0, 0xffff_ffff_4444_4444
return v1
}
; run: %icmp_neg_eq_i64(0) == false
; run: %icmp_neg_eq_i64(-1) == false
; run: %icmp_neg_eq_i64(0xffff_ffff_4444_4444) == true

View File

@@ -2,6 +2,7 @@ test interpret
test run
target aarch64
target x86_64
target s390x
function %icmp_eq_i8(i8, i8) -> b1 {
block0(v0: i8, v1: i8):

View File

@@ -2,6 +2,7 @@ test interpret
test run
target aarch64
target x86_64
target s390x
function %icmp_ne_i8(i8, i8) -> b1 {
block0(v0: i8, v1: i8):

View File

@@ -2,6 +2,7 @@ test interpret
test run
target aarch64
target x86_64
target s390x
function %icmp_sge_i8(i8, i8) -> b1 {

View File

@@ -2,6 +2,7 @@ test interpret
test run
target aarch64
target x86_64
target s390x
function %icmp_sgt_i8(i8, i8) -> b1 {

View File

@@ -2,6 +2,7 @@ test interpret
test run
target aarch64
target x86_64
target s390x
function %icmp_sle_i8(i8, i8) -> b1 {

View File

@@ -2,6 +2,7 @@ test interpret
test run
target aarch64
target x86_64
target s390x
function %icmp_slt_i8(i8, i8) -> b1 {
block0(v0: i8, v1: i8):

View File

@@ -2,6 +2,7 @@ test interpret
test run
target aarch64
target x86_64
target s390x
function %icmp_uge_i8(i8, i8) -> b1 {
block0(v0: i8, v1: i8):

View File

@@ -2,6 +2,7 @@ test interpret
test run
target aarch64
target x86_64
target s390x
function %icmp_ule_i8(i8, i8) -> b1 {
block0(v0: i8, v1: i8):

View File

@@ -2,6 +2,7 @@ test interpret
test run
target aarch64
target x86_64
target s390x
function %icmp_ult_i8(i8, i8) -> b1 {
block0(v0: i8, v1: i8):