Commit 8e18e280 authored by Ng Zhi An's avatar Ng Zhi An Committed by V8 LUCI CQ

[cleanup] Rename/rescope some shadowed variables

Bug: v8:12244
Change-Id: I5a85e109316b349545d2699a59200c167d261842
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3180244Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77026}
parent 18f0a1e4
...@@ -1411,8 +1411,8 @@ void RunExtAddPairwiseTest(TestExecutionTier execution_tier, ...@@ -1411,8 +1411,8 @@ void RunExtAddPairwiseTest(TestExecutionTier execution_tier,
for (auto i = v.begin(), j = v.end() - 1; i < v.end(); i++, j--) { for (auto i = v.begin(), j = v.end() - 1; i < v.end(); i++, j--) {
r.Call(*i, *j); r.Call(*i, *j);
Wide expected = AddLong<Wide>(*i, *j); Wide expected = AddLong<Wide>(*i, *j);
for (int i = 0; i < num_lanes; i++) { for (int l = 0; l < num_lanes; l++) {
CHECK_EQ(expected, LANE(g, i)); CHECK_EQ(expected, LANE(g, l));
} }
} }
} }
...@@ -2447,27 +2447,29 @@ WASM_SIMD_TEST(I8x16Swizzle) { ...@@ -2447,27 +2447,29 @@ WASM_SIMD_TEST(I8x16Swizzle) {
// [0-15] and [16-31]. Using [0-15] as the indices will not sufficiently test // [0-15] and [16-31]. Using [0-15] as the indices will not sufficiently test
// swizzle since the expected result is a no-op, using [16-31] will result in // swizzle since the expected result is a no-op, using [16-31] will result in
// all 0s. // all 0s.
WasmRunner<int32_t> r(execution_tier); {
static const int kElems = kSimd128Size / sizeof(uint8_t); WasmRunner<int32_t> r(execution_tier);
uint8_t* dst = r.builder().AddGlobal<uint8_t>(kWasmS128); static const int kElems = kSimd128Size / sizeof(uint8_t);
uint8_t* src0 = r.builder().AddGlobal<uint8_t>(kWasmS128); uint8_t* dst = r.builder().AddGlobal<uint8_t>(kWasmS128);
uint8_t* src1 = r.builder().AddGlobal<uint8_t>(kWasmS128); uint8_t* src0 = r.builder().AddGlobal<uint8_t>(kWasmS128);
BUILD( uint8_t* src1 = r.builder().AddGlobal<uint8_t>(kWasmS128);
r, BUILD(r,
WASM_GLOBAL_SET(0, WASM_SIMD_BINOP(kExprI8x16Swizzle, WASM_GLOBAL_GET(1), WASM_GLOBAL_SET(0,
WASM_GLOBAL_GET(2))), WASM_SIMD_BINOP(kExprI8x16Swizzle, WASM_GLOBAL_GET(1),
WASM_ONE); WASM_GLOBAL_GET(2))),
WASM_ONE);
for (SwizzleTestArgs si : swizzle_test_vector) { for (SwizzleTestArgs si : swizzle_test_vector) {
for (int i = 0; i < kElems; i++) { for (int i = 0; i < kElems; i++) {
LANE(src0, i) = si.input[i]; LANE(src0, i) = si.input[i];
LANE(src1, i) = si.indices[i]; LANE(src1, i) = si.indices[i];
} }
CHECK_EQ(1, r.Call()); CHECK_EQ(1, r.Call());
for (int i = 0; i < kElems; i++) { for (int i = 0; i < kElems; i++) {
CHECK_EQ(LANE(dst, i), si.expected[i]); CHECK_EQ(LANE(dst, i), si.expected[i]);
}
} }
} }
...@@ -2596,8 +2598,8 @@ WASM_SIMD_TEST(S8x16MultiShuffleFuzz) { ...@@ -2596,8 +2598,8 @@ WASM_SIMD_TEST(S8x16MultiShuffleFuzz) {
// Run the SIMD or scalar lowered compiled code and compare results. // Run the SIMD or scalar lowered compiled code and compare results.
std::array<int8_t, kSimd128Size> result; std::array<int8_t, kSimd128Size> result;
RunWasmCode(execution_tier, buffer, &result); RunWasmCode(execution_tier, buffer, &result);
for (size_t i = 0; i < kSimd128Size; ++i) { for (size_t j = 0; j < kSimd128Size; ++j) {
CHECK_EQ(result[i], expected[i]); CHECK_EQ(result[j], expected[j]);
} }
} }
} }
...@@ -2933,18 +2935,21 @@ WASM_SIMD_TEST(SimdF32x4SetGlobal) { ...@@ -2933,18 +2935,21 @@ WASM_SIMD_TEST(SimdF32x4SetGlobal) {
} }
WASM_SIMD_TEST(SimdLoadStoreLoad) { WASM_SIMD_TEST(SimdLoadStoreLoad) {
WasmRunner<int32_t> r(execution_tier); {
int32_t* memory = WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); int32_t* memory =
// Load memory, store it, then reload it and extract the first lane. Use a r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
// non-zero offset into the memory of 1 lane (4 bytes) to test indexing. // Load memory, store it, then reload it and extract the first lane. Use a
BUILD(r, WASM_SIMD_STORE_MEM(WASM_I32V(8), WASM_SIMD_LOAD_MEM(WASM_I32V(4))), // non-zero offset into the memory of 1 lane (4 bytes) to test indexing.
WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_LOAD_MEM(WASM_I32V(8)))); BUILD(r,
WASM_SIMD_STORE_MEM(WASM_I32V(8), WASM_SIMD_LOAD_MEM(WASM_I32V(4))),
WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_LOAD_MEM(WASM_I32V(8))));
FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(i) {
int32_t expected = i; int32_t expected = i;
r.builder().WriteMemory(&memory[1], expected); r.builder().WriteMemory(&memory[1], expected);
CHECK_EQ(expected, r.Call()); CHECK_EQ(expected, r.Call());
}
} }
{ {
...@@ -2976,25 +2981,28 @@ WASM_SIMD_TEST(SimdLoadStoreLoad) { ...@@ -2976,25 +2981,28 @@ WASM_SIMD_TEST(SimdLoadStoreLoad) {
} }
WASM_SIMD_TEST(SimdLoadStoreLoadMemargOffset) { WASM_SIMD_TEST(SimdLoadStoreLoadMemargOffset) {
WasmRunner<int32_t> r(execution_tier); {
int32_t* memory = WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t)); int32_t* memory =
constexpr byte offset_1 = 4; r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
constexpr byte offset_2 = 8; constexpr byte offset_1 = 4;
// Load from memory at offset_1, store to offset_2, load from offset_2, and constexpr byte offset_2 = 8;
// extract first lane. We use non-zero memarg offsets to test offset decoding. // Load from memory at offset_1, store to offset_2, load from offset_2, and
BUILD( // extract first lane. We use non-zero memarg offsets to test offset
r, // decoding.
WASM_SIMD_STORE_MEM_OFFSET( BUILD(r,
offset_2, WASM_ZERO, WASM_SIMD_LOAD_MEM_OFFSET(offset_1, WASM_ZERO)), WASM_SIMD_STORE_MEM_OFFSET(
WASM_SIMD_I32x4_EXTRACT_LANE( offset_2, WASM_ZERO,
0, WASM_SIMD_LOAD_MEM_OFFSET(offset_2, WASM_ZERO))); WASM_SIMD_LOAD_MEM_OFFSET(offset_1, WASM_ZERO)),
WASM_SIMD_I32x4_EXTRACT_LANE(
FOR_INT32_INPUTS(i) { 0, WASM_SIMD_LOAD_MEM_OFFSET(offset_2, WASM_ZERO)));
int32_t expected = i;
// Index 1 of memory (int32_t) will be bytes 4 to 8. FOR_INT32_INPUTS(i) {
r.builder().WriteMemory(&memory[1], expected); int32_t expected = i;
CHECK_EQ(expected, r.Call()); // Index 1 of memory (int32_t) will be bytes 4 to 8.
r.builder().WriteMemory(&memory[1], expected);
CHECK_EQ(expected, r.Call());
}
} }
{ {
...@@ -3051,18 +3059,20 @@ template <typename T> ...@@ -3051,18 +3059,20 @@ template <typename T>
void RunLoadSplatTest(TestExecutionTier execution_tier, WasmOpcode op) { void RunLoadSplatTest(TestExecutionTier execution_tier, WasmOpcode op) {
constexpr int lanes = 16 / sizeof(T); constexpr int lanes = 16 / sizeof(T);
constexpr int mem_index = 16; // Load from mem index 16 (bytes). constexpr int mem_index = 16; // Load from mem index 16 (bytes).
WasmRunner<int32_t> r(execution_tier); {
T* memory = r.builder().AddMemoryElems<T>(kWasmPageSize / sizeof(T)); WasmRunner<int32_t> r(execution_tier);
T* global = r.builder().AddGlobal<T>(kWasmS128); T* memory = r.builder().AddMemoryElems<T>(kWasmPageSize / sizeof(T));
BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_LOAD_OP(op, WASM_I32V(mem_index))), T* global = r.builder().AddGlobal<T>(kWasmS128);
WASM_ONE); BUILD(r, WASM_GLOBAL_SET(0, WASM_SIMD_LOAD_OP(op, WASM_I32V(mem_index))),
WASM_ONE);
for (T x : compiler::ValueHelper::GetVector<T>()) { for (T x : compiler::ValueHelper::GetVector<T>()) {
// 16-th byte in memory is lanes-th element (size T) of memory. // 16-th byte in memory is lanes-th element (size T) of memory.
r.builder().WriteMemory(&memory[lanes], x); r.builder().WriteMemory(&memory[lanes], x);
r.Call(); r.Call();
for (int i = 0; i < lanes; i++) { for (int i = 0; i < lanes; i++) {
CHECK_EQ(x, LANE(global, i)); CHECK_EQ(x, LANE(global, i));
}
} }
} }
......
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