Commit 6dfa47b6 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[test][cleanup] Rename WASM_*_GLOBAL to WASM_GLOBAL_*

The opcodes were renamed long ago, but the macros were still using the
old syntax.

This CL was created using the following script (for WASM_GET_GLOBAL and
WASM_SET_GLOBAL):
ag -l WASM_GET_GLOBAL | xargs -L 1 sed -i 's/\bWASM_GET_GLOBAL\b/WASM_GLOBAL_GET/g'

R=ahaas@chromium.org

Bug: v8:11074
Change-Id: I3a9bd64f6e09ce97dae6d4132c224350dc079c0f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2597576
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71836}
parent 91b102c7
......@@ -289,14 +289,14 @@ WASM_COMPILED_EXEC_TEST(WasmRefAsNonNull) {
const byte field_index = 0;
const byte kFunc = tester.DefineFunction(
tester.sigs.i_v(), {},
{WASM_SET_GLOBAL(
{WASM_GLOBAL_SET(
global_index,
WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(55), WASM_I32V(66),
WASM_RTT_CANON(type_index))),
WASM_STRUCT_GET(
type_index, field_index,
WASM_REF_AS_NON_NULL(WASM_IF_ELSE_R(kOptRefType, WASM_I32V(1),
WASM_GET_GLOBAL(global_index),
WASM_GLOBAL_GET(global_index),
WASM_REF_NULL(type_index)))),
kExprEnd});
......@@ -357,13 +357,13 @@ WASM_COMPILED_EXEC_TEST(BrOnCast) {
// as eqref.
WASM_LOCAL_SET(
1, WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(1),
WASM_GET_GLOBAL(rtt_index))),
WASM_GLOBAL_GET(rtt_index))),
WASM_LOCAL_GET(1),
// The struct is not an i31, so this branch isn't taken.
WASM_BR_ON_CAST(0, WASM_RTT_CANON(kI31RefCode)),
WASM_LOCAL_SET(0, WASM_I32V(222)), // Final result.
// This branch is taken.
WASM_BR_ON_CAST(0, WASM_GET_GLOBAL(rtt_index)),
WASM_BR_ON_CAST(0, WASM_GLOBAL_GET(rtt_index)),
// Not executed due to the branch.
WASM_DROP, WASM_LOCAL_SET(0, WASM_I32V(333))),
WASM_LOCAL_GET(0), kExprEnd});
......@@ -376,7 +376,7 @@ WASM_COMPILED_EXEC_TEST(BrOnCast) {
WASM_LOCAL_SET(1, WASM_I31_NEW(WASM_I32V(42))),
WASM_LOCAL_GET(1),
// The i31 is not a struct, so this branch isn't taken.
WASM_BR_ON_CAST(0, WASM_GET_GLOBAL(rtt_index)),
WASM_BR_ON_CAST(0, WASM_GLOBAL_GET(rtt_index)),
WASM_LOCAL_SET(0, WASM_I32V(222)), // Final result.
// This branch is taken.
WASM_BR_ON_CAST(0, WASM_RTT_CANON(kI31RefCode)),
......@@ -391,14 +391,14 @@ WASM_COMPILED_EXEC_TEST(BrOnCast) {
// Neither of these branches is taken for nullref.
WASM_BR_ON_CAST(0, WASM_RTT_CANON(kI31RefCode)),
WASM_LOCAL_SET(0, WASM_I32V(222)),
WASM_BR_ON_CAST(0, WASM_GET_GLOBAL(rtt_index)), WASM_DROP,
WASM_BR_ON_CAST(0, WASM_GLOBAL_GET(rtt_index)), WASM_DROP,
WASM_LOCAL_SET(0, WASM_I32V(333))), // Final result.
WASM_LOCAL_GET(0), kExprEnd});
const byte kTypedAfterBranch = tester.DefineFunction(
tester.sigs.i_v(), {kWasmI32, kWasmEqRef},
{WASM_LOCAL_SET(1, WASM_STRUCT_NEW_WITH_RTT(type_index, WASM_I32V(42),
WASM_GET_GLOBAL(rtt_index))),
WASM_GLOBAL_GET(rtt_index))),
WASM_BLOCK(WASM_LOCAL_SET(
// The outer block catches the struct left behind by the inner block
// and reads its field.
......@@ -409,7 +409,7 @@ WASM_COMPILED_EXEC_TEST(BrOnCast) {
// on the stack.
WASM_BLOCK_R(ValueType::Ref(type_index, kNonNullable),
WASM_LOCAL_GET(1),
WASM_BR_ON_CAST(0, WASM_GET_GLOBAL(rtt_index)),
WASM_BR_ON_CAST(0, WASM_GLOBAL_GET(rtt_index)),
// Returning 123 is the unreachable failure case.
WASM_LOCAL_SET(0, WASM_I32V(123)), WASM_BR(1))))),
WASM_LOCAL_GET(0), kExprEnd});
......@@ -1128,10 +1128,10 @@ TEST(I31Casts) {
tester.sigs.i_v(), {kWasmEqRef},
{WASM_LOCAL_SET(0, WASM_I31_NEW(WASM_I32V(42))),
WASM_I32_ADD(WASM_REF_TEST(kEqRefCode, kI31RefCode, WASM_LOCAL_GET(0),
WASM_GET_GLOBAL(i31_rtt)),
WASM_GLOBAL_GET(i31_rtt)),
WASM_I31_GET_S(WASM_REF_CAST(kEqRefCode, kI31RefCode,
WASM_LOCAL_GET(0),
WASM_GET_GLOBAL(i31_rtt)))),
WASM_GLOBAL_GET(i31_rtt)))),
kExprEnd});
// Adds the results of two unsuccessful type checks (an i31ref is not a
// struct, nor the other way round).
......@@ -1140,10 +1140,10 @@ TEST(I31Casts) {
{WASM_I32_ADD(
WASM_REF_TEST(kEqRefCode, kI31RefCode,
WASM_STRUCT_NEW_WITH_RTT(struct_type, WASM_I32V(42),
WASM_GET_GLOBAL(struct_rtt)),
WASM_GET_GLOBAL(i31_rtt)),
WASM_GLOBAL_GET(struct_rtt)),
WASM_GLOBAL_GET(i31_rtt)),
WASM_REF_TEST(kEqRefCode, struct_type, WASM_I31_NEW(WASM_I32V(23)),
WASM_GET_GLOBAL(struct_rtt))),
WASM_GLOBAL_GET(struct_rtt))),
kExprEnd});
// Tries to cast an i31ref to a struct, which should trap.
const byte kCastI31ToStruct = tester.DefineFunction(
......@@ -1152,7 +1152,7 @@ TEST(I31Casts) {
{WASM_STRUCT_GET(
struct_type, 0,
WASM_REF_CAST(kEqRefCode, struct_type, WASM_I31_NEW(WASM_I32V(42)),
WASM_GET_GLOBAL(struct_rtt))),
WASM_GLOBAL_GET(struct_rtt))),
kExprEnd});
// Tries to cast a struct to i31ref, which should trap.
const byte kCastStructToI31 = tester.DefineFunction(
......@@ -1161,8 +1161,8 @@ TEST(I31Casts) {
{WASM_I31_GET_S(
WASM_REF_CAST(kEqRefCode, kI31RefCode,
WASM_STRUCT_NEW_WITH_RTT(struct_type, WASM_I32V(42),
WASM_GET_GLOBAL(struct_rtt)),
WASM_GET_GLOBAL(i31_rtt))),
WASM_GLOBAL_GET(struct_rtt)),
WASM_GLOBAL_GET(i31_rtt))),
kExprEnd});
tester.CompileModule();
tester.CheckResult(kTestAndCastSuccess, 43);
......@@ -1200,9 +1200,9 @@ TEST(CastsBenchmark) {
const byte Prepare = tester.DefineFunction(
tester.sigs.i_v(), {wasm::kWasmI32},
{// List = new eqref[kListLength];
WASM_SET_GLOBAL(List,
WASM_GLOBAL_SET(List,
WASM_ARRAY_NEW_DEFAULT(ListType, WASM_I32V(kListLength),
WASM_GET_GLOBAL(RttList))),
WASM_GLOBAL_GET(RttList))),
// for (int i = 0; i < kListLength; ) {
// List[i] = new Super(i);
// i++;
......@@ -1211,14 +1211,14 @@ TEST(CastsBenchmark) {
// }
WASM_LOCAL_SET(i, WASM_I32V_1(0)),
WASM_LOOP(
WASM_ARRAY_SET(ListType, WASM_GET_GLOBAL(List), WASM_LOCAL_GET(i),
WASM_ARRAY_SET(ListType, WASM_GLOBAL_GET(List), WASM_LOCAL_GET(i),
WASM_STRUCT_NEW_WITH_RTT(SuperType, WASM_LOCAL_GET(i),
WASM_GET_GLOBAL(RttSuper))),
WASM_GLOBAL_GET(RttSuper))),
WASM_LOCAL_SET(i, WASM_I32_ADD(WASM_LOCAL_GET(i), WASM_I32V_1(1))),
WASM_ARRAY_SET(ListType, WASM_GET_GLOBAL(List), WASM_LOCAL_GET(i),
WASM_ARRAY_SET(ListType, WASM_GLOBAL_GET(List), WASM_LOCAL_GET(i),
WASM_STRUCT_NEW_WITH_RTT(SubType, WASM_LOCAL_GET(i),
WASM_I32V_1(0),
WASM_GET_GLOBAL(RttSub))),
WASM_GLOBAL_GET(RttSub))),
WASM_LOCAL_SET(i, WASM_I32_ADD(WASM_LOCAL_GET(i), WASM_I32V_1(1))),
WASM_BR_IF(0,
WASM_I32_NE(WASM_LOCAL_GET(i), WASM_I32V(kListLength)))),
......@@ -1236,7 +1236,7 @@ TEST(CastsBenchmark) {
wasm::kWasmI32,
ValueType::Ref(ListType, kNullable),
},
{WASM_LOCAL_SET(list, WASM_GET_GLOBAL(List)),
{WASM_LOCAL_SET(list, WASM_GLOBAL_GET(List)),
// sum = 0;
WASM_LOCAL_SET(sum, WASM_I32V_1(0)),
// for (int i = 0; i < kIterations; i++) {
......@@ -1255,7 +1255,7 @@ TEST(CastsBenchmark) {
ListType, WASM_LOCAL_GET(list),
WASM_I32_AND(WASM_LOCAL_GET(i),
WASM_I32V(kListLength - 1))),
WASM_GET_GLOBAL(RttSuper))))),
WASM_GLOBAL_GET(RttSuper))))),
WASM_LOCAL_SET(i, WASM_I32_ADD(WASM_LOCAL_GET(i), WASM_I32V_1(1))),
WASM_BR_IF(0,
WASM_I32_LTS(WASM_LOCAL_GET(i), WASM_I32V(kIterations)))),
......@@ -1279,7 +1279,7 @@ WASM_COMPILED_EXEC_TEST(GlobalInitReferencingGlobal) {
tester.AddGlobal(kWasmI32, false, WasmInitExpr::GlobalGet(from));
const byte func = tester.DefineFunction(tester.sigs.i_v(), {},
{WASM_GET_GLOBAL(to), kExprEnd});
{WASM_GLOBAL_GET(to), kExprEnd});
tester.CompileModule();
......
......@@ -1356,8 +1356,8 @@ WASM_EXEC_TEST(I64Global) {
int64_t* global = r.builder().AddGlobal<int64_t>();
// global = global + p0
BUILD(r,
WASM_SET_GLOBAL(0,
WASM_I64_AND(WASM_GET_GLOBAL(0),
WASM_GLOBAL_SET(0,
WASM_I64_AND(WASM_GLOBAL_GET(0),
WASM_I64_SCONVERT_I32(WASM_LOCAL_GET(0)))),
WASM_ZERO);
......
......@@ -429,12 +429,12 @@ TEST(Run_WasmModule_Global) {
uint32_t global2 = builder->AddGlobal(kWasmI32);
WasmFunctionBuilder* f1 = builder->AddFunction(sigs.i_v());
byte code1[] = {
WASM_I32_ADD(WASM_GET_GLOBAL(global1), WASM_GET_GLOBAL(global2))};
WASM_I32_ADD(WASM_GLOBAL_GET(global1), WASM_GLOBAL_GET(global2))};
EMIT_CODE_WITH_END(f1, code1);
WasmFunctionBuilder* f2 = builder->AddFunction(sigs.i_v());
ExportAsMain(f2);
byte code2[] = {WASM_SET_GLOBAL(global1, WASM_I32V_1(56)),
WASM_SET_GLOBAL(global2, WASM_I32V_1(41)),
byte code2[] = {WASM_GLOBAL_SET(global1, WASM_I32V_1(56)),
WASM_GLOBAL_SET(global2, WASM_I32V_1(41)),
WASM_RETURN1(WASM_CALL_FUNCTION0(f1->func_index()))};
EMIT_CODE_WITH_END(f2, code2);
TestModule(&zone, builder, 97);
......@@ -746,7 +746,7 @@ TEST(Run_WasmModule_Global_init) {
builder->AddGlobal(kWasmI32, false, WasmInitExpr(222222));
WasmFunctionBuilder* f1 = builder->AddFunction(sigs.i_v());
byte code[] = {
WASM_I32_ADD(WASM_GET_GLOBAL(global1), WASM_GET_GLOBAL(global2))};
WASM_I32_ADD(WASM_GLOBAL_GET(global1), WASM_GLOBAL_GET(global2))};
EMIT_CODE_WITH_END(f1, code);
ExportAsMain(f1);
TestModule(&zone, builder, 999999);
......@@ -777,7 +777,7 @@ static void RunWasmModuleGlobalInitTest(ValueType type, CType expected) {
}
WasmFunctionBuilder* f1 = builder->AddFunction(&sig);
byte code[] = {WASM_GET_GLOBAL(global)};
byte code[] = {WASM_GLOBAL_GET(global)};
EMIT_CODE_WITH_END(f1, code);
ExportAsMain(f1);
TestModule(&zone, builder, expected);
......
......@@ -41,7 +41,7 @@ WASM_SIMD_LIFTOFF_TEST(S128Global) {
int32_t* g0 = r.builder().AddGlobal<int32_t>(kWasmS128);
int32_t* g1 = r.builder().AddGlobal<int32_t>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(1, WASM_GET_GLOBAL(0)), WASM_ONE);
BUILD(r, WASM_GLOBAL_SET(1, WASM_GLOBAL_GET(0)), WASM_ONE);
int32_t expected = 0x1234;
for (int i = 0; i < 4; i++) {
......@@ -133,11 +133,11 @@ WASM_SIMD_LIFTOFF_TEST(I8x16Shuffle) {
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 31}};
// Set up locals so shuffle is called with non-adjacent registers v2 and v0.
BUILD(r, WASM_LOCAL_SET(local0, WASM_GET_GLOBAL(1)), // local0 is in v0
WASM_LOCAL_SET(local1, WASM_GET_GLOBAL(0)), // local1 is in v1
WASM_GET_GLOBAL(0), // global0 is in v2
BUILD(r, WASM_LOCAL_SET(local0, WASM_GLOBAL_GET(1)), // local0 is in v0
WASM_LOCAL_SET(local1, WASM_GLOBAL_GET(0)), // local1 is in v1
WASM_GLOBAL_GET(0), // global0 is in v2
WASM_LOCAL_GET(local0), // local0 is in v0
WASM_SET_GLOBAL(2, WASM_SIMD_I8x16_SHUFFLE_OP(
WASM_GLOBAL_SET(2, WASM_SIMD_I8x16_SHUFFLE_OP(
kExprI8x16Shuffle, pattern, WASM_NOP, WASM_NOP)),
WASM_ONE);
......@@ -171,9 +171,9 @@ WASM_SIMD_LIFTOFF_TEST(I8x16Shuffle_SingleOperand) {
{31, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}};
// Set up locals so shuffle is called with non-adjacent registers v2 and v0.
BUILD(r, WASM_LOCAL_SET(local0, WASM_GET_GLOBAL(0)), WASM_LOCAL_GET(local0),
BUILD(r, WASM_LOCAL_SET(local0, WASM_GLOBAL_GET(0)), WASM_LOCAL_GET(local0),
WASM_LOCAL_GET(local0),
WASM_SET_GLOBAL(1, WASM_SIMD_I8x16_SHUFFLE_OP(
WASM_GLOBAL_SET(1, WASM_SIMD_I8x16_SHUFFLE_OP(
kExprI8x16Shuffle, pattern, WASM_NOP, WASM_NOP)),
WASM_ONE);
......
......@@ -30,7 +30,7 @@ WASM_SIMD_TEST(I8x16ToF32x4) {
float* g = r.builder().AddGlobal<float>(kWasmS128);
byte param1 = 0;
BUILD(r,
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
0, WASM_SIMD_UNOP(kExprF32x4Sqrt,
WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(param1)))),
WASM_ONE);
......
......@@ -400,7 +400,7 @@ WASM_SIMD_TEST(S128Globals) {
// Set up a global to hold input and output vectors.
int32_t* g0 = r.builder().AddGlobal<int32_t>(kWasmS128);
int32_t* g1 = r.builder().AddGlobal<int32_t>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(1, WASM_GET_GLOBAL(0)), WASM_ONE);
BUILD(r, WASM_GLOBAL_SET(1, WASM_GLOBAL_GET(0)), WASM_ONE);
FOR_INT32_INPUTS(x) {
for (int i = 0; i < 4; i++) {
......@@ -420,7 +420,7 @@ WASM_SIMD_TEST(F32x4Splat) {
// Set up a global to hold output vector.
float* g = r.builder().AddGlobal<float>(kWasmS128);
byte param1 = 0;
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(param1))),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(param1))),
WASM_ONE);
FOR_FLOAT32_INPUTS(x) {
......@@ -450,7 +450,7 @@ WASM_SIMD_TEST(F32x4ReplaceLane) {
1, WASM_LOCAL_GET(temp1), WASM_F32(1.0f))),
WASM_LOCAL_SET(temp1, WASM_SIMD_F32x4_REPLACE_LANE(
2, WASM_LOCAL_GET(temp1), WASM_F32(2.0f))),
WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(
WASM_GLOBAL_SET(0, WASM_SIMD_F32x4_REPLACE_LANE(
3, WASM_LOCAL_GET(temp1), WASM_F32(3.0f))),
WASM_ONE);
......@@ -470,9 +470,9 @@ WASM_SIMD_TEST(F32x4ConvertI32x4) {
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
0, WASM_SIMD_UNOP(kExprF32x4SConvertI32x4, WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
1, WASM_SIMD_UNOP(kExprF32x4UConvertI32x4, WASM_LOCAL_GET(temp1))),
WASM_ONE);
......@@ -559,7 +559,7 @@ void RunF32x4UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_GLOBAL_SET(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_ONE);
FOR_FLOAT32_INPUTS(x) {
......@@ -646,7 +646,7 @@ void RunF32x4BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte temp2 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value1))),
WASM_LOCAL_SET(temp2, WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value2))),
WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_GLOBAL_SET(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp2))),
WASM_ONE);
......@@ -722,7 +722,7 @@ void RunF32x4CompareOpTest(TestExecutionTier execution_tier,
byte temp2 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value1))),
WASM_LOCAL_SET(temp2, WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value2))),
WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_GLOBAL_SET(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp2))),
WASM_ONE);
......@@ -835,7 +835,7 @@ WASM_SIMD_TEST_NO_LOWERING(F32x4Qfma) {
// Build fn to splat test values, perform compare op, and write the result.
byte value1 = 0, value2 = 1, value3 = 2;
BUILD(r,
WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_QFMA(
WASM_GLOBAL_SET(0, WASM_SIMD_F32x4_QFMA(
WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value1)),
WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value2)),
WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value3)))),
......@@ -860,7 +860,7 @@ WASM_SIMD_TEST_NO_LOWERING(F32x4Qfms) {
// Build fn to splat test values, perform compare op, and write the result.
byte value1 = 0, value2 = 1, value3 = 2;
BUILD(r,
WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_QFMS(
WASM_GLOBAL_SET(0, WASM_SIMD_F32x4_QFMS(
WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value1)),
WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value2)),
WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value3)))),
......@@ -883,7 +883,7 @@ WASM_SIMD_TEST(I64x2Splat) {
// Set up a global to hold output vector.
int64_t* g = r.builder().AddGlobal<int64_t>(kWasmS128);
byte param1 = 0;
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_I64x2_SPLAT(WASM_LOCAL_GET(param1))),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_I64x2_SPLAT(WASM_LOCAL_GET(param1))),
WASM_ONE);
FOR_INT64_INPUTS(x) {
......@@ -918,7 +918,7 @@ WASM_SIMD_TEST(I64x2ReplaceLane) {
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I64x2_SPLAT(WASM_I64V(-1))),
WASM_LOCAL_SET(temp1, WASM_SIMD_I64x2_REPLACE_LANE(
0, WASM_LOCAL_GET(temp1), WASM_I64V(0))),
WASM_SET_GLOBAL(0, WASM_SIMD_I64x2_REPLACE_LANE(
WASM_GLOBAL_SET(0, WASM_SIMD_I64x2_REPLACE_LANE(
1, WASM_LOCAL_GET(temp1), WASM_I64V(1))),
WASM_ONE);
......@@ -937,7 +937,7 @@ void RunI64x2UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I64x2_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_GLOBAL_SET(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_ONE);
FOR_INT64_INPUTS(x) {
......@@ -967,9 +967,9 @@ void RunI64x2ShiftOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
// Shift using an immediate, and shift using a value loaded from memory.
BUILD(
r, WASM_LOCAL_SET(simd, WASM_SIMD_I64x2_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_LOCAL_GET(simd),
WASM_GLOBAL_SET(0, WASM_SIMD_SHIFT_OP(opcode, WASM_LOCAL_GET(simd),
WASM_I32V(shift))),
WASM_SET_GLOBAL(1, WASM_SIMD_SHIFT_OP(
WASM_GLOBAL_SET(1, WASM_SIMD_SHIFT_OP(
opcode, WASM_LOCAL_GET(simd),
WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))),
WASM_ONE);
......@@ -1013,7 +1013,7 @@ void RunI64x2BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte temp2 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I64x2_SPLAT(WASM_LOCAL_GET(value1))),
WASM_LOCAL_SET(temp2, WASM_SIMD_I64x2_SPLAT(WASM_LOCAL_GET(value2))),
WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_GLOBAL_SET(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp2))),
WASM_ONE);
......@@ -1053,7 +1053,7 @@ WASM_SIMD_TEST(F64x2Splat) {
// Set up a global to hold output vector.
double* g = r.builder().AddGlobal<double>(kWasmS128);
byte param1 = 0;
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(param1))),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(param1))),
WASM_ONE);
FOR_FLOAT64_INPUTS(x) {
......@@ -1101,10 +1101,10 @@ WASM_SIMD_TEST(F64x2ReplaceLane) {
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_F64x2_SPLAT(WASM_F64(1e100))),
// Replace lane 0.
WASM_SET_GLOBAL(0, WASM_SIMD_F64x2_REPLACE_LANE(
WASM_GLOBAL_SET(0, WASM_SIMD_F64x2_REPLACE_LANE(
0, WASM_LOCAL_GET(temp1), WASM_F64(0.0f))),
// Replace lane 1.
WASM_SET_GLOBAL(1, WASM_SIMD_F64x2_REPLACE_LANE(
WASM_GLOBAL_SET(1, WASM_SIMD_F64x2_REPLACE_LANE(
1, WASM_LOCAL_GET(temp1), WASM_F64(1.0f))),
WASM_ONE);
......@@ -1218,7 +1218,7 @@ void RunF64x2UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_GLOBAL_SET(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_ONE);
FOR_FLOAT64_INPUTS(x) {
......@@ -1293,7 +1293,7 @@ void RunF64x2BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte temp2 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(value1))),
WASM_LOCAL_SET(temp2, WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(value2))),
WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_GLOBAL_SET(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp2))),
WASM_ONE);
......@@ -1370,7 +1370,7 @@ void RunF64x2CompareOpTest(TestExecutionTier execution_tier,
WASM_SIMD_F64x2_REPLACE_LANE(1, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(value2))),
WASM_LOCAL_SET(temp2, WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(value2))),
WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_GLOBAL_SET(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp2))),
WASM_ONE);
......@@ -1435,7 +1435,7 @@ WASM_SIMD_TEST_NO_LOWERING(F64x2Qfma) {
// Build fn to splat test values, perform compare op, and write the result.
byte value1 = 0, value2 = 1, value3 = 2;
BUILD(r,
WASM_SET_GLOBAL(0, WASM_SIMD_F64x2_QFMA(
WASM_GLOBAL_SET(0, WASM_SIMD_F64x2_QFMA(
WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(value1)),
WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(value2)),
WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(value3)))),
......@@ -1460,7 +1460,7 @@ WASM_SIMD_TEST_NO_LOWERING(F64x2Qfms) {
// Build fn to splat test values, perform compare op, and write the result.
byte value1 = 0, value2 = 1, value3 = 2;
BUILD(r,
WASM_SET_GLOBAL(0, WASM_SIMD_F64x2_QFMS(
WASM_GLOBAL_SET(0, WASM_SIMD_F64x2_QFMS(
WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(value1)),
WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(value2)),
WASM_SIMD_F64x2_SPLAT(WASM_LOCAL_GET(value3)))),
......@@ -1483,7 +1483,7 @@ WASM_SIMD_TEST(I32x4Splat) {
// Set up a global to hold output vector.
int32_t* g = r.builder().AddGlobal<int32_t>(kWasmS128);
byte param1 = 0;
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(param1))),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(param1))),
WASM_ONE);
FOR_INT32_INPUTS(x) {
......@@ -1509,7 +1509,7 @@ WASM_SIMD_TEST(I32x4ReplaceLane) {
1, WASM_LOCAL_GET(temp1), WASM_I32V(1))),
WASM_LOCAL_SET(temp1, WASM_SIMD_I32x4_REPLACE_LANE(
2, WASM_LOCAL_GET(temp1), WASM_I32V(2))),
WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE(
WASM_GLOBAL_SET(0, WASM_SIMD_I32x4_REPLACE_LANE(
3, WASM_LOCAL_GET(temp1), WASM_I32V(3))),
WASM_ONE);
......@@ -1524,7 +1524,7 @@ WASM_SIMD_TEST(I16x8Splat) {
// Set up a global to hold output vector.
int16_t* g = r.builder().AddGlobal<int16_t>(kWasmS128);
byte param1 = 0;
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(param1))),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(param1))),
WASM_ONE);
FOR_INT16_INPUTS(x) {
......@@ -1568,7 +1568,7 @@ WASM_SIMD_TEST(I16x8ReplaceLane) {
5, WASM_LOCAL_GET(temp1), WASM_I32V(5))),
WASM_LOCAL_SET(temp1, WASM_SIMD_I16x8_REPLACE_LANE(
6, WASM_LOCAL_GET(temp1), WASM_I32V(6))),
WASM_SET_GLOBAL(0, WASM_SIMD_I16x8_REPLACE_LANE(
WASM_GLOBAL_SET(0, WASM_SIMD_I16x8_REPLACE_LANE(
7, WASM_LOCAL_GET(temp1), WASM_I32V(7))),
WASM_ONE);
......@@ -1663,7 +1663,7 @@ WASM_SIMD_TEST(I8x16Splat) {
// Set up a global to hold output vector.
int8_t* g = r.builder().AddGlobal<int8_t>(kWasmS128);
byte param1 = 0;
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(param1))),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(param1))),
WASM_ONE);
FOR_INT8_INPUTS(x) {
......@@ -1723,7 +1723,7 @@ WASM_SIMD_TEST(I8x16ReplaceLane) {
13, WASM_LOCAL_GET(temp1), WASM_I32V(13))),
WASM_LOCAL_SET(temp1, WASM_SIMD_I8x16_REPLACE_LANE(
14, WASM_LOCAL_GET(temp1), WASM_I32V(14))),
WASM_SET_GLOBAL(0, WASM_SIMD_I8x16_REPLACE_LANE(
WASM_GLOBAL_SET(0, WASM_SIMD_I8x16_REPLACE_LANE(
15, WASM_LOCAL_GET(temp1), WASM_I32V(15))),
WASM_ONE);
......@@ -1757,9 +1757,9 @@ WASM_SIMD_TEST(I32x4ConvertF32x4) {
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_F32x4_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
0, WASM_SIMD_UNOP(kExprI32x4SConvertF32x4, WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
1, WASM_SIMD_UNOP(kExprI32x4UConvertF32x4, WASM_LOCAL_GET(temp1))),
WASM_ONE);
......@@ -1787,13 +1787,13 @@ WASM_SIMD_TEST(I32x4ConvertI16x8) {
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_UNOP(kExprI32x4SConvertI16x8High,
WASM_GLOBAL_SET(0, WASM_SIMD_UNOP(kExprI32x4SConvertI16x8High,
WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(1, WASM_SIMD_UNOP(kExprI32x4SConvertI16x8Low,
WASM_GLOBAL_SET(1, WASM_SIMD_UNOP(kExprI32x4SConvertI16x8Low,
WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(2, WASM_SIMD_UNOP(kExprI32x4UConvertI16x8High,
WASM_GLOBAL_SET(2, WASM_SIMD_UNOP(kExprI32x4UConvertI16x8High,
WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(3, WASM_SIMD_UNOP(kExprI32x4UConvertI16x8Low,
WASM_GLOBAL_SET(3, WASM_SIMD_UNOP(kExprI32x4UConvertI16x8Low,
WASM_LOCAL_GET(temp1))),
WASM_ONE);
......@@ -1825,13 +1825,13 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2ConvertI32x4) {
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_UNOP(kExprI64x2SConvertI32x4High,
WASM_GLOBAL_SET(0, WASM_SIMD_UNOP(kExprI64x2SConvertI32x4High,
WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(1, WASM_SIMD_UNOP(kExprI64x2SConvertI32x4Low,
WASM_GLOBAL_SET(1, WASM_SIMD_UNOP(kExprI64x2SConvertI32x4Low,
WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(2, WASM_SIMD_UNOP(kExprI64x2UConvertI32x4High,
WASM_GLOBAL_SET(2, WASM_SIMD_UNOP(kExprI64x2UConvertI32x4High,
WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(3, WASM_SIMD_UNOP(kExprI64x2UConvertI32x4Low,
WASM_GLOBAL_SET(3, WASM_SIMD_UNOP(kExprI64x2UConvertI32x4Low,
WASM_LOCAL_GET(temp1))),
WASM_ONE);
......@@ -1858,7 +1858,7 @@ void RunI32x4UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_GLOBAL_SET(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_ONE);
FOR_INT32_INPUTS(x) {
......@@ -1948,7 +1948,7 @@ void RunI32x4BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte temp2 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(value1))),
WASM_LOCAL_SET(temp2, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(value2))),
WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_GLOBAL_SET(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp2))),
WASM_ONE);
......@@ -2072,9 +2072,9 @@ void RunI32x4ShiftOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
// Shift using an immediate, and shift using a value loaded from memory.
BUILD(
r, WASM_LOCAL_SET(simd, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_LOCAL_GET(simd),
WASM_GLOBAL_SET(0, WASM_SIMD_SHIFT_OP(opcode, WASM_LOCAL_GET(simd),
WASM_I32V(shift))),
WASM_SET_GLOBAL(1, WASM_SIMD_SHIFT_OP(
WASM_GLOBAL_SET(1, WASM_SIMD_SHIFT_OP(
opcode, WASM_LOCAL_GET(simd),
WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))),
WASM_ONE);
......@@ -2118,13 +2118,13 @@ WASM_SIMD_TEST(I16x8ConvertI8x16) {
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_UNOP(kExprI16x8SConvertI8x16High,
WASM_GLOBAL_SET(0, WASM_SIMD_UNOP(kExprI16x8SConvertI8x16High,
WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(1, WASM_SIMD_UNOP(kExprI16x8SConvertI8x16Low,
WASM_GLOBAL_SET(1, WASM_SIMD_UNOP(kExprI16x8SConvertI8x16Low,
WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(2, WASM_SIMD_UNOP(kExprI16x8UConvertI8x16High,
WASM_GLOBAL_SET(2, WASM_SIMD_UNOP(kExprI16x8UConvertI8x16High,
WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(3, WASM_SIMD_UNOP(kExprI16x8UConvertI8x16Low,
WASM_GLOBAL_SET(3, WASM_SIMD_UNOP(kExprI16x8UConvertI8x16Low,
WASM_LOCAL_GET(temp1))),
WASM_ONE);
......@@ -2151,10 +2151,10 @@ WASM_SIMD_TEST(I16x8ConvertI32x4) {
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I32x4_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
0, WASM_SIMD_BINOP(kExprI16x8SConvertI32x4, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
1, WASM_SIMD_BINOP(kExprI16x8UConvertI32x4, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp1))),
WASM_ONE);
......@@ -2179,7 +2179,7 @@ void RunI16x8UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_GLOBAL_SET(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_ONE);
FOR_INT16_INPUTS(x) {
......@@ -2212,7 +2212,7 @@ void RunI16x8BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte temp2 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(value1))),
WASM_LOCAL_SET(temp2, WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(value2))),
WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_GLOBAL_SET(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp2))),
WASM_ONE);
......@@ -2353,7 +2353,7 @@ void RunExtMulTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
T* g = r.builder().template AddGlobal<T>(kWasmS128);
BUILD(r,
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
0, WASM_SIMD_BINOP(
opcode,
WASM_SIMD_I64x2_REPLACE_LANE(
......@@ -2455,7 +2455,7 @@ WASM_SIMD_TEST(I32x4DotI16x8S) {
byte temp2 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(value1))),
WASM_LOCAL_SET(temp2, WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(value2))),
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
0, WASM_SIMD_BINOP(kExprI32x4DotI16x8S, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp2))),
WASM_ONE);
......@@ -2485,9 +2485,9 @@ void RunI16x8ShiftOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
// Shift using an immediate, and shift using a value loaded from memory.
BUILD(
r, WASM_LOCAL_SET(simd, WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_LOCAL_GET(simd),
WASM_GLOBAL_SET(0, WASM_SIMD_SHIFT_OP(opcode, WASM_LOCAL_GET(simd),
WASM_I32V(shift))),
WASM_SET_GLOBAL(1, WASM_SIMD_SHIFT_OP(
WASM_GLOBAL_SET(1, WASM_SIMD_SHIFT_OP(
opcode, WASM_LOCAL_GET(simd),
WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))),
WASM_ONE);
......@@ -2528,7 +2528,7 @@ void RunI8x16UnOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_GLOBAL_SET(0, WASM_SIMD_UNOP(opcode, WASM_LOCAL_GET(temp1))),
WASM_ONE);
FOR_INT8_INPUTS(x) {
......@@ -2560,7 +2560,7 @@ WASM_SIMD_TEST_NO_LOWERING(I8x16Popcnt) {
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
0, WASM_SIMD_UNOP(kExprI8x16Popcnt, WASM_LOCAL_GET(temp1))),
WASM_ONE);
......@@ -2584,10 +2584,10 @@ WASM_SIMD_TEST(I8x16ConvertI16x8) {
byte value = 0;
byte temp1 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I16x8_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
0, WASM_SIMD_BINOP(kExprI8x16SConvertI16x8, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp1))),
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
1, WASM_SIMD_BINOP(kExprI8x16UConvertI16x8, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp1))),
WASM_ONE);
......@@ -2615,7 +2615,7 @@ void RunI8x16BinOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
byte temp2 = r.AllocateLocal(kWasmS128);
BUILD(r, WASM_LOCAL_SET(temp1, WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(value1))),
WASM_LOCAL_SET(temp2, WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(value2))),
WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_GLOBAL_SET(0, WASM_SIMD_BINOP(opcode, WASM_LOCAL_GET(temp1),
WASM_LOCAL_GET(temp2))),
WASM_ONE);
......@@ -2745,9 +2745,9 @@ void RunI8x16ShiftOpTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
// Shift using an immediate, and shift using a value loaded from memory.
BUILD(
r, WASM_LOCAL_SET(simd, WASM_SIMD_I8x16_SPLAT(WASM_LOCAL_GET(value))),
WASM_SET_GLOBAL(0, WASM_SIMD_SHIFT_OP(opcode, WASM_LOCAL_GET(simd),
WASM_GLOBAL_SET(0, WASM_SIMD_SHIFT_OP(opcode, WASM_LOCAL_GET(simd),
WASM_I32V(shift))),
WASM_SET_GLOBAL(1, WASM_SIMD_SHIFT_OP(
WASM_GLOBAL_SET(1, WASM_SIMD_SHIFT_OP(
opcode, WASM_LOCAL_GET(simd),
WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))),
WASM_ONE);
......@@ -2873,14 +2873,14 @@ void RunBinaryLaneOpTest(
}
if (simd_op == kExprI8x16Shuffle) {
BUILD(r,
WASM_SET_GLOBAL(0, WASM_SIMD_I8x16_SHUFFLE_OP(simd_op, expected,
WASM_GET_GLOBAL(0),
WASM_GET_GLOBAL(1))),
WASM_GLOBAL_SET(0, WASM_SIMD_I8x16_SHUFFLE_OP(simd_op, expected,
WASM_GLOBAL_GET(0),
WASM_GLOBAL_GET(1))),
WASM_ONE);
} else {
BUILD(r,
WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(simd_op, WASM_GET_GLOBAL(0),
WASM_GET_GLOBAL(1))),
WASM_GLOBAL_SET(0, WASM_SIMD_BINOP(simd_op, WASM_GLOBAL_GET(0),
WASM_GLOBAL_GET(1))),
WASM_ONE);
}
......@@ -3118,8 +3118,8 @@ WASM_SIMD_TEST(I8x16Swizzle) {
uint8_t* src1 = r.builder().AddGlobal<uint8_t>(kWasmS128);
BUILD(
r,
WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(kExprI8x16Swizzle, WASM_GET_GLOBAL(1),
WASM_GET_GLOBAL(2))),
WASM_GLOBAL_SET(0, WASM_SIMD_BINOP(kExprI8x16Swizzle, WASM_GLOBAL_GET(1),
WASM_GLOBAL_GET(2))),
WASM_ONE);
for (SwizzleTestArgs si : swizzle_test_vector) {
......@@ -3174,7 +3174,7 @@ void BuildShuffle(const std::vector<Shuffle>& shuffles,
// Perform the leaf shuffles on globals 0 and 1.
size_t row_index = (shuffles.size() - 1) / 2;
for (size_t i = row_index; i < shuffles.size(); ++i) {
byte operands[] = {WASM_GET_GLOBAL(0), WASM_GET_GLOBAL(1)};
byte operands[] = {WASM_GLOBAL_GET(0), WASM_GLOBAL_GET(1)};
for (size_t j = 0; j < arraysize(operands); ++j)
buffer->push_back(operands[j]);
AppendShuffle(shuffles[i], buffer);
......@@ -3496,16 +3496,16 @@ WASM_SIMD_TEST(SimdI32x4GetGlobal) {
BUILD(
r, WASM_LOCAL_SET(1, WASM_I32V(1)),
WASM_IF(WASM_I32_NE(WASM_I32V(0),
WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GET_GLOBAL(4))),
WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GLOBAL_GET(4))),
WASM_LOCAL_SET(1, WASM_I32V(0))),
WASM_IF(WASM_I32_NE(WASM_I32V(1),
WASM_SIMD_I32x4_EXTRACT_LANE(1, WASM_GET_GLOBAL(4))),
WASM_SIMD_I32x4_EXTRACT_LANE(1, WASM_GLOBAL_GET(4))),
WASM_LOCAL_SET(1, WASM_I32V(0))),
WASM_IF(WASM_I32_NE(WASM_I32V(2),
WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GET_GLOBAL(4))),
WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GLOBAL_GET(4))),
WASM_LOCAL_SET(1, WASM_I32V(0))),
WASM_IF(WASM_I32_NE(WASM_I32V(3),
WASM_SIMD_I32x4_EXTRACT_LANE(3, WASM_GET_GLOBAL(4))),
WASM_SIMD_I32x4_EXTRACT_LANE(3, WASM_GLOBAL_GET(4))),
WASM_LOCAL_SET(1, WASM_I32V(0))),
WASM_LOCAL_GET(1));
CHECK_EQ(1, r.Call(0));
......@@ -3519,12 +3519,12 @@ WASM_SIMD_TEST(SimdI32x4SetGlobal) {
r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused
r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused
int32_t* global = r.builder().AddGlobal<int32_t>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(4, WASM_SIMD_I32x4_SPLAT(WASM_I32V(23))),
WASM_SET_GLOBAL(4, WASM_SIMD_I32x4_REPLACE_LANE(1, WASM_GET_GLOBAL(4),
BUILD(r, WASM_GLOBAL_SET(4, WASM_SIMD_I32x4_SPLAT(WASM_I32V(23))),
WASM_GLOBAL_SET(4, WASM_SIMD_I32x4_REPLACE_LANE(1, WASM_GLOBAL_GET(4),
WASM_I32V(34))),
WASM_SET_GLOBAL(4, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_GLOBAL(4),
WASM_GLOBAL_SET(4, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GLOBAL_GET(4),
WASM_I32V(45))),
WASM_SET_GLOBAL(4, WASM_SIMD_I32x4_REPLACE_LANE(3, WASM_GET_GLOBAL(4),
WASM_GLOBAL_SET(4, WASM_SIMD_I32x4_REPLACE_LANE(3, WASM_GLOBAL_GET(4),
WASM_I32V(56))),
WASM_I32V(1));
CHECK_EQ(1, r.Call(0));
......@@ -3542,16 +3542,16 @@ WASM_SIMD_TEST(SimdF32x4GetGlobal) {
BUILD(
r, WASM_LOCAL_SET(1, WASM_I32V(1)),
WASM_IF(WASM_F32_NE(WASM_F32(0.0),
WASM_SIMD_F32x4_EXTRACT_LANE(0, WASM_GET_GLOBAL(0))),
WASM_SIMD_F32x4_EXTRACT_LANE(0, WASM_GLOBAL_GET(0))),
WASM_LOCAL_SET(1, WASM_I32V(0))),
WASM_IF(WASM_F32_NE(WASM_F32(1.5),
WASM_SIMD_F32x4_EXTRACT_LANE(1, WASM_GET_GLOBAL(0))),
WASM_SIMD_F32x4_EXTRACT_LANE(1, WASM_GLOBAL_GET(0))),
WASM_LOCAL_SET(1, WASM_I32V(0))),
WASM_IF(WASM_F32_NE(WASM_F32(2.25),
WASM_SIMD_F32x4_EXTRACT_LANE(2, WASM_GET_GLOBAL(0))),
WASM_SIMD_F32x4_EXTRACT_LANE(2, WASM_GLOBAL_GET(0))),
WASM_LOCAL_SET(1, WASM_I32V(0))),
WASM_IF(WASM_F32_NE(WASM_F32(3.5),
WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_GLOBAL(0))),
WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GLOBAL_GET(0))),
WASM_LOCAL_SET(1, WASM_I32V(0))),
WASM_LOCAL_GET(1));
CHECK_EQ(1, r.Call(0));
......@@ -3560,12 +3560,12 @@ WASM_SIMD_TEST(SimdF32x4GetGlobal) {
WASM_SIMD_TEST(SimdF32x4SetGlobal) {
WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
float* global = r.builder().AddGlobal<float>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_SPLAT(WASM_F32(13.5))),
WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(1, WASM_GET_GLOBAL(0),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_F32x4_SPLAT(WASM_F32(13.5))),
WASM_GLOBAL_SET(0, WASM_SIMD_F32x4_REPLACE_LANE(1, WASM_GLOBAL_GET(0),
WASM_F32(45.5))),
WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(2, WASM_GET_GLOBAL(0),
WASM_GLOBAL_SET(0, WASM_SIMD_F32x4_REPLACE_LANE(2, WASM_GLOBAL_GET(0),
WASM_F32(32.25))),
WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GET_GLOBAL(0),
WASM_GLOBAL_SET(0, WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GLOBAL_GET(0),
WASM_F32(65.0))),
WASM_I32V(1));
CHECK_EQ(1, r.Call(0));
......@@ -3730,7 +3730,7 @@ WASM_SIMD_TEST(S128Load8SplatOffset) {
int8_t* memory = r.builder().AddMemoryElems<int8_t>(kWasmPageSize);
int8_t* global = r.builder().AddGlobal<int8_t>(kWasmS128);
BUILD(r,
WASM_SET_GLOBAL(
WASM_GLOBAL_SET(
0, WASM_SIMD_LOAD_OP_OFFSET(kExprS128Load8Splat, WASM_I32V(0),
U32V_2(offset))),
WASM_ONE);
......@@ -3752,7 +3752,7 @@ void RunLoadSplatTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmRunner<int32_t> r(execution_tier, lower_simd);
T* memory = r.builder().AddMemoryElems<T>(kWasmPageSize / sizeof(T));
T* global = r.builder().AddGlobal<T>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_LOAD_OP(op, WASM_I32V(mem_index))),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_LOAD_OP(op, WASM_I32V(mem_index))),
WASM_ONE);
for (T x : compiler::ValueHelper::GetVector<T>()) {
......@@ -3770,7 +3770,7 @@ void RunLoadSplatTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
r.builder().AddMemoryElems<T>(kWasmPageSize / sizeof(T));
r.builder().AddGlobal<T>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_LOAD_OP(op, WASM_LOCAL_GET(0))),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_LOAD_OP(op, WASM_LOCAL_GET(0))),
WASM_ONE);
// Load splats load sizeof(T) bytes.
......@@ -3811,7 +3811,7 @@ void RunLoadExtendTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
S* memory = r.builder().AddMemoryElems<S>(kWasmPageSize / sizeof(S));
T* global = r.builder().AddGlobal<T>(kWasmS128);
BUILD(r,
WASM_SET_GLOBAL(0, WASM_SIMD_LOAD_OP_ALIGNMENT(
WASM_GLOBAL_SET(0, WASM_SIMD_LOAD_OP_ALIGNMENT(
op, WASM_I32V(mem_index), alignment)),
WASM_ONE);
......@@ -3834,7 +3834,7 @@ void RunLoadExtendTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
T* global = r.builder().AddGlobal<T>(kWasmS128);
constexpr byte offset = sizeof(S);
BUILD(r,
WASM_SET_GLOBAL(0, WASM_SIMD_LOAD_OP_OFFSET(op, WASM_ZERO, offset)),
WASM_GLOBAL_SET(0, WASM_SIMD_LOAD_OP_OFFSET(op, WASM_ZERO, offset)),
WASM_ONE);
// Let max_s be the max_s value for type S, we set up the memory as such:
......@@ -3861,7 +3861,7 @@ void RunLoadExtendTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
r.builder().AddMemoryElems<S>(kWasmPageSize / sizeof(S));
r.builder().AddGlobal<T>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_LOAD_OP(op, WASM_LOCAL_GET(0))),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_LOAD_OP(op, WASM_LOCAL_GET(0))),
WASM_ONE);
// Load extends load 8 bytes, so should trap from -7.
......@@ -3924,7 +3924,7 @@ void RunLoadZeroTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmRunner<int32_t> r(execution_tier, lower_simd);
std::tie(memory, global) = initialize_builder(&r);
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_LOAD_OP(op, WASM_I32V(mem_index))),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_LOAD_OP(op, WASM_I32V(mem_index))),
WASM_ONE);
r.Call();
......@@ -3943,7 +3943,7 @@ void RunLoadZeroTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
BUILD(
r,
WASM_SET_GLOBAL(0, WASM_SIMD_LOAD_OP_OFFSET(op, WASM_ZERO, mem_index)),
WASM_GLOBAL_SET(0, WASM_SIMD_LOAD_OP_OFFSET(op, WASM_ZERO, mem_index)),
WASM_ONE);
r.Call();
......@@ -3961,7 +3961,7 @@ void RunLoadZeroTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
r.builder().AddMemoryElems<S>(kWasmPageSize / sizeof(S));
r.builder().AddGlobal<S>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_LOAD_OP(op, WASM_LOCAL_GET(0))),
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_LOAD_OP(op, WASM_LOCAL_GET(0))),
WASM_ONE);
// Load extends load sizeof(S) bytes.
......@@ -4255,7 +4255,7 @@ void RunSimdConstTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
WasmRunner<uint32_t> r(execution_tier, lower_simd);
byte temp1 = r.AllocateLocal(kWasmS128);
uint8_t* src0 = r.builder().AddGlobal<uint8_t>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(temp1, WASM_SIMD_CONSTANT(expected)), WASM_ONE);
BUILD(r, WASM_GLOBAL_SET(temp1, WASM_SIMD_CONSTANT(expected)), WASM_ONE);
CHECK_EQ(1, r.Call());
for (size_t i = 0; i < expected.size(); i++) {
CHECK_EQ(ReadLittleEndianValue<uint8_t>(&src0[i]), expected[i]);
......
......@@ -735,7 +735,7 @@ WASM_EXEC_TEST(Select_s128_parameters) {
WriteLittleEndianValue<int32_t>(&g1[i], i + 4);
}
BUILD(r,
WASM_SET_GLOBAL(2, WASM_SELECT(WASM_GET_GLOBAL(0), WASM_GET_GLOBAL(1),
WASM_GLOBAL_SET(2, WASM_SELECT(WASM_GLOBAL_GET(0), WASM_GLOBAL_GET(1),
WASM_LOCAL_GET(0))),
WASM_ONE);
r.Call(1);
......@@ -2120,7 +2120,7 @@ WASM_EXEC_TEST(Int32Global) {
int32_t* global = r.builder().AddGlobal<int32_t>();
// global = global + p0
BUILD(r,
WASM_SET_GLOBAL(0, WASM_I32_ADD(WASM_GET_GLOBAL(0), WASM_LOCAL_GET(0))),
WASM_GLOBAL_SET(0, WASM_I32_ADD(WASM_GLOBAL_GET(0), WASM_LOCAL_GET(0))),
WASM_ZERO);
WriteLittleEndianValue<int32_t>(global, 116);
......@@ -2142,8 +2142,8 @@ WASM_EXEC_TEST(Int32Globals_DontAlias) {
BUILD(
r,
WASM_SET_GLOBAL(g, WASM_I32_ADD(WASM_GET_GLOBAL(g), WASM_LOCAL_GET(0))),
WASM_GET_GLOBAL(g));
WASM_GLOBAL_SET(g, WASM_I32_ADD(WASM_GLOBAL_GET(g), WASM_LOCAL_GET(0))),
WASM_GLOBAL_GET(g));
// Check that reading/writing global number {g} doesn't alter the others.
WriteLittleEndianValue<int32_t>(globals[g], 116 * g);
......@@ -2167,8 +2167,8 @@ WASM_EXEC_TEST(Float32Global) {
float* global = r.builder().AddGlobal<float>();
// global = global + p0
BUILD(r,
WASM_SET_GLOBAL(0,
WASM_F32_ADD(WASM_GET_GLOBAL(0),
WASM_GLOBAL_SET(0,
WASM_F32_ADD(WASM_GLOBAL_GET(0),
WASM_F32_SCONVERT_I32(WASM_LOCAL_GET(0)))),
WASM_ZERO);
......@@ -2185,8 +2185,8 @@ WASM_EXEC_TEST(Float64Global) {
double* global = r.builder().AddGlobal<double>();
// global = global + p0
BUILD(r,
WASM_SET_GLOBAL(0,
WASM_F64_ADD(WASM_GET_GLOBAL(0),
WASM_GLOBAL_SET(0,
WASM_F64_ADD(WASM_GLOBAL_GET(0),
WASM_F64_SCONVERT_I32(WASM_LOCAL_GET(0)))),
WASM_ZERO);
......@@ -2209,10 +2209,10 @@ WASM_EXEC_TEST(MixedGlobals) {
float* var_float = r.builder().AddGlobal<float>();
double* var_double = r.builder().AddGlobal<double>();
BUILD(r, WASM_SET_GLOBAL(1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)),
WASM_SET_GLOBAL(2, WASM_LOAD_MEM(MachineType::Uint32(), WASM_ZERO)),
WASM_SET_GLOBAL(3, WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)),
WASM_SET_GLOBAL(4, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)),
BUILD(r, WASM_GLOBAL_SET(1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)),
WASM_GLOBAL_SET(2, WASM_LOAD_MEM(MachineType::Uint32(), WASM_ZERO)),
WASM_GLOBAL_SET(3, WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)),
WASM_GLOBAL_SET(4, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)),
WASM_ZERO);
memory[0] = 0xAA;
......
......@@ -475,8 +475,8 @@ WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_Globals) {
runner.builder().AddGlobal<int32_t>();
TestCode<void> code(&runner,
{WASM_SET_GLOBAL(0, WASM_I32V_1('4')),
WASM_SET_GLOBAL(1, WASM_I32V_1('5')), WASM_RETURN0},
{WASM_GLOBAL_SET(0, WASM_I32V_1('4')),
WASM_GLOBAL_SET(1, WASM_I32V_1('5')), WASM_RETURN0},
{});
code.BreakOnReturn(&runner);
......@@ -529,7 +529,7 @@ WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_JavaScript) {
TestCode<int64_t> code(
&runner,
{WASM_SET_GLOBAL(0, WASM_I32V_2('B')),
{WASM_GLOBAL_SET(0, WASM_I32V_2('B')),
WASM_LOCAL_SET(0, WASM_I64V_2('A')), WASM_RETURN1(WASM_LOCAL_GET(0))},
{ValueType::kI64});
code.BreakOnReturn(&runner);
......@@ -578,7 +578,7 @@ WASM_COMPILED_EXEC_TEST(WasmDebugEvaluate_JavaScript_Caching) {
TestCode<int32_t> code(
&runner,
{WASM_SET_GLOBAL(0, WASM_I32V_2('B')), WASM_RETURN1(WASM_GET_GLOBAL(0))},
{WASM_GLOBAL_SET(0, WASM_I32V_2('B')), WASM_RETURN1(WASM_GLOBAL_GET(0))},
{});
code.BreakOnReturn(&runner);
......
......@@ -433,8 +433,8 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
#define WASM_LOCAL_SET(index, val) val, kExprLocalSet, static_cast<byte>(index)
#define WASM_LOCAL_TEE(index, val) val, kExprLocalTee, static_cast<byte>(index)
#define WASM_DROP kExprDrop
#define WASM_GET_GLOBAL(index) kExprGlobalGet, static_cast<byte>(index)
#define WASM_SET_GLOBAL(index, val) \
#define WASM_GLOBAL_GET(index) kExprGlobalGet, static_cast<byte>(index)
#define WASM_GLOBAL_SET(index, val) \
val, kExprGlobalSet, static_cast<byte>(index)
#define WASM_TABLE_GET(table_index, index) \
index, kExprTableGet, static_cast<byte>(table_index)
......
......@@ -1990,9 +1990,9 @@ TEST_F(FunctionBodyDecoderTest, Int32Globals) {
builder.AddGlobal(kWasmI32);
ExpectValidates(sig, {WASM_GET_GLOBAL(0)});
ExpectFailure(sig, {WASM_SET_GLOBAL(0, WASM_LOCAL_GET(0))});
ExpectValidates(sig, {WASM_SET_GLOBAL(0, WASM_LOCAL_GET(0)), WASM_ZERO});
ExpectValidates(sig, {WASM_GLOBAL_GET(0)});
ExpectFailure(sig, {WASM_GLOBAL_SET(0, WASM_LOCAL_GET(0))});
ExpectValidates(sig, {WASM_GLOBAL_SET(0, WASM_LOCAL_GET(0)), WASM_ZERO});
}
TEST_F(FunctionBodyDecoderTest, ImmutableGlobal) {
......@@ -2001,8 +2001,8 @@ TEST_F(FunctionBodyDecoderTest, ImmutableGlobal) {
uint32_t g0 = builder.AddGlobal(kWasmI32, true);
uint32_t g1 = builder.AddGlobal(kWasmI32, false);
ExpectValidates(sig, {WASM_SET_GLOBAL(g0, WASM_ZERO)});
ExpectFailure(sig, {WASM_SET_GLOBAL(g1, WASM_ZERO)});
ExpectValidates(sig, {WASM_GLOBAL_SET(g0, WASM_ZERO)});
ExpectFailure(sig, {WASM_GLOBAL_SET(g1, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, Int32Globals_fail) {
......@@ -2013,15 +2013,15 @@ TEST_F(FunctionBodyDecoderTest, Int32Globals_fail) {
builder.AddGlobal(kWasmF32);
builder.AddGlobal(kWasmF64);
ExpectFailure(sig, {WASM_GET_GLOBAL(0)});
ExpectFailure(sig, {WASM_GET_GLOBAL(1)});
ExpectFailure(sig, {WASM_GET_GLOBAL(2)});
ExpectFailure(sig, {WASM_GET_GLOBAL(3)});
ExpectFailure(sig, {WASM_GLOBAL_GET(0)});
ExpectFailure(sig, {WASM_GLOBAL_GET(1)});
ExpectFailure(sig, {WASM_GLOBAL_GET(2)});
ExpectFailure(sig, {WASM_GLOBAL_GET(3)});
ExpectFailure(sig, {WASM_SET_GLOBAL(0, WASM_LOCAL_GET(0)), WASM_ZERO});
ExpectFailure(sig, {WASM_SET_GLOBAL(1, WASM_LOCAL_GET(0)), WASM_ZERO});
ExpectFailure(sig, {WASM_SET_GLOBAL(2, WASM_LOCAL_GET(0)), WASM_ZERO});
ExpectFailure(sig, {WASM_SET_GLOBAL(3, WASM_LOCAL_GET(0)), WASM_ZERO});
ExpectFailure(sig, {WASM_GLOBAL_SET(0, WASM_LOCAL_GET(0)), WASM_ZERO});
ExpectFailure(sig, {WASM_GLOBAL_SET(1, WASM_LOCAL_GET(0)), WASM_ZERO});
ExpectFailure(sig, {WASM_GLOBAL_SET(2, WASM_LOCAL_GET(0)), WASM_ZERO});
ExpectFailure(sig, {WASM_GLOBAL_SET(3, WASM_LOCAL_GET(0)), WASM_ZERO});
}
TEST_F(FunctionBodyDecoderTest, Int64Globals) {
......@@ -2030,13 +2030,13 @@ TEST_F(FunctionBodyDecoderTest, Int64Globals) {
builder.AddGlobal(kWasmI64);
builder.AddGlobal(kWasmI64);
ExpectValidates(sig, {WASM_GET_GLOBAL(0)});
ExpectValidates(sig, {WASM_GET_GLOBAL(1)});
ExpectValidates(sig, {WASM_GLOBAL_GET(0)});
ExpectValidates(sig, {WASM_GLOBAL_GET(1)});
ExpectValidates(sig,
{WASM_SET_GLOBAL(0, WASM_LOCAL_GET(0)), WASM_LOCAL_GET(0)});
{WASM_GLOBAL_SET(0, WASM_LOCAL_GET(0)), WASM_LOCAL_GET(0)});
ExpectValidates(sig,
{WASM_SET_GLOBAL(1, WASM_LOCAL_GET(0)), WASM_LOCAL_GET(0)});
{WASM_GLOBAL_SET(1, WASM_LOCAL_GET(0)), WASM_LOCAL_GET(0)});
}
TEST_F(FunctionBodyDecoderTest, Float32Globals) {
......@@ -2044,9 +2044,9 @@ TEST_F(FunctionBodyDecoderTest, Float32Globals) {
builder.AddGlobal(kWasmF32);
ExpectValidates(sig, {WASM_GET_GLOBAL(0)});
ExpectValidates(sig, {WASM_GLOBAL_GET(0)});
ExpectValidates(sig,
{WASM_SET_GLOBAL(0, WASM_LOCAL_GET(0)), WASM_LOCAL_GET(0)});
{WASM_GLOBAL_SET(0, WASM_LOCAL_GET(0)), WASM_LOCAL_GET(0)});
}
TEST_F(FunctionBodyDecoderTest, Float64Globals) {
......@@ -2054,9 +2054,9 @@ TEST_F(FunctionBodyDecoderTest, Float64Globals) {
builder.AddGlobal(kWasmF64);
ExpectValidates(sig, {WASM_GET_GLOBAL(0)});
ExpectValidates(sig, {WASM_GLOBAL_GET(0)});
ExpectValidates(sig,
{WASM_SET_GLOBAL(0, WASM_LOCAL_GET(0)), WASM_LOCAL_GET(0)});
{WASM_GLOBAL_SET(0, WASM_LOCAL_GET(0)), WASM_LOCAL_GET(0)});
}
TEST_F(FunctionBodyDecoderTest, AllGetGlobalCombinations) {
......@@ -2069,7 +2069,7 @@ TEST_F(FunctionBodyDecoderTest, AllGetGlobalCombinations) {
module = builder.module();
builder.AddGlobal(global_type);
Validate(IsSubtypeOf(global_type, local_type, module), &sig,
{WASM_GET_GLOBAL(0)});
{WASM_GLOBAL_GET(0)});
}
}
}
......@@ -2084,7 +2084,7 @@ TEST_F(FunctionBodyDecoderTest, AllSetGlobalCombinations) {
module = builder.module();
builder.AddGlobal(global_type);
Validate(IsSubtypeOf(local_type, global_type, module), &sig,
{WASM_SET_GLOBAL(0, WASM_LOCAL_GET(0))});
{WASM_GLOBAL_SET(0, WASM_LOCAL_GET(0))});
}
}
}
......
......@@ -32,7 +32,7 @@ namespace module_decoder_unittest {
#define WASM_INIT_EXPR_EXTERN_REF_NULL WASM_REF_NULL(kExternRefCode), kExprEnd
#define WASM_INIT_EXPR_FUNC_REF_NULL WASM_REF_NULL(kFuncRefCode), kExprEnd
#define WASM_INIT_EXPR_REF_FUNC(val) WASM_REF_FUNC(val), kExprEnd
#define WASM_INIT_EXPR_GLOBAL(index) WASM_GET_GLOBAL(index), kExprEnd
#define WASM_INIT_EXPR_GLOBAL(index) WASM_GLOBAL_GET(index), kExprEnd
#define REF_NULL_ELEMENT kExprRefNull, kFuncRefCode, kExprEnd
#define REF_FUNC_ELEMENT(v) kExprRefFunc, U32V_1(v), kExprEnd
......@@ -540,7 +540,7 @@ TEST_F(WasmModuleVerifyTest, GlobalInitializer) {
SECTION(Global, ENTRY_COUNT(1), // --
kI32Code, // type
1, // mutable
WASM_GET_GLOBAL(42), kExprEnd) // init value
WASM_GLOBAL_GET(42), kExprEnd) // init value
};
EXPECT_FAILURE_WITH_MSG(referencing_out_of_bounds_global,
"global index is out of bounds");
......@@ -549,7 +549,7 @@ TEST_F(WasmModuleVerifyTest, GlobalInitializer) {
SECTION(Global, ENTRY_COUNT(2), // --
kI32Code, // type
0, // mutable
WASM_GET_GLOBAL(1), kExprEnd, // init value
WASM_GLOBAL_GET(1), kExprEnd, // init value
kI32Code, // type
0, // mutable
WASM_I32V(0), kExprEnd) // init value
......@@ -566,7 +566,7 @@ TEST_F(WasmModuleVerifyTest, GlobalInitializer) {
WASM_RTT(2, kFuncRefCode), // type
0, // mutable
WASM_RTT_SUB(kFuncRefCode, // init value
WASM_GET_GLOBAL(1)), // --
WASM_GLOBAL_GET(1)), // --
kExprEnd, // --
WASM_RTT(1, kFuncRefCode), // type
0, // mutable
......@@ -583,7 +583,7 @@ TEST_F(WasmModuleVerifyTest, GlobalInitializer) {
WASM_I32V(1), kExprEnd, // init value
kI32Code, // type
0, // mutable
WASM_GET_GLOBAL(0), kExprEnd) // init value
WASM_GLOBAL_GET(0), kExprEnd) // init value
};
EXPECT_FAILURE_WITH_MSG(
referencing_mutable_global,
......@@ -598,7 +598,7 @@ TEST_F(WasmModuleVerifyTest, GlobalInitializer) {
SECTION(Global, ENTRY_COUNT(1), // --
kI32Code, // type
0, // mutable
WASM_GET_GLOBAL(0), kExprEnd) // init value
WASM_GLOBAL_GET(0), kExprEnd) // init value
};
EXPECT_FAILURE_WITH_MSG(
referencing_mutable_imported_global,
......@@ -613,7 +613,7 @@ TEST_F(WasmModuleVerifyTest, GlobalInitializer) {
SECTION(Global, ENTRY_COUNT(1), // --
kI32Code, // type
0, // mutable
WASM_GET_GLOBAL(0), kExprEnd) // init value
WASM_GLOBAL_GET(0), kExprEnd) // init value
};
EXPECT_VERIFIES(referencing_immutable_imported_global);
......@@ -624,7 +624,7 @@ TEST_F(WasmModuleVerifyTest, GlobalInitializer) {
WASM_I32V(1), kExprEnd, // init value
kI32Code, // type
0, // mutable
WASM_GET_GLOBAL(0), kExprEnd) // init value
WASM_GLOBAL_GET(0), kExprEnd) // init value
};
EXPECT_FAILURE_WITH_MSG(
referencing_local_global,
......@@ -864,7 +864,7 @@ TEST_F(WasmModuleVerifyTest, GlobalRttSubOfGlobal) {
WASM_RTT(1, kEqRefCode), // type
0), // mutability
SECTION(Global, ENTRY_COUNT(1), WASM_RTT(2, kI31RefCode), 1,
WASM_RTT_SUB(kI31RefCode, WASM_GET_GLOBAL(0)), kExprEnd)};
WASM_RTT_SUB(kI31RefCode, WASM_GLOBAL_GET(0)), kExprEnd)};
ModuleResult result = DecodeModule(data, data + sizeof(data));
WasmInitExpr expected =
WasmInitExpr::RttSub(HeapType::kI31, WasmInitExpr::GlobalGet(0));
......@@ -885,7 +885,7 @@ TEST_F(WasmModuleVerifyTest, GlobalRttSubOfGlobalTypeError) {
kI32Code, // type
0), // mutability
SECTION(Global, ENTRY_COUNT(1), WASM_RTT(2, kExternRefCode), 1,
WASM_RTT_SUB(kExternRefCode, WASM_GET_GLOBAL(0)), kExprEnd)};
WASM_RTT_SUB(kExternRefCode, WASM_GLOBAL_GET(0)), kExprEnd)};
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_NOT_OK(result, "rtt.sub requires a supertype rtt on stack");
}
......
......@@ -54,7 +54,7 @@ TEST_F(WasmMacroGenTest, Statements) {
EXPECT_SIZE(4, WASM_LOCAL_SET(0, WASM_ZERO));
EXPECT_SIZE(4, WASM_SET_GLOBAL(0, WASM_ZERO));
EXPECT_SIZE(4, WASM_GLOBAL_SET(0, WASM_ZERO));
EXPECT_SIZE(7, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, WASM_ZERO));
......@@ -102,9 +102,9 @@ TEST_F(WasmMacroGenTest, Expressions) {
EXPECT_SIZE(2, WASM_LOCAL_GET(0));
EXPECT_SIZE(2, WASM_LOCAL_GET(1));
EXPECT_SIZE(2, WASM_LOCAL_GET(12));
EXPECT_SIZE(2, WASM_GET_GLOBAL(0));
EXPECT_SIZE(2, WASM_GET_GLOBAL(1));
EXPECT_SIZE(2, WASM_GET_GLOBAL(12));
EXPECT_SIZE(2, WASM_GLOBAL_GET(0));
EXPECT_SIZE(2, WASM_GLOBAL_GET(1));
EXPECT_SIZE(2, WASM_GLOBAL_GET(12));
EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO));
EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO));
EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO));
......
......@@ -47,45 +47,45 @@ TEST_F(WasmCapiTest, Globals) {
ValueType i64_type[] = {kWasmI64};
FunctionSig return_f32(1, 0, f32_type);
FunctionSig return_i64(1, 0, i64_type);
byte gcfi[] = {WASM_GET_GLOBAL(cfi_index)};
byte gcfi[] = {WASM_GLOBAL_GET(cfi_index)};
AddExportedFunction(CStrVector("get const f32 import"), gcfi, sizeof(gcfi),
&return_f32);
byte gcii[] = {WASM_GET_GLOBAL(cii_index)};
byte gcii[] = {WASM_GLOBAL_GET(cii_index)};
AddExportedFunction(CStrVector("get const i64 import"), gcii, sizeof(gcii),
&return_i64);
byte gvfi[] = {WASM_GET_GLOBAL(vfi_index)};
byte gvfi[] = {WASM_GLOBAL_GET(vfi_index)};
AddExportedFunction(CStrVector("get var f32 import"), gvfi, sizeof(gvfi),
&return_f32);
byte gvii[] = {WASM_GET_GLOBAL(vii_index)};
byte gvii[] = {WASM_GLOBAL_GET(vii_index)};
AddExportedFunction(CStrVector("get var i64 import"), gvii, sizeof(gvii),
&return_i64);
byte gcfe[] = {WASM_GET_GLOBAL(cfe_index)};
byte gcfe[] = {WASM_GLOBAL_GET(cfe_index)};
AddExportedFunction(CStrVector("get const f32 export"), gcfe, sizeof(gcfe),
&return_f32);
byte gcie[] = {WASM_GET_GLOBAL(cie_index)};
byte gcie[] = {WASM_GLOBAL_GET(cie_index)};
AddExportedFunction(CStrVector("get const i64 export"), gcie, sizeof(gcie),
&return_i64);
byte gvfe[] = {WASM_GET_GLOBAL(vfe_index)};
byte gvfe[] = {WASM_GLOBAL_GET(vfe_index)};
AddExportedFunction(CStrVector("get var f32 export"), gvfe, sizeof(gvfe),
&return_f32);
byte gvie[] = {WASM_GET_GLOBAL(vie_index)};
byte gvie[] = {WASM_GLOBAL_GET(vie_index)};
AddExportedFunction(CStrVector("get var i64 export"), gvie, sizeof(gvie),
&return_i64);
// Define functions for manipulating globals.
FunctionSig param_f32(0, 1, f32_type);
FunctionSig param_i64(0, 1, i64_type);
byte svfi[] = {WASM_SET_GLOBAL(vfi_index, WASM_LOCAL_GET(0))};
byte svfi[] = {WASM_GLOBAL_SET(vfi_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("set var f32 import"), svfi, sizeof(svfi),
&param_f32);
byte svii[] = {WASM_SET_GLOBAL(vii_index, WASM_LOCAL_GET(0))};
byte svii[] = {WASM_GLOBAL_SET(vii_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("set var i64 import"), svii, sizeof(svii),
&param_i64);
byte svfe[] = {WASM_SET_GLOBAL(vfe_index, WASM_LOCAL_GET(0))};
byte svfe[] = {WASM_GLOBAL_SET(vfe_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("set var f32 export"), svfe, sizeof(svfe),
&param_f32);
byte svie[] = {WASM_SET_GLOBAL(vie_index, WASM_LOCAL_GET(0))};
byte svie[] = {WASM_GLOBAL_SET(vie_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("set var i64 export"), svie, sizeof(svie),
&param_i64);
......
......@@ -39,10 +39,10 @@ TEST_F(WasmCapiTest, HostRef) {
CStrVector("global"));
uint32_t table_index = builder()->AddTable(kWasmExternRef, 10);
builder()->AddExport(CStrVector("table"), kExternalTable, table_index);
byte global_set_code[] = {WASM_SET_GLOBAL(global_index, WASM_LOCAL_GET(0))};
byte global_set_code[] = {WASM_GLOBAL_SET(global_index, WASM_LOCAL_GET(0))};
AddExportedFunction(CStrVector("global.set"), global_set_code,
sizeof(global_set_code), &v_r_sig);
byte global_get_code[] = {WASM_GET_GLOBAL(global_index)};
byte global_get_code[] = {WASM_GLOBAL_GET(global_index)};
AddExportedFunction(CStrVector("global.get"), global_get_code,
sizeof(global_get_code), &r_v_sig);
byte table_set_code[] = {
......
......@@ -66,7 +66,7 @@ TEST_F(WasmCapiTest, Threads) {
builder()->AddGlobalImport(CStrVector("id"), kWasmI32, false);
byte code[] = {
WASM_CALL_FUNCTION(callback_index, WASM_GET_GLOBAL(global_index))};
WASM_CALL_FUNCTION(callback_index, WASM_GLOBAL_GET(global_index))};
FunctionSig empty_sig(0, 0, nullptr);
AddExportedFunction(CStrVector("run"), code, sizeof(code), &empty_sig);
Compile();
......
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