Enable SIMD lane spec test on x86 (#1760)

* Ensure GlobalSet on vectors are cast to Cranelift's I8X16 type

This is a fix related to the decision to use Cranelift's I8X16 type to represent Wasm's V128--it requires casting to maintain type correctness. See https://github.com/bytecodealliance/wasmtime/issues/1147.

* Enable SIMD spec test: simd_lane.wast
This commit is contained in:
Andrew Brown
2020-05-29 14:05:35 -07:00
committed by GitHub
parent 0b3b9c298e
commit c274efe9c1
2 changed files with 5 additions and 2 deletions

View File

@@ -125,7 +125,11 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
GlobalVariable::Memory { gv, offset, ty } => {
let addr = builder.ins().global_value(environ.pointer_type(), gv);
let flags = ir::MemFlags::trusted();
let val = state.pop1();
let mut val = state.pop1();
// Ensure SIMD values are cast to their default Cranelift type, I8x16.
if ty.is_vector() {
val = optionally_bitcast_vector(val, I8X16, builder);
}
debug_assert_eq!(ty, builder.func.dfg.value_type(val));
builder.ins().store(flags, val, addr, offset);
}