s390x: Enable more runtests, and fix a few bugs (#4516)

This enables more runtests to be executed on s390x.  Doing so
uncovered a two back-end bugs, which are fixed as well:

- The result of cls was always off by one.
- The result of popcnt.i16 has uninitialized high bits.

In addition, I found a bug in the load-op-store.clif test case:
     v3 = heap_addr.i64 heap0, v1, 4
     v4 = iconst.i64 42
     store.i32 v4, v3
This was clearly intended to perform a 32-bit store, but
actually performs a 64-bit store (it seems the type annotation
of the store opcode is ignored, and the type of the operand
is used instead).  That bug did not show any noticable symptoms
on little-endian architectures, but broke on big-endian.
This commit is contained in:
Ulrich Weigand
2022-07-25 21:37:06 +02:00
committed by GitHub
parent 7c67e620c4
commit dd40bf075a
17 changed files with 42 additions and 16 deletions

View File

@@ -93,7 +93,7 @@ block0(v0: i64):
; srag %r5, %r2, 63
; xgrk %r3, %r2, %r5
; flogr %r0, %r3
; lgr %r2, %r0
; aghik %r2, %r0, -1
; br %r14
function %cls_i32(i32) -> i32 {
@@ -107,7 +107,7 @@ block0(v0: i32):
; srag %r3, %r5, 63
; xgr %r5, %r3
; flogr %r0, %r5
; ahik %r2, %r0, -32
; ahik %r2, %r0, -33
; br %r14
function %cls_i16(i16) -> i16 {
@@ -121,7 +121,7 @@ block0(v0: i16):
; srag %r3, %r5, 63
; xgr %r5, %r3
; flogr %r0, %r5
; ahik %r2, %r0, -48
; ahik %r2, %r0, -49
; br %r14
function %cls_i8(i8) -> i8 {
@@ -135,7 +135,7 @@ block0(v0: i8):
; srag %r3, %r5, 63
; xgr %r5, %r3
; flogr %r0, %r5
; ahik %r2, %r0, -56
; ahik %r2, %r0, -57
; br %r14
function %ctz_i64(i64) -> i64 {
@@ -238,9 +238,9 @@ block0(v0: i16):
; block0:
; popcnt %r5, %r2
; sllk %r3, %r5, 8
; ar %r5, %r3
; srlk %r2, %r5, 8
; srlk %r3, %r5, 8
; ark %r2, %r5, %r3
; nill %r2, 255
; br %r14
function %popcnt_i8(i8) -> i8 {

View File

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

View File

@@ -1,6 +1,7 @@
test interpret
test run
target aarch64
target s390x
; not implemented on `x86_64`
function %cls_i8(i8) -> i8 {

View File

@@ -1,6 +1,7 @@
test interpret
test run
target aarch64
target s390x
target x86_64
target x86_64 has_lzcnt

View File

@@ -1,6 +1,7 @@
test run
target x86_64
target s390x
target aarch64
function %fpromote_f32_f64(i64 vmctx, i64, f32) -> f64 {

View File

@@ -1,6 +1,7 @@
test interpret
test run
target aarch64
target s390x
target x86_64
target x86_64 has_bmi1

View File

@@ -1,6 +1,7 @@
test interpret
test run
target aarch64
target s390x
; x86_64 only supports vector iabs
function %iabs_i8(i8) -> i8 {
@@ -41,4 +42,4 @@ block0(v0: i64):
; run: %iabs_i64(0) == 0
; run: %iabs_i64(9223372036854775807) == 9223372036854775807
; run: %iabs_i64(-9223372036854775807) == 9223372036854775807
; run: %iabs_i64(-9223372036854775808) == -9223372036854775808
; run: %iabs_i64(-9223372036854775808) == -9223372036854775808

View File

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

View File

@@ -1,6 +1,7 @@
test interpret
test run
target aarch64
target s390x
target x86_64
function %ireduce_i16_i8(i16) -> i8 {

View File

@@ -1,5 +1,6 @@
test run
target x86_64
target s390x
target aarch64
function %load_op_store_iadd_i64(i64 vmctx, i64, i64) -> i64 {
@@ -28,7 +29,7 @@ function %load_op_store_iadd_i32(i64 vmctx, i64, i32) -> i32 {
block0(v0: i64, v1: i64, v2: i32):
v3 = heap_addr.i64 heap0, v1, 4
v4 = iconst.i64 42
v4 = iconst.i32 42
store.i32 v4, v3
v5 = load.i32 v3
v6 = iadd.i32 v5, v2

View File

@@ -1,6 +1,7 @@
test interpret
test run
target aarch64
target s390x
target x86_64
target x86_64 has_popcnt

View File

@@ -1,5 +1,6 @@
test interpret
test run
target s390x
target x86_64
function %select_eq_f32(f32, f32) -> i32 {

View File

@@ -1,5 +1,6 @@
test run
target aarch64
target s390x
; i8 and i16 are invalid source sizes for x86_64
function %scalartovector_i8(i8) -> i8x16 {
@@ -16,4 +17,4 @@ block0(v0: i16):
return v1
}
; run: %scalartovector_i16(1) == [1 0 0 0 0 0 0 0]
; run: %scalartovector_i16(65535) == [65535 0 0 0 0 0 0 0]
; run: %scalartovector_i16(65535) == [65535 0 0 0 0 0 0 0]

View File

@@ -1,5 +1,6 @@
test run
target aarch64
target s390x
set enable_simd
target x86_64 has_sse3 has_ssse3 has_sse41

View File

@@ -1,6 +1,7 @@
test interpret
test run
target aarch64
target s390x
; x86_64 backend only supports `i16`, `i32`, and `i64` types.
function %smulhi_i8(i8, i8) -> i8 {
@@ -10,4 +11,4 @@ block0(v0: i8, v1: i8):
}
; run: %smulhi_i8(-2, -4) == 0
; run: %smulhi_i8(2, -4) == -1
; run: %smulhi_i8(127, 127) == 63
; run: %smulhi_i8(127, 127) == 63

View File

@@ -1,6 +1,7 @@
test interpret
test run
target aarch64
target s390x
set enable_simd
target x86_64 has_sse3 has_ssse3 has_sse41