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

[wasm-simd] Rename load splat and load extend

Rename opcodes based on the renaming in the proposal,
https://github.com/WebAssembly/simd/pull/322.

Bug: v8:10946
Change-Id: If267d6f8fb1b9deeff64cd9abcd7e4cd64a540a5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2422357
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70077}
parent 1724c77c
......@@ -3400,41 +3400,41 @@ class WasmFullDecoder : public WasmDecoder<validate> {
return DecodeLoadTransformMem(LoadType::kI64Load,
LoadTransformationKind::kZeroExtend,
opcode_length);
case kExprS8x16LoadSplat:
case kExprS128Load8Splat:
return DecodeLoadTransformMem(LoadType::kI32Load8S,
LoadTransformationKind::kSplat,
opcode_length);
case kExprS16x8LoadSplat:
case kExprS128Load16Splat:
return DecodeLoadTransformMem(LoadType::kI32Load16S,
LoadTransformationKind::kSplat,
opcode_length);
case kExprS32x4LoadSplat:
case kExprS128Load32Splat:
return DecodeLoadTransformMem(
LoadType::kI32Load, LoadTransformationKind::kSplat, opcode_length);
case kExprS64x2LoadSplat:
case kExprS128Load64Splat:
return DecodeLoadTransformMem(
LoadType::kI64Load, LoadTransformationKind::kSplat, opcode_length);
case kExprI16x8Load8x8S:
case kExprS128Load8x8S:
return DecodeLoadTransformMem(LoadType::kI32Load8S,
LoadTransformationKind::kExtend,
opcode_length);
case kExprI16x8Load8x8U:
case kExprS128Load8x8U:
return DecodeLoadTransformMem(LoadType::kI32Load8U,
LoadTransformationKind::kExtend,
opcode_length);
case kExprI32x4Load16x4S:
case kExprS128Load16x4S:
return DecodeLoadTransformMem(LoadType::kI32Load16S,
LoadTransformationKind::kExtend,
opcode_length);
case kExprI32x4Load16x4U:
case kExprS128Load16x4U:
return DecodeLoadTransformMem(LoadType::kI32Load16U,
LoadTransformationKind::kExtend,
opcode_length);
case kExprI64x2Load32x2S:
case kExprS128Load32x2S:
return DecodeLoadTransformMem(LoadType::kI64Load32S,
LoadTransformationKind::kExtend,
opcode_length);
case kExprI64x2Load32x2U:
case kExprS128Load32x2U:
return DecodeLoadTransformMem(LoadType::kI64Load32U,
LoadTransformationKind::kExtend,
opcode_length);
......
......@@ -306,16 +306,16 @@ constexpr const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) {
CASE_S128_OP(LoadMem32Zero, "load32_zero")
CASE_S128_OP(LoadMem64Zero, "load64_zero")
CASE_S8x16_OP(LoadSplat, "load_splat")
CASE_S16x8_OP(LoadSplat, "load_splat")
CASE_S32x4_OP(LoadSplat, "load_splat")
CASE_S64x2_OP(LoadSplat, "load_splat")
CASE_I16x8_OP(Load8x8S, "load8x8_s")
CASE_I16x8_OP(Load8x8U, "load8x8_u")
CASE_I32x4_OP(Load16x4S, "load16x4_s")
CASE_I32x4_OP(Load16x4U, "load16x4_u")
CASE_I64x2_OP(Load32x2S, "load32x2_s")
CASE_I64x2_OP(Load32x2U, "load32x2_u")
CASE_S128_OP(Load8Splat, "load8_splat")
CASE_S128_OP(Load16Splat, "load16_splat")
CASE_S128_OP(Load32Splat, "load32_splat")
CASE_S128_OP(Load64Splat, "load64_splat")
CASE_S128_OP(Load8x8S, "load8x8_s")
CASE_S128_OP(Load8x8U, "load8x8_u")
CASE_S128_OP(Load16x4S, "load16x4_s")
CASE_S128_OP(Load16x4U, "load16x4_u")
CASE_S128_OP(Load32x2S, "load32x2_s")
CASE_S128_OP(Load32x2U, "load32x2_u")
CASE_I8x16_OP(RoundingAverageU, "avgr_u")
CASE_I16x8_OP(RoundingAverageU, "avgr_u")
......
......@@ -277,16 +277,16 @@ bool IsJSCompatibleSignature(const FunctionSig* sig, const WasmModule* module,
#define FOREACH_SIMD_MEM_OPCODE(V) \
V(S128LoadMem, 0xfd00, s_i) \
V(I16x8Load8x8S, 0xfd01, s_i) \
V(I16x8Load8x8U, 0xfd02, s_i) \
V(I32x4Load16x4S, 0xfd03, s_i) \
V(I32x4Load16x4U, 0xfd04, s_i) \
V(I64x2Load32x2S, 0xfd05, s_i) \
V(I64x2Load32x2U, 0xfd06, s_i) \
V(S8x16LoadSplat, 0xfd07, s_i) \
V(S16x8LoadSplat, 0xfd08, s_i) \
V(S32x4LoadSplat, 0xfd09, s_i) \
V(S64x2LoadSplat, 0xfd0a, s_i) \
V(S128Load8x8S, 0xfd01, s_i) \
V(S128Load8x8U, 0xfd02, s_i) \
V(S128Load16x4S, 0xfd03, s_i) \
V(S128Load16x4U, 0xfd04, s_i) \
V(S128Load32x2S, 0xfd05, s_i) \
V(S128Load32x2U, 0xfd06, s_i) \
V(S128Load8Splat, 0xfd07, s_i) \
V(S128Load16Splat, 0xfd08, s_i) \
V(S128Load32Splat, 0xfd09, s_i) \
V(S128Load64Splat, 0xfd0a, s_i) \
V(S128StoreMem, 0xfd0b, v_is)
#define FOREACH_SIMD_CONST_OPCODE(V) V(S128Const, 0xfd0c, _)
......
......@@ -3415,7 +3415,7 @@ WASM_SIMD_TEST(SimdLoadStoreLoadMemargOffset) {
// Test a multi-byte opcode with offset values that encode into valid opcodes.
// This is to exercise decoding logic and make sure we get the lengths right.
WASM_SIMD_TEST(S8x16LoadSplatOffset) {
WASM_SIMD_TEST(S128Load8SplatOffset) {
// This offset is [82, 22] when encoded, which contains valid opcodes.
constexpr int offset = 4354;
WasmRunner<int32_t> r(execution_tier, lower_simd);
......@@ -3423,7 +3423,7 @@ WASM_SIMD_TEST(S8x16LoadSplatOffset) {
int8_t* global = r.builder().AddGlobal<int8_t>(kWasmS128);
BUILD(r,
WASM_SET_GLOBAL(
0, WASM_SIMD_LOAD_OP_OFFSET(kExprS8x16LoadSplat, WASM_I32V(0),
0, WASM_SIMD_LOAD_OP_OFFSET(kExprS128Load8Splat, WASM_I32V(0),
U32V_2(offset))),
WASM_ONE);
......@@ -3473,20 +3473,20 @@ void RunLoadSplatTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
}
}
WASM_SIMD_TEST(S8x16LoadSplat) {
RunLoadSplatTest<int8_t>(execution_tier, lower_simd, kExprS8x16LoadSplat);
WASM_SIMD_TEST(S128Load8Splat) {
RunLoadSplatTest<int8_t>(execution_tier, lower_simd, kExprS128Load8Splat);
}
WASM_SIMD_TEST(S16x8LoadSplat) {
RunLoadSplatTest<int16_t>(execution_tier, lower_simd, kExprS16x8LoadSplat);
WASM_SIMD_TEST(S128Load16Splat) {
RunLoadSplatTest<int16_t>(execution_tier, lower_simd, kExprS128Load16Splat);
}
WASM_SIMD_TEST(S32x4LoadSplat) {
RunLoadSplatTest<int32_t>(execution_tier, lower_simd, kExprS32x4LoadSplat);
WASM_SIMD_TEST(S128Load32Splat) {
RunLoadSplatTest<int32_t>(execution_tier, lower_simd, kExprS128Load32Splat);
}
WASM_SIMD_TEST_NO_LOWERING(S64x2LoadSplat) {
RunLoadSplatTest<int64_t>(execution_tier, lower_simd, kExprS64x2LoadSplat);
WASM_SIMD_TEST_NO_LOWERING(S128Load64Splat) {
RunLoadSplatTest<int64_t>(execution_tier, lower_simd, kExprS128Load64Splat);
}
template <typename S, typename T>
......@@ -3564,33 +3564,33 @@ void RunLoadExtendTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
}
}
WASM_SIMD_TEST(I16x8Load8x8U) {
WASM_SIMD_TEST(S128Load8x8U) {
RunLoadExtendTest<uint8_t, uint16_t>(execution_tier, lower_simd,
kExprI16x8Load8x8U);
kExprS128Load8x8U);
}
WASM_SIMD_TEST(I16x8Load8x8S) {
WASM_SIMD_TEST(S128Load8x8S) {
RunLoadExtendTest<int8_t, int16_t>(execution_tier, lower_simd,
kExprI16x8Load8x8S);
kExprS128Load8x8S);
}
WASM_SIMD_TEST(I32x4Load16x4U) {
WASM_SIMD_TEST(S128Load16x4U) {
RunLoadExtendTest<uint16_t, uint32_t>(execution_tier, lower_simd,
kExprI32x4Load16x4U);
kExprS128Load16x4U);
}
WASM_SIMD_TEST(I32x4Load16x4S) {
WASM_SIMD_TEST(S128Load16x4S) {
RunLoadExtendTest<int16_t, int32_t>(execution_tier, lower_simd,
kExprI32x4Load16x4S);
kExprS128Load16x4S);
}
WASM_SIMD_TEST(I64x2Load32x2U) {
WASM_SIMD_TEST(S128Load32x2U) {
RunLoadExtendTest<uint32_t, uint64_t>(execution_tier, lower_simd,
kExprI64x2Load32x2U);
kExprS128Load32x2U);
}
WASM_SIMD_TEST(I64x2Load32x2S) {
WASM_SIMD_TEST(S128Load32x2S) {
RunLoadExtendTest<int32_t, int64_t>(execution_tier, lower_simd,
kExprI64x2Load32x2S);
kExprS128Load32x2S);
}
// TODO(v8:10713): Prototyping v128.load32_zero and v128.load64_zero.
......
......@@ -2631,43 +2631,43 @@ class WasmInterpreterInternals {
QFM_CASE(F64x2Qfma, f64x2, float2, 2, +)
QFM_CASE(F64x2Qfms, f64x2, float2, 2, -)
#undef QFM_CASE
case kExprS8x16LoadSplat: {
case kExprS128Load8Splat: {
return DoSimdLoadSplat<int16, int32_t, int8_t>(
decoder, code, pc, len, MachineRepresentation::kWord8);
}
case kExprS16x8LoadSplat: {
case kExprS128Load16Splat: {
return DoSimdLoadSplat<int8, int32_t, int16_t>(
decoder, code, pc, len, MachineRepresentation::kWord16);
}
case kExprS32x4LoadSplat: {
case kExprS128Load32Splat: {
return DoSimdLoadSplat<int4, int32_t, int32_t>(
decoder, code, pc, len, MachineRepresentation::kWord32);
}
case kExprS64x2LoadSplat: {
case kExprS128Load64Splat: {
return DoSimdLoadSplat<int2, int64_t, int64_t>(
decoder, code, pc, len, MachineRepresentation::kWord64);
}
case kExprI16x8Load8x8S: {
case kExprS128Load8x8S: {
return DoSimdLoadExtend<int8, int16_t, int8_t>(
decoder, code, pc, len, MachineRepresentation::kWord64);
}
case kExprI16x8Load8x8U: {
case kExprS128Load8x8U: {
return DoSimdLoadExtend<int8, uint16_t, uint8_t>(
decoder, code, pc, len, MachineRepresentation::kWord64);
}
case kExprI32x4Load16x4S: {
case kExprS128Load16x4S: {
return DoSimdLoadExtend<int4, int32_t, int16_t>(
decoder, code, pc, len, MachineRepresentation::kWord64);
}
case kExprI32x4Load16x4U: {
case kExprS128Load16x4U: {
return DoSimdLoadExtend<int4, uint32_t, uint16_t>(
decoder, code, pc, len, MachineRepresentation::kWord64);
}
case kExprI64x2Load32x2S: {
case kExprS128Load32x2S: {
return DoSimdLoadExtend<int2, int64_t, int32_t>(
decoder, code, pc, len, MachineRepresentation::kWord64);
}
case kExprI64x2Load32x2U: {
case kExprS128Load32x2U: {
return DoSimdLoadExtend<int2, uint64_t, uint32_t>(
decoder, code, pc, len, MachineRepresentation::kWord64);
}
......
......@@ -274,13 +274,13 @@ class WasmGenerator {
case kExprI64AtomicXor:
case kExprI64AtomicExchange:
case kExprI64AtomicCompareExchange:
case kExprI16x8Load8x8S:
case kExprI16x8Load8x8U:
case kExprI32x4Load16x4S:
case kExprI32x4Load16x4U:
case kExprI64x2Load32x2S:
case kExprI64x2Load32x2U:
case kExprS64x2LoadSplat:
case kExprS128Load8x8S:
case kExprS128Load8x8U:
case kExprS128Load16x4S:
case kExprS128Load16x4U:
case kExprS128Load32x2S:
case kExprS128Load32x2U:
case kExprS128Load64Splat:
return 3;
case kExprI32LoadMem:
case kExprI64LoadMem32S:
......@@ -307,7 +307,7 @@ class WasmGenerator {
case kExprI64AtomicXor32U:
case kExprI64AtomicExchange32U:
case kExprI64AtomicCompareExchange32U:
case kExprS32x4LoadSplat:
case kExprS128Load32Splat:
return 2;
case kExprI32LoadMem16S:
case kExprI32LoadMem16U:
......@@ -333,7 +333,7 @@ class WasmGenerator {
case kExprI64AtomicXor16U:
case kExprI64AtomicExchange16U:
case kExprI64AtomicCompareExchange16U:
case kExprS16x8LoadSplat:
case kExprS128Load16Splat:
return 1;
case kExprI32LoadMem8S:
case kExprI32LoadMem8U:
......@@ -359,7 +359,7 @@ class WasmGenerator {
case kExprI64AtomicXor8U:
case kExprI64AtomicExchange8U:
case kExprI64AtomicCompareExchange8U:
case kExprS8x16LoadSplat:
case kExprS128Load8Splat:
return 0;
default:
return 0;
......@@ -1537,16 +1537,16 @@ void WasmGenerator::Generate<ValueType::kS128>(DataRange* data) {
ValueType::kS128>,
&WasmGenerator::memop<kExprS128LoadMem>,
&WasmGenerator::memop<kExprI16x8Load8x8S>,
&WasmGenerator::memop<kExprI16x8Load8x8U>,
&WasmGenerator::memop<kExprI32x4Load16x4S>,
&WasmGenerator::memop<kExprI32x4Load16x4U>,
&WasmGenerator::memop<kExprI64x2Load32x2S>,
&WasmGenerator::memop<kExprI64x2Load32x2U>,
&WasmGenerator::memop<kExprS8x16LoadSplat>,
&WasmGenerator::memop<kExprS16x8LoadSplat>,
&WasmGenerator::memop<kExprS32x4LoadSplat>,
&WasmGenerator::memop<kExprS64x2LoadSplat>};
&WasmGenerator::memop<kExprS128Load8x8S>,
&WasmGenerator::memop<kExprS128Load8x8U>,
&WasmGenerator::memop<kExprS128Load16x4S>,
&WasmGenerator::memop<kExprS128Load16x4U>,
&WasmGenerator::memop<kExprS128Load32x2S>,
&WasmGenerator::memop<kExprS128Load32x2U>,
&WasmGenerator::memop<kExprS128Load8Splat>,
&WasmGenerator::memop<kExprS128Load16Splat>,
&WasmGenerator::memop<kExprS128Load32Splat>,
&WasmGenerator::memop<kExprS128Load64Splat>};
GenerateOneOf(alternatives, data);
}
......
......@@ -15,7 +15,7 @@ builder.addFunction(undefined, 0 /* sig */)
// signature: i_v
// body:
kExprI32Const, 0x00, // i32.const
kSimdPrefix, kExprI16x8Load8x8U, 0x03, 0xff, 0xff, 0x3f, // i16x8.load8x8_u
kSimdPrefix, kExprS128Load8x8U, 0x03, 0xff, 0xff, 0x3f, // i16x8.load8x8_u
kSimdPrefix, kExprI16x8ExtractLaneS, 0,
kExprEnd, // end @371
]).exportAs('main');
......
......@@ -484,16 +484,16 @@ let kExprI64AtomicCompareExchange32U = 0x4e;
// Simd opcodes.
let kExprS128LoadMem = 0x00;
let kExprI16x8Load8x8S = 0x01;
let kExprI16x8Load8x8U = 0x02;
let kExprI32x4Load16x4S = 0x03;
let kExprI32x4Load16x4U = 0x04;
let kExprI64x2Load32x2S = 0x05;
let kExprI64x2Load32x2U = 0x06;
let kExprS8x16LoadSplat = 0x07;
let kExprS16x8LoadSplat = 0x08;
let kExprS32x4LoadSplat = 0x09;
let kExprS64x2LoadSplat = 0x0a;
let kExprS128Load8x8S = 0x01;
let kExprS128Load8x8U = 0x02;
let kExprS128Load16x4S = 0x03;
let kExprS128Load16x4U = 0x04;
let kExprS128Load32x2S = 0x05;
let kExprS128Load32x2U = 0x06;
let kExprS128Load8Splat = 0x07;
let kExprS128Load16Splat = 0x08;
let kExprS128Load32Splat = 0x09;
let kExprS128Load64Splat = 0x0a;
let kExprS128StoreMem = 0x0b;
let kExprS128Const = 0x0c;
......
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