Commit f4b6f4af authored by Joey Gouly's avatar Joey Gouly Committed by Commit Bot

[arm64][windows] Ensure 64-bit values in unittest

On Windows, long is 32-bits, so the 'L' suffix shouldn't be used if a
64-bit value is needed. This caused a test failure in 'Int64MulWithImmediate'.

Change-Id: I93c43a1f166aa0e5bcd53aaf7a860fffd006fd0b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1627538
Commit-Queue: Martyn Capewell <martyn.capewell@arm.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61986}
parent edf616e9
...@@ -1277,7 +1277,7 @@ INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, ...@@ -1277,7 +1277,7 @@ INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnRight) { TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnRight) {
TRACED_FORRANGE(int, bit, 0, 63) { TRACED_FORRANGE(int, bit, 0, 63) {
uint64_t mask = 1LL << bit; uint64_t mask = uint64_t{1} << bit;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
RawMachineLabel a, b; RawMachineLabel a, b;
m.Branch(m.Word64And(m.Parameter(0), m.Int64Constant(mask)), &a, &b); m.Branch(m.Word64And(m.Parameter(0), m.Int64Constant(mask)), &a, &b);
...@@ -1298,7 +1298,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnRight) { ...@@ -1298,7 +1298,7 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnRight) {
TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnLeft) { TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnLeft) {
TRACED_FORRANGE(int, bit, 0, 63) { TRACED_FORRANGE(int, bit, 0, 63) {
uint64_t mask = 1LL << bit; uint64_t mask = uint64_t{1} << bit;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
RawMachineLabel a, b; RawMachineLabel a, b;
m.Branch(m.Word64And(m.Int64Constant(mask), m.Parameter(0)), &a, &b); m.Branch(m.Word64And(m.Int64Constant(mask), m.Parameter(0)), &a, &b);
...@@ -2196,7 +2196,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { ...@@ -2196,7 +2196,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) {
// x * (2^k + 1) -> x + (x << k) // x * (2^k + 1) -> x + (x << k)
TRACED_FORRANGE(int64_t, k, 1, 62) { TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Int64Mul(m.Parameter(0), m.Int64Constant((1L << k) + 1))); m.Return(
m.Int64Mul(m.Parameter(0), m.Int64Constant((int64_t{1} << k) + 1)));
Stream s = m.Build(); Stream s = m.Build();
ASSERT_EQ(1U, s.size()); ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode()); EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
...@@ -2209,7 +2210,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { ...@@ -2209,7 +2210,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) {
// (2^k + 1) * x -> x + (x << k) // (2^k + 1) * x -> x + (x << k)
TRACED_FORRANGE(int64_t, k, 1, 62) { TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64()); StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(0))); m.Return(
m.Int64Mul(m.Int64Constant((int64_t{1} << k) + 1), m.Parameter(0)));
Stream s = m.Build(); Stream s = m.Build();
ASSERT_EQ(1U, s.size()); ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode()); EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
...@@ -2223,8 +2225,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { ...@@ -2223,8 +2225,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) {
TRACED_FORRANGE(int64_t, k, 1, 62) { TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64()); MachineType::Int64());
m.Return( m.Return(m.Int64Add(
m.Int64Add(m.Int64Mul(m.Parameter(0), m.Int64Constant((1L << k) + 1)), m.Int64Mul(m.Parameter(0), m.Int64Constant((int64_t{1} << k) + 1)),
m.Parameter(1))); m.Parameter(1)));
Stream s = m.Build(); Stream s = m.Build();
ASSERT_EQ(2U, s.size()); ASSERT_EQ(2U, s.size());
...@@ -2240,8 +2242,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { ...@@ -2240,8 +2242,8 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) {
TRACED_FORRANGE(int64_t, k, 1, 62) { TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64()); MachineType::Int64());
m.Return( m.Return(m.Int64Add(
m.Int64Add(m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(0)), m.Int64Mul(m.Int64Constant((int64_t{1} << k) + 1), m.Parameter(0)),
m.Parameter(1))); m.Parameter(1)));
Stream s = m.Build(); Stream s = m.Build();
ASSERT_EQ(2U, s.size()); ASSERT_EQ(2U, s.size());
...@@ -2257,9 +2259,9 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { ...@@ -2257,9 +2259,9 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) {
TRACED_FORRANGE(int64_t, k, 1, 62) { TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64()); MachineType::Int64());
m.Return( m.Return(m.Int64Add(
m.Int64Add(m.Parameter(0), m.Parameter(0),
m.Int64Mul(m.Parameter(1), m.Int64Constant((1L << k) + 1)))); m.Int64Mul(m.Parameter(1), m.Int64Constant((int64_t{1} << k) + 1))));
Stream s = m.Build(); Stream s = m.Build();
ASSERT_EQ(2U, s.size()); ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode()); EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
...@@ -2274,9 +2276,9 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { ...@@ -2274,9 +2276,9 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) {
TRACED_FORRANGE(int64_t, k, 1, 62) { TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64()); MachineType::Int64());
m.Return( m.Return(m.Int64Add(
m.Int64Add(m.Parameter(0), m.Parameter(0),
m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(1)))); m.Int64Mul(m.Int64Constant((int64_t{1} << k) + 1), m.Parameter(1))));
Stream s = m.Build(); Stream s = m.Build();
ASSERT_EQ(2U, s.size()); ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode()); EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
...@@ -2291,9 +2293,9 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { ...@@ -2291,9 +2293,9 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) {
TRACED_FORRANGE(int64_t, k, 1, 62) { TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64()); MachineType::Int64());
m.Return( m.Return(m.Int64Sub(
m.Int64Sub(m.Parameter(0), m.Parameter(0),
m.Int64Mul(m.Parameter(1), m.Int64Constant((1L << k) + 1)))); m.Int64Mul(m.Parameter(1), m.Int64Constant((int64_t{1} << k) + 1))));
Stream s = m.Build(); Stream s = m.Build();
ASSERT_EQ(2U, s.size()); ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode()); EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
...@@ -2308,9 +2310,9 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) { ...@@ -2308,9 +2310,9 @@ TEST_F(InstructionSelectorTest, Int64MulWithImmediate) {
TRACED_FORRANGE(int64_t, k, 1, 62) { TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(), StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64()); MachineType::Int64());
m.Return( m.Return(m.Int64Sub(
m.Int64Sub(m.Parameter(0), m.Parameter(0),
m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(1)))); m.Int64Mul(m.Int64Constant((int64_t{1} << k) + 1), m.Parameter(1))));
Stream s = m.Build(); Stream s = m.Build();
ASSERT_EQ(2U, s.size()); ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode()); EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
......
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