Index: test/cctest/compiler/test-run-machops.cc |
diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc |
index 10cef87026651a91c75d45af880ca4cbac62cefc..b8c6b9393d0af1b996eddea82516f25ad732faa3 100644 |
--- a/test/cctest/compiler/test-run-machops.cc |
+++ b/test/cctest/compiler/test-run-machops.cc |
@@ -2214,6 +2214,58 @@ TEST(RunWord32ShlP) { |
} |
+TEST(RunWord32ShlInComparison) { |
+ { |
+ RawMachineAssemblerTester<int32_t> m; |
+ Uint32BinopTester bt(&m); |
+ bt.AddReturn( |
+ m.Word32Equal(m.Word32Shl(bt.param0, bt.param1), m.Int32Constant(0))); |
+ FOR_UINT32_INPUTS(i) { |
+ FOR_UINT32_SHIFTS(shift) { |
+ uint32_t expected = 0 == (*i << shift); |
+ CHECK_UINT32_EQ(expected, bt.call(*i, shift)); |
+ } |
+ } |
+ } |
+ { |
+ RawMachineAssemblerTester<int32_t> m; |
+ Uint32BinopTester bt(&m); |
+ bt.AddReturn( |
+ m.Word32Equal(m.Int32Constant(0), m.Word32Shl(bt.param0, bt.param1))); |
+ FOR_UINT32_INPUTS(i) { |
+ FOR_UINT32_SHIFTS(shift) { |
+ uint32_t expected = 0 == (*i << shift); |
+ CHECK_UINT32_EQ(expected, bt.call(*i, shift)); |
+ } |
+ } |
+ } |
+ { |
+ FOR_UINT32_SHIFTS(shift) { |
+ RawMachineAssemblerTester<int32_t> m(kMachUint32); |
+ m.Return( |
+ m.Word32Equal(m.Int32Constant(0), |
+ m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)))); |
+ FOR_UINT32_INPUTS(i) { |
+ uint32_t expected = 0 == (*i << shift); |
+ CHECK_UINT32_EQ(expected, m.Call(*i)); |
+ } |
+ } |
+ } |
+ { |
+ FOR_UINT32_SHIFTS(shift) { |
+ RawMachineAssemblerTester<int32_t> m(kMachUint32); |
+ m.Return( |
+ m.Word32Equal(m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)), |
+ m.Int32Constant(0))); |
+ FOR_UINT32_INPUTS(i) { |
+ uint32_t expected = 0 == (*i << shift); |
+ CHECK_UINT32_EQ(expected, m.Call(*i)); |
+ } |
+ } |
+ } |
+} |
+ |
+ |
TEST(RunWord32ShrP) { |
{ |
FOR_UINT32_SHIFTS(shift) { |
@@ -2240,6 +2292,58 @@ TEST(RunWord32ShrP) { |
} |
+TEST(RunWord32ShrInComparison) { |
+ { |
+ RawMachineAssemblerTester<int32_t> m; |
+ Uint32BinopTester bt(&m); |
+ bt.AddReturn( |
+ m.Word32Equal(m.Word32Shr(bt.param0, bt.param1), m.Int32Constant(0))); |
+ FOR_UINT32_INPUTS(i) { |
+ FOR_UINT32_SHIFTS(shift) { |
+ uint32_t expected = 0 == (*i >> shift); |
+ CHECK_UINT32_EQ(expected, bt.call(*i, shift)); |
+ } |
+ } |
+ } |
+ { |
+ RawMachineAssemblerTester<int32_t> m; |
+ Uint32BinopTester bt(&m); |
+ bt.AddReturn( |
+ m.Word32Equal(m.Int32Constant(0), m.Word32Shr(bt.param0, bt.param1))); |
+ FOR_UINT32_INPUTS(i) { |
+ FOR_UINT32_SHIFTS(shift) { |
+ uint32_t expected = 0 == (*i >> shift); |
+ CHECK_UINT32_EQ(expected, bt.call(*i, shift)); |
+ } |
+ } |
+ } |
+ { |
+ FOR_UINT32_SHIFTS(shift) { |
+ RawMachineAssemblerTester<int32_t> m(kMachUint32); |
+ m.Return( |
+ m.Word32Equal(m.Int32Constant(0), |
+ m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)))); |
+ FOR_UINT32_INPUTS(i) { |
+ uint32_t expected = 0 == (*i >> shift); |
+ CHECK_UINT32_EQ(expected, m.Call(*i)); |
+ } |
+ } |
+ } |
+ { |
+ FOR_UINT32_SHIFTS(shift) { |
+ RawMachineAssemblerTester<int32_t> m(kMachUint32); |
+ m.Return( |
+ m.Word32Equal(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)), |
+ m.Int32Constant(0))); |
+ FOR_UINT32_INPUTS(i) { |
+ uint32_t expected = 0 == (*i >> shift); |
+ CHECK_UINT32_EQ(expected, m.Call(*i)); |
+ } |
+ } |
+ } |
+} |
+ |
+ |
TEST(RunWord32SarP) { |
{ |
FOR_INT32_SHIFTS(shift) { |
@@ -2266,6 +2370,58 @@ TEST(RunWord32SarP) { |
} |
+TEST(RunWord32SarInComparison) { |
+ { |
+ RawMachineAssemblerTester<int32_t> m; |
+ Int32BinopTester bt(&m); |
+ bt.AddReturn( |
+ m.Word32Equal(m.Word32Sar(bt.param0, bt.param1), m.Int32Constant(0))); |
+ FOR_INT32_INPUTS(i) { |
+ FOR_INT32_SHIFTS(shift) { |
+ int32_t expected = 0 == (*i >> shift); |
+ CHECK_EQ(expected, bt.call(*i, shift)); |
+ } |
+ } |
+ } |
+ { |
+ RawMachineAssemblerTester<int32_t> m; |
+ Int32BinopTester bt(&m); |
+ bt.AddReturn( |
+ m.Word32Equal(m.Int32Constant(0), m.Word32Sar(bt.param0, bt.param1))); |
+ FOR_INT32_INPUTS(i) { |
+ FOR_INT32_SHIFTS(shift) { |
+ int32_t expected = 0 == (*i >> shift); |
+ CHECK_EQ(expected, bt.call(*i, shift)); |
+ } |
+ } |
+ } |
+ { |
+ FOR_INT32_SHIFTS(shift) { |
+ RawMachineAssemblerTester<int32_t> m(kMachInt32); |
+ m.Return( |
+ m.Word32Equal(m.Int32Constant(0), |
+ m.Word32Sar(m.Parameter(0), m.Int32Constant(shift)))); |
+ FOR_INT32_INPUTS(i) { |
+ int32_t expected = 0 == (*i >> shift); |
+ CHECK_EQ(expected, m.Call(*i)); |
+ } |
+ } |
+ } |
+ { |
+ FOR_INT32_SHIFTS(shift) { |
+ RawMachineAssemblerTester<int32_t> m(kMachInt32); |
+ m.Return( |
+ m.Word32Equal(m.Word32Sar(m.Parameter(0), m.Int32Constant(shift)), |
+ m.Int32Constant(0))); |
+ FOR_INT32_INPUTS(i) { |
+ uint32_t expected = 0 == (*i >> shift); |
+ CHECK_EQ(expected, m.Call(*i)); |
+ } |
+ } |
+ } |
+} |
+ |
+ |
TEST(RunWord32RorP) { |
{ |
FOR_UINT32_SHIFTS(shift) { |
@@ -2291,6 +2447,58 @@ TEST(RunWord32RorP) { |
} |
+TEST(RunWord32RorInComparison) { |
+ { |
+ RawMachineAssemblerTester<int32_t> m; |
+ Uint32BinopTester bt(&m); |
+ bt.AddReturn( |
+ m.Word32Equal(m.Word32Ror(bt.param0, bt.param1), m.Int32Constant(0))); |
+ FOR_UINT32_INPUTS(i) { |
+ FOR_UINT32_SHIFTS(shift) { |
+ uint32_t expected = 0 == bits::RotateRight32(*i, shift); |
+ CHECK_UINT32_EQ(expected, bt.call(*i, shift)); |
+ } |
+ } |
+ } |
+ { |
+ RawMachineAssemblerTester<int32_t> m; |
+ Uint32BinopTester bt(&m); |
+ bt.AddReturn( |
+ m.Word32Equal(m.Int32Constant(0), m.Word32Ror(bt.param0, bt.param1))); |
+ FOR_UINT32_INPUTS(i) { |
+ FOR_UINT32_SHIFTS(shift) { |
+ uint32_t expected = 0 == bits::RotateRight32(*i, shift); |
+ CHECK_UINT32_EQ(expected, bt.call(*i, shift)); |
+ } |
+ } |
+ } |
+ { |
+ FOR_UINT32_SHIFTS(shift) { |
+ RawMachineAssemblerTester<int32_t> m(kMachUint32); |
+ m.Return( |
+ m.Word32Equal(m.Int32Constant(0), |
+ m.Word32Ror(m.Parameter(0), m.Int32Constant(shift)))); |
+ FOR_UINT32_INPUTS(i) { |
+ uint32_t expected = 0 == bits::RotateRight32(*i, shift); |
+ CHECK_UINT32_EQ(expected, m.Call(*i)); |
+ } |
+ } |
+ } |
+ { |
+ FOR_UINT32_SHIFTS(shift) { |
+ RawMachineAssemblerTester<int32_t> m(kMachUint32); |
+ m.Return( |
+ m.Word32Equal(m.Word32Ror(m.Parameter(0), m.Int32Constant(shift)), |
+ m.Int32Constant(0))); |
+ FOR_UINT32_INPUTS(i) { |
+ uint32_t expected = 0 == bits::RotateRight32(*i, shift); |
+ CHECK_UINT32_EQ(expected, m.Call(*i)); |
+ } |
+ } |
+ } |
+} |
+ |
+ |
TEST(RunWord32NotP) { |
RawMachineAssemblerTester<int32_t> m(kMachInt32); |
m.Return(m.Word32Not(m.Parameter(0))); |