[wasm-simd][fuzzer] Add load/store lane instructions to fuzzer

Bug: v8:10975
Change-Id: Icfc5982c96132ef3eaa4d8b9dc2b8229d87ab15e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2659509
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72464}
This commit is contained in:
Ng Zhi An 2021-01-29 14:35:36 -08:00 committed by Commit Bot
parent 8665f09771
commit 3ba83f2d43

View File

@ -418,6 +418,13 @@ class WasmGenerator {
builder_->EmitByte(data->get<byte>() % lanes);
}
template <WasmOpcode Op, int lanes, ValueType::Kind... Args>
void simd_lane_memop(DataRange* data) {
// Simd load/store instructions that have a lane immediate.
memop<Op, Args...>(data);
builder_->EmitByte(data->get<byte>() % lanes);
}
void simd_shuffle(DataRange* data) {
Generate<ValueType::kS128, ValueType::kS128>(data);
builder_->EmitWithPrefix(kExprI8x16Shuffle);
@ -784,6 +791,14 @@ void WasmGenerator::Generate<ValueType::kStmt>(DataRange* data) {
&WasmGenerator::memop<kExprI64AtomicStore16U, ValueType::kI64>,
&WasmGenerator::memop<kExprI64AtomicStore32U, ValueType::kI64>,
&WasmGenerator::memop<kExprS128StoreMem, ValueType::kS128>,
&WasmGenerator::simd_lane_memop<kExprS128Store8Lane, 16,
ValueType::kS128>,
&WasmGenerator::simd_lane_memop<kExprS128Store16Lane, 8,
ValueType::kS128>,
&WasmGenerator::simd_lane_memop<kExprS128Store32Lane, 4,
ValueType::kS128>,
&WasmGenerator::simd_lane_memop<kExprS128Store64Lane, 2,
ValueType::kS128>,
&WasmGenerator::drop,
@ -1591,6 +1606,10 @@ void WasmGenerator::Generate<ValueType::kS128>(DataRange* data) {
&WasmGenerator::memop<kExprS128Load64Splat>,
&WasmGenerator::memop<kExprS128Load32Zero>,
&WasmGenerator::memop<kExprS128Load64Zero>,
&WasmGenerator::simd_lane_memop<kExprS128Load8Lane, 16>,
&WasmGenerator::simd_lane_memop<kExprS128Load16Lane, 8>,
&WasmGenerator::simd_lane_memop<kExprS128Load32Lane, 4>,
&WasmGenerator::simd_lane_memop<kExprS128Load64Lane, 2>,
};
GenerateOneOf(alternatives, data);