Commit b6b2b85f authored by Vasili Skurydzin's avatar Vasili Skurydzin Committed by V8 LUCI CQ

[ppc64] Use signed integers for machine ops tests

When result is returned in a register to the calling code, some GCC
versions use 32 bit compare, and some use 64 bit compare. In the case
comparison is 64 bit, GCC on PPC64 arch is expecting the return value to
be sign-extended, leading to an error in comparison.

Change-Id: I05b7e1566bc9bb931ce9998bb310eb29c50e90e4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2968449Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarMilad Fa <mfarazma@redhat.com>
Commit-Queue: Vasili Skurydzin <vasili.skurydzin@ibm.com>
Cr-Commit-Position: refs/heads/master@{#75245}
parent 88b2535c
......@@ -1776,7 +1776,7 @@ TEST(RunInt32AddInBranch) {
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Int32Add(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
......@@ -1786,14 +1786,14 @@ TEST(RunInt32AddInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (i + j) == 0 ? constant : 0 - constant;
int32_t expected = (i + j) == 0 ? constant : 0 - constant;
CHECK_EQ(expected, m.Call(j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
m.Branch(m.Word32NotEqual(m.Int32Add(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
......@@ -1803,7 +1803,7 @@ TEST(RunInt32AddInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (i + j) != 0 ? constant : 0 - constant;
int32_t expected = (i + j) != 0 ? constant : 0 - constant;
CHECK_EQ(expected, m.Call(j));
}
}
......@@ -2121,7 +2121,7 @@ TEST(RunInt32SubInBranch) {
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Int32Sub(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
......@@ -2131,7 +2131,7 @@ TEST(RunInt32SubInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (i - j) == 0 ? constant : 0 - constant;
int32_t expected = (i - j) == 0 ? constant : 0 - constant;
CHECK_EQ(expected, m.Call(j));
}
}
......@@ -3251,7 +3251,7 @@ TEST(RunWord32XorInBranch) {
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32Xor(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
......@@ -3261,14 +3261,14 @@ TEST(RunWord32XorInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (i ^ j) == 0 ? constant : 0 - constant;
int32_t expected = (i ^ j) == 0 ? constant : 0 - constant;
CHECK_EQ(expected, m.Call(j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
m.Branch(m.Word32NotEqual(m.Word32Xor(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
......@@ -3278,7 +3278,7 @@ TEST(RunWord32XorInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
uint32_t expected = (i ^ j) != 0 ? constant : 0 - constant;
int32_t expected = (i ^ j) != 0 ? constant : 0 - constant;
CHECK_EQ(expected, m.Call(j));
}
}
......@@ -3433,7 +3433,7 @@ TEST(RunWord32ShrP) {
TEST(RunWordShiftInBranch) {
static const uint32_t constant = 987654321;
FOR_UINT32_SHIFTS(shift) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)),
......@@ -3443,12 +3443,12 @@ TEST(RunWordShiftInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
uint32_t expected = ((i << shift) == 0) ? constant : 0 - constant;
int32_t expected = ((i << shift) == 0) ? constant : 0 - constant;
CHECK_EQ(expected, m.Call(i));
}
}
FOR_UINT32_SHIFTS(shift) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
m.Branch(m.Word32Equal(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)),
......@@ -3458,7 +3458,7 @@ TEST(RunWordShiftInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
uint32_t expected = ((i >> shift) == 0) ? constant : 0 - constant;
int32_t expected = ((i >> shift) == 0) ? constant : 0 - constant;
CHECK_EQ(expected, m.Call(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