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

Unified Diff: test/cctest/compiler/test-run-machops.cc

Issue 469213002: [turbofan] Introduce WordRor machine operator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix BUILD.gn Created 6 years, 4 months 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
« no previous file with comments | « test/base-unittests/bits-unittest.cc ('k') | test/compiler-unittests/compiler-unittests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 edac9750434a484017d3920b16cfe2fa0757b562..fdda63a1c36dd61496e54f0d3cfe885bc5dffffe 100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -5,12 +5,14 @@
#include <functional>
#include <limits>
+#include "src/base/bits.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/codegen-tester.h"
#include "test/cctest/compiler/value-helper.h"
#if V8_TURBOFAN_TARGET
+using namespace v8::base;
using namespace v8::internal;
using namespace v8::internal::compiler;
@@ -2282,6 +2284,31 @@ TEST(RunWord32SarP) {
}
+TEST(RunWord32RorP) {
+ {
+ FOR_UINT32_SHIFTS(shift) {
+ RawMachineAssemblerTester<int32_t> m(kMachineWord32);
+ m.Return(m.Word32Ror(m.Parameter(0), m.Int32Constant(shift)));
+ FOR_UINT32_INPUTS(j) {
+ int32_t expected = bits::RotateRight32(*j, shift);
+ CHECK_EQ(expected, m.Call(*j));
+ }
+ }
+ }
+ {
+ RawMachineAssemblerTester<int32_t> m;
+ Int32BinopTester bt(&m);
+ bt.AddReturn(m.Word32Ror(bt.param0, bt.param1));
+ FOR_UINT32_INPUTS(i) {
+ FOR_UINT32_SHIFTS(shift) {
+ int32_t expected = bits::RotateRight32(*i, shift);
+ CHECK_EQ(expected, bt.call(*i, shift));
+ }
+ }
+ }
+}
+
+
TEST(RunWord32NotP) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
m.Return(m.Word32Not(m.Parameter(0)));
@@ -2439,16 +2466,16 @@ TEST(RunDeadInt32Binops) {
RawMachineAssemblerTester<int32_t> m;
Operator* ops[] = {
- m.machine()->Word32And(), m.machine()->Word32Or(),
- m.machine()->Word32Xor(), m.machine()->Word32Shl(),
- m.machine()->Word32Shr(), m.machine()->Word32Sar(),
- m.machine()->Word32Equal(), m.machine()->Int32Add(),
- m.machine()->Int32Sub(), m.machine()->Int32Mul(),
- m.machine()->Int32Div(), m.machine()->Int32UDiv(),
- m.machine()->Int32Mod(), m.machine()->Int32UMod(),
- m.machine()->Int32LessThan(), m.machine()->Int32LessThanOrEqual(),
- m.machine()->Uint32LessThan(), m.machine()->Uint32LessThanOrEqual(),
- NULL};
+ m.machine()->Word32And(), m.machine()->Word32Or(),
+ m.machine()->Word32Xor(), m.machine()->Word32Shl(),
+ m.machine()->Word32Shr(), m.machine()->Word32Sar(),
+ m.machine()->Word32Ror(), m.machine()->Word32Equal(),
+ m.machine()->Int32Add(), m.machine()->Int32Sub(),
+ m.machine()->Int32Mul(), m.machine()->Int32Div(),
+ m.machine()->Int32UDiv(), m.machine()->Int32Mod(),
+ m.machine()->Int32UMod(), m.machine()->Int32LessThan(),
+ m.machine()->Int32LessThanOrEqual(), m.machine()->Uint32LessThan(),
+ m.machine()->Uint32LessThanOrEqual(), NULL};
for (int i = 0; ops[i] != NULL; i++) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32);
@@ -3689,53 +3716,6 @@ TEST(RunTestIntPtrArithmetic) {
}
-static inline uint32_t rotr32(uint32_t i, uint32_t j) {
- return (i >> j) | (i << (32 - j));
-}
-
-
-TEST(RunTestInt32RotateRightP) {
- {
- RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
- bt.AddReturn(m.Word32Or(
- m.Word32Shr(bt.param0, bt.param1),
- m.Word32Shl(bt.param0, m.Int32Sub(m.Int32Constant(32), bt.param1))));
- bt.Run(ValueHelper::uint32_vector(), ValueHelper::ror_vector(), rotr32);
- }
- {
- RawMachineAssemblerTester<int32_t> m;
- Int32BinopTester bt(&m);
- bt.AddReturn(m.Word32Or(
- m.Word32Shl(bt.param0, m.Int32Sub(m.Int32Constant(32), bt.param1)),
- m.Word32Shr(bt.param0, bt.param1)));
- bt.Run(ValueHelper::uint32_vector(), ValueHelper::ror_vector(), rotr32);
- }
-}
-
-
-TEST(RunTestInt32RotateRightImm) {
- FOR_INPUTS(uint32_t, ror, i) {
- {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
- Node* value = m.Parameter(0);
- m.Return(m.Word32Or(m.Word32Shr(value, m.Int32Constant(*i)),
- m.Word32Shl(value, m.Int32Constant(32 - *i))));
- m.Run(ValueHelper::uint32_vector(),
- std::bind2nd(std::ptr_fun(&rotr32), *i));
- }
- {
- RawMachineAssemblerTester<int32_t> m(kMachineWord32);
- Node* value = m.Parameter(0);
- m.Return(m.Word32Or(m.Word32Shl(value, m.Int32Constant(32 - *i)),
- m.Word32Shr(value, m.Int32Constant(*i))));
- m.Run(ValueHelper::uint32_vector(),
- std::bind2nd(std::ptr_fun(&rotr32), *i));
- }
- }
-}
-
-
TEST(RunSpillLotsOfThings) {
static const int kInputSize = 1000;
RawMachineAssemblerTester<void> m;
« no previous file with comments | « test/base-unittests/bits-unittest.cc ('k') | test/compiler-unittests/compiler-unittests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698