Commit 3ba83f2d authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[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/+/2659509Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72464}
parent 8665f097
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment