[wasm-simd] Implement load_splat in interpreter
Bug: v8:9886 Change-Id: I860bea0c317e9666662329e9b36598952c8ecfad Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1919697 Commit-Queue: Zhi An Ng <zhin@chromium.org> Reviewed-by: Bill Budge <bbudge@chromium.org> Cr-Commit-Position: refs/heads/master@{#65050}
This commit is contained in:
parent
2072772592
commit
d30ec8566b
@ -2644,11 +2644,41 @@ class ThreadImpl {
|
||||
QFM_CASE(F64x2Qfma, f64x2, float2, 2, +)
|
||||
QFM_CASE(F64x2Qfms, f64x2, float2, 2, -)
|
||||
#undef QFM_CASE
|
||||
case kExprS8x16LoadSplat: {
|
||||
return DoSimdLoadSplat<int16, int32_t, int8_t>(
|
||||
decoder, code, pc, len, MachineRepresentation::kWord8);
|
||||
}
|
||||
case kExprS16x8LoadSplat: {
|
||||
return DoSimdLoadSplat<int8, int32_t, int16_t>(
|
||||
decoder, code, pc, len, MachineRepresentation::kWord16);
|
||||
}
|
||||
case kExprS32x4LoadSplat: {
|
||||
return DoSimdLoadSplat<int4, int32_t, int32_t>(
|
||||
decoder, code, pc, len, MachineRepresentation::kWord32);
|
||||
}
|
||||
case kExprS64x2LoadSplat: {
|
||||
return DoSimdLoadSplat<int2, int64_t, int64_t>(
|
||||
decoder, code, pc, len, MachineRepresentation::kWord64);
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename s_type, typename result_type, typename load_type>
|
||||
bool DoSimdLoadSplat(Decoder* decoder, InterpreterCode* code, pc_t pc,
|
||||
int* const len, MachineRepresentation rep) {
|
||||
if (!ExecuteLoad<result_type, load_type>(decoder, code, pc, len, rep,
|
||||
/*prefix_len=*/1)) {
|
||||
return false;
|
||||
}
|
||||
result_type v = Pop().to<result_type>();
|
||||
s_type s;
|
||||
for (size_t i = 0; i < arraysize(s.val); i++) s.val[i] = v;
|
||||
Push(WasmValue(Simd128(s)));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if our control stack (frames_) exceeds the limit. Trigger stack
|
||||
// overflow if it does, and unwinding the current frame.
|
||||
// Returns true if execution can continue, false if the current activation was
|
||||
|
@ -3277,10 +3277,6 @@ WASM_SIMD_TEST(SimdLoadStoreLoadMemargOffset) {
|
||||
template <typename T>
|
||||
void RunLoadSplatTest(ExecutionTier execution_tier, LowerSimd lower_simd,
|
||||
WasmOpcode op) {
|
||||
if (execution_tier == ExecutionTier::kInterpreter) {
|
||||
// TODO(zhin): implement for interpreter
|
||||
return;
|
||||
}
|
||||
constexpr int lanes = 16 / sizeof(T);
|
||||
constexpr int mem_index = 16; // Load from mem index 16 (bytes).
|
||||
WasmRunner<int32_t> r(execution_tier, lower_simd);
|
||||
|
Loading…
Reference in New Issue
Block a user