cranelift-interpreter: Fix incorrect scalar_to_vector result (#6133)

* The `vectorizelanes` function performs a check to see whether there
is a single value provided in an array, and if so returns it as a
scalar.

While elsewhere in the interpreter this behaviour is relied
upon, it yields an incorrect result when attempting to convert a
scalar to a vector.

The original `vectorizelanes` remains untouched, however, an
unconditional variant `vectorizelanes_all` was added.

* A test was added under `filetests/runtests/issue5911.clif`.

Fixes #5911
This commit is contained in:
Jan-Justin van Tonder
2023-04-04 14:14:16 +02:00
committed by GitHub
parent c85bf27ff8
commit c475735f5e
3 changed files with 22 additions and 9 deletions

View File

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

View File

@@ -1,4 +1,5 @@
test run
test interpret
target aarch64
target s390x
set enable_simd
@@ -18,6 +19,7 @@ block0(v0: i64):
v1 = scalar_to_vector.i64x2 v0
return v1
}
; run: %scalartovector_i64(0) == [0 0]
; run: %scalartovector_i64(1) == [1 0]
; run: %scalartovector_i64(18446744073709551615) == [18446744073709551615 0]