Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: test/cctest/wasm/test-run-wasm-64.cc

Issue 2487673004: [wasm] Fix -Wsign-compare warnings. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/cctest/wasm/test-run-wasm-64.cc
diff --git a/test/cctest/wasm/test-run-wasm-64.cc b/test/cctest/wasm/test-run-wasm-64.cc
index 63a260b9c0daef0053948da133053a250b921e8e..6cab9b864e6722d207e94cfb1bcd62343aee3cc6 100644
--- a/test/cctest/wasm/test-run-wasm-64.cc
+++ b/test/cctest/wasm/test-run-wasm-64.cc
@@ -199,7 +199,7 @@ WASM_EXEC_TEST(I64ShlUseOnlyLowWord) {
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
uint64_t expected = static_cast<int32_t>((*i) << (*j & 0x3f));
ahaas 2016/11/10 09:03:39 Can you change the type of {expected} to int32_t i
ulan 2016/11/10 12:23:43 Done.
- CHECK_EQ(expected, r.Call(*i, *j));
+ CHECK_EQ(static_cast<int64_t>(expected), r.Call(*i, *j));
}
}
}
@@ -214,7 +214,7 @@ WASM_EXEC_TEST(I64ShrUseOnlyLowWord) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
uint64_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f));
ahaas 2016/11/10 09:03:39 Can you change the type of {expected} to int32_t i
ulan 2016/11/10 12:23:43 Done.
- CHECK_EQ(expected, r.Call(*i, *j));
+ CHECK_EQ(static_cast<int64_t>(expected), r.Call(*i, *j));
}
}
}
@@ -229,7 +229,7 @@ WASM_EXEC_TEST(I64SarUseOnlyLowWord) {
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
uint64_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f));
ahaas 2016/11/10 09:03:39 Can you change the type of {expected} to int32_t i
ulan 2016/11/10 12:23:42 Done.
- CHECK_EQ(expected, r.Call(*i, *j));
+ CHECK_EQ(static_cast<int64_t>(expected), r.Call(*i, *j));
}
}
}
@@ -424,22 +424,22 @@ WASM_EXEC_TEST(I64Shl) {
{
WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
ahaas 2016/11/10 09:03:39 Can you change WasmRunner<int64_t> r(execution_mod
ulan 2016/11/10 12:23:43 Done.
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 0, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i << 0), r.Call(*i)); }
}
{
WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
ahaas 2016/11/10 09:03:39 Can you change WasmRunner<int64_t> r(execution_mod
ulan 2016/11/10 12:23:42 Done.
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 32, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i << 32), r.Call(*i)); }
}
{
WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
ahaas 2016/11/10 09:03:39 Can you change WasmRunner<int64_t> r(execution_mod
ulan 2016/11/10 12:23:43 Done.
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i << 20), r.Call(*i)); }
}
{
WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
ahaas 2016/11/10 09:03:39 Can you change WasmRunner<int64_t> r(execution_mod
ulan 2016/11/10 12:23:43 Done.
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i << 40), r.Call(*i)); }
}
}
@@ -460,22 +460,28 @@ WASM_EXEC_TEST(I64ShrU) {
{
WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
ahaas 2016/11/10 09:03:39 Can you change WasmRunner<int64_t> r(execution_mod
ulan 2016/11/10 12:23:42 Done.
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i >> 0), r.Call(*i)); }
}
{
WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
ahaas 2016/11/10 09:03:39 Can you change WasmRunner<int64_t> r(execution_mod
ulan 2016/11/10 12:23:42 Done.
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) {
+ CHECK_EQ(static_cast<int64_t>(*i >> 32), r.Call(*i));
+ }
}
{
WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
ahaas 2016/11/10 09:03:39 Can you change WasmRunner<int64_t> r(execution_mod
ulan 2016/11/10 12:23:43 Done.
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) {
+ CHECK_EQ(static_cast<int64_t>(*i >> 20), r.Call(*i));
+ }
}
{
WasmRunner<int64_t> r(execution_mode, MachineType::Int64());
ahaas 2016/11/10 09:03:39 Can you change WasmRunner<int64_t> r(execution_mod
ulan 2016/11/10 12:23:43 Done.
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) {
+ CHECK_EQ(static_cast<int64_t>(*i >> 40), r.Call(*i));
+ }
}
}
@@ -635,7 +641,7 @@ WASM_EXEC_TEST(I64UConvertI32) {
REQUIRE(I64UConvertI32);
WasmRunner<int64_t> r(execution_mode, MachineType::Uint32());
BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0)));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); }
}
WASM_EXEC_TEST(I64Popcnt) {
@@ -1367,7 +1373,7 @@ WASM_EXEC_TEST(LoadMemI64) {
BUILD(r, WASM_LOAD_MEM(MachineType::Int64(), WASM_I8(0)));
module.WriteMemory<int64_t>(&memory[0], 0xaabbccdd00112233LL);
ahaas 2016/11/10 09:03:39 I think you could just change 0xaabbccdd00112233LL
ulan 2016/11/10 12:23:43 Done.
- CHECK_EQ(0xaabbccdd00112233LL, r.Call());
+ CHECK_EQ(bit_cast<int64_t>(0xaabbccdd00112233LL), r.Call());
module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL);
CHECK_EQ(0x33aabbccdd001122LL, r.Call());
@@ -1388,7 +1394,7 @@ WASM_EXEC_TEST(LoadMemI64_alignment) {
WASM_LOAD_MEM_ALIGNMENT(MachineType::Int64(), WASM_I8(0), alignment));
module.WriteMemory<int64_t>(&memory[0], 0xaabbccdd00112233LL);
ahaas 2016/11/10 09:03:39 same here.
ulan 2016/11/10 12:23:43 Done.
- CHECK_EQ(0xaabbccdd00112233LL, r.Call());
+ CHECK_EQ(bit_cast<int64_t>(0xaabbccdd00112233LL), r.Call());
module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL);
CHECK_EQ(0x33aabbccdd001122LL, r.Call());

Powered by Google App Engine
This is Rietveld 408576698