Commit f711f5a1 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd][fuzzer] Add S8x16Shuffle to fuzzer

Bug: v8:10180
Change-Id: I5e7e83c23b6029cc5b55c2aadee77898173a77f0
Fixed: v8:9543
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2110951Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67071}
parent e3e81892
......@@ -55,6 +55,8 @@ WasmFunctionBuilder::WasmFunctionBuilder(WasmModuleBuilder* builder)
direct_calls_(builder->zone()),
asm_offsets_(builder->zone(), 8) {}
void WasmFunctionBuilder::EmitByte(byte val) { body_.write_u8(val); }
void WasmFunctionBuilder::EmitI32V(int32_t val) { body_.write_i32v(val); }
void WasmFunctionBuilder::EmitU32V(uint32_t val) { body_.write_u32v(val); }
......
......@@ -159,6 +159,7 @@ class V8_EXPORT_PRIVATE WasmFunctionBuilder : public ZoneObject {
// Building methods.
void SetSignature(FunctionSig* sig);
uint32_t AddLocal(ValueType type);
void EmitByte(byte b);
void EmitI32V(int32_t val);
void EmitU32V(uint32_t val);
void EmitCode(const byte* code, uint32_t code_size);
......
......@@ -312,6 +312,14 @@ class WasmGenerator {
builder_->EmitWithPrefix(Op);
}
void simd_shuffle(DataRange* data) {
Generate<ValueType::kS128, ValueType::kS128>(data);
builder_->EmitWithPrefix(kExprS8x16Shuffle);
for (int i = 0; i < kSimd128Size; i++) {
builder_->EmitByte(static_cast<uint8_t>(data->get<byte>() % 32));
}
}
void drop(DataRange* data) {
Generate(GetValueType(data), data);
builder_->Emit(kExprDrop);
......@@ -1165,6 +1173,8 @@ void WasmGenerator::Generate<ValueType::kS128>(DataRange* data) {
&WasmGenerator::simd_op<kExprF64x2Add, ValueType::kS128,
ValueType::kS128>,
&WasmGenerator::simd_shuffle,
&WasmGenerator::memop<kExprS128LoadMem>};
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