* cranelift: Reorganize test suite Group some SIMD operations by instruction. * cranelift: Deduplicate some shift tests Also, new tests with the mod behaviour * aarch64: Lower shifts with mod behaviour * x64: Lower shifts with mod behaviour * wasmtime: Don't mask SIMD shifts
59 lines
1.7 KiB
Plaintext
59 lines
1.7 KiB
Plaintext
test run
|
|
set enable_simd
|
|
target aarch64
|
|
target s390x
|
|
target x86_64 skylake
|
|
|
|
|
|
function %sshr_i8x16(i8x16, i32) -> i8x16 {
|
|
block0(v0: i8x16, v1: i32):
|
|
v2 = sshr v0, v1
|
|
return v2
|
|
}
|
|
; run: %sshr_i8x16([0 0xff 2 0xfd 4 0xfb 6 0xf9 8 0xf7 10 0xf5 12 0xf3 14 0xf1], 1) == [0 0xff 1 0xfe 2 0xfd 3 0xfc 4 0xfb 5 0xfa 6 0xf9 7 0xf8]
|
|
; run: %sshr_i8x16([0 0xff 2 0xfd 4 0xfb 6 0xf9 8 0xf7 10 0xf5 12 0xf3 14 0xf1], 9) == [0 0xff 1 0xfe 2 0xfd 3 0xfc 4 0xfb 5 0xfa 6 0xf9 7 0xf8]
|
|
|
|
function %sshr_i16x8(i16x8, i32) -> i16x8 {
|
|
block0(v0: i16x8, v1: i32):
|
|
v2 = sshr v0, v1
|
|
return v2
|
|
}
|
|
; note: because of the shifted-in sign-bit, lane 0 remains -1 == 0xffff, whereas lane 4 has been shifted to -8 == 0xfff8
|
|
; run: %sshr_i16x8([-1 2 4 8 -16 32 64 128], 1) == [-1 1 2 4 -8 16 32 64]
|
|
; run: %sshr_i16x8([-1 2 4 8 -16 32 64 128], 17) == [-1 1 2 4 -8 16 32 64]
|
|
|
|
function %sshr_i32x4(i32x4, i32) -> i32x4 {
|
|
block0(v0: i32x4, v1: i32):
|
|
v2 = sshr v0, v1
|
|
return v2
|
|
}
|
|
; run: %sshr_i32x4([1 2 4 -8], 1) == [0 1 2 -4]
|
|
; run: %sshr_i32x4([1 2 4 -8], 33) == [0 1 2 -4]
|
|
|
|
function %sshr_i64x2(i64x2, i32) -> i64x2 {
|
|
block0(v0:i64x2, v1:i32):
|
|
v2 = sshr v0, v1
|
|
return v2
|
|
}
|
|
; run: %sshr_i64x2([1 -1], 0) == [1 -1]
|
|
; run: %sshr_i64x2([1 -1], 1) == [0 -1] ; note the -1 shift result
|
|
; run: %sshr_i64x2([2 -2], 1) == [1 -1]
|
|
; run: %sshr_i64x2([0x80000000_00000000 0x7FFFFFFF_FFFFFFFF], 63) == [0xFFFFFFFF_FFFFFFFF 0]
|
|
; run: %sshr_i64x2([2 -2], 65) == [1 -1]
|
|
|
|
|
|
|
|
function %sshr_imm_i32x4(i32x4) -> i32x4 {
|
|
block0(v0: i32x4):
|
|
v1 = sshr_imm v0, 1
|
|
return v1
|
|
}
|
|
; run: %sshr_imm_i32x4([1 2 4 -8]) == [0 1 2 -4]
|
|
|
|
function %sshr_imm_i16x8(i16x8) -> i16x8 {
|
|
block0(v0: i16x8):
|
|
v1 = sshr_imm v0, 1
|
|
return v1
|
|
}
|
|
; run: %sshr_imm_i16x8([1 2 4 -8 0 0 0 0]) == [0 1 2 -4 0 0 0 0]
|