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

Side by Side Diff: test/cctest/compiler/test-run-machops.cc

Issue 434553002: [arm] Add support for ROR. Refactor operand2 handling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <functional>
5 #include <limits> 6 #include <limits>
6 #include "src/v8.h"
7 7
8 #include "test/cctest/cctest.h" 8 #include "test/cctest/cctest.h"
9 #include "test/cctest/compiler/codegen-tester.h" 9 #include "test/cctest/compiler/codegen-tester.h"
10 #include "test/cctest/compiler/value-helper.h" 10 #include "test/cctest/compiler/value-helper.h"
11 11
12 #if V8_TURBOFAN_TARGET 12 #if V8_TURBOFAN_TARGET
13 13
14 using namespace v8::internal; 14 using namespace v8::internal;
15 using namespace v8::internal::compiler; 15 using namespace v8::internal::compiler;
16 16
(...skipping 3656 matching lines...) Expand 10 before | Expand all | Expand 10 after
3673 } 3673 }
3674 m.Return(input); 3674 m.Return(input);
3675 CHECK_EQ(&inputs[kInputSize], m.Call()); 3675 CHECK_EQ(&inputs[kInputSize], m.Call());
3676 for (int i = 0; i < kInputSize; i++) { 3676 for (int i = 0; i < kInputSize; i++) {
3677 CHECK_EQ(i, inputs[i]); 3677 CHECK_EQ(i, inputs[i]);
3678 CHECK_EQ(kInputSize - i - 1, outputs[i]); 3678 CHECK_EQ(kInputSize - i - 1, outputs[i]);
3679 } 3679 }
3680 } 3680 }
3681 3681
3682 3682
3683 static inline uint32_t rotr32(uint32_t i, uint32_t j) {
3684 return (i >> j) | (i << (32 - j));
3685 }
3686
3687
3688 TEST(RunTestInt32RotateRightP) {
3689 {
3690 RawMachineAssemblerTester<int32_t> m;
3691 Int32BinopTester bt(&m);
3692 bt.AddReturn(m.Word32Or(
3693 m.Word32Shr(bt.param0, bt.param1),
3694 m.Word32Shl(bt.param0, m.Int32Sub(m.Int32Constant(32), bt.param1))));
3695 bt.Run(ValueHelper::uint32_vector(), ValueHelper::ror_vector(), rotr32);
3696 }
3697 {
3698 RawMachineAssemblerTester<int32_t> m;
3699 Int32BinopTester bt(&m);
3700 bt.AddReturn(m.Word32Or(
3701 m.Word32Shl(bt.param0, m.Int32Sub(m.Int32Constant(32), bt.param1)),
3702 m.Word32Shr(bt.param0, bt.param1)));
3703 bt.Run(ValueHelper::uint32_vector(), ValueHelper::ror_vector(), rotr32);
3704 }
3705 }
3706
3707
3708 TEST(RunTestInt32RotateRightImm) {
3709 FOR_INPUTS(uint32_t, ror, i) {
3710 {
3711 RawMachineAssemblerTester<int32_t> m(kMachineWord32);
3712 Node* value = m.Parameter(0);
3713 m.Return(m.Word32Or(m.Word32Shr(value, m.Int32Constant(*i)),
3714 m.Word32Shl(value, m.Int32Constant(32 - *i))));
3715 m.Run(ValueHelper::uint32_vector(),
3716 std::bind2nd(std::ptr_fun(&rotr32), *i));
3717 }
3718 {
3719 RawMachineAssemblerTester<int32_t> m(kMachineWord32);
3720 Node* value = m.Parameter(0);
3721 m.Return(m.Word32Or(m.Word32Shl(value, m.Int32Constant(32 - *i)),
3722 m.Word32Shr(value, m.Int32Constant(*i))));
3723 m.Run(ValueHelper::uint32_vector(),
3724 std::bind2nd(std::ptr_fun(&rotr32), *i));
3725 }
3726 }
3727 }
3728
3729
3683 TEST(RunSpillLotsOfThings) { 3730 TEST(RunSpillLotsOfThings) {
3684 static const int kInputSize = 1000; 3731 static const int kInputSize = 1000;
3685 RawMachineAssemblerTester<void> m; 3732 RawMachineAssemblerTester<void> m;
3686 Node* accs[kInputSize]; 3733 Node* accs[kInputSize];
3687 int32_t outputs[kInputSize]; 3734 int32_t outputs[kInputSize];
3688 Node* one = m.Int32Constant(1); 3735 Node* one = m.Int32Constant(1);
3689 Node* acc = one; 3736 Node* acc = one;
3690 for (int i = 0; i < kInputSize; i++) { 3737 for (int i = 0; i < kInputSize; i++) {
3691 acc = m.Int32Add(acc, one); 3738 acc = m.Int32Add(acc, one);
3692 accs[i] = acc; 3739 accs[i] = acc;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
3789 m.Return(one); 3836 m.Return(one);
3790 m.Call(); 3837 m.Call();
3791 for (int i = 0; i < kInputSize; i++) { 3838 for (int i = 0; i < kInputSize; i++) {
3792 CHECK_EQ(outputs[i], i + 2); 3839 CHECK_EQ(outputs[i], i + 2);
3793 } 3840 }
3794 } 3841 }
3795 3842
3796 #endif // MACHINE_ASSEMBLER_SUPPORTS_CALL_C 3843 #endif // MACHINE_ASSEMBLER_SUPPORTS_CALL_C
3797 3844
3798 #endif 3845 #endif
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-instruction-selector-arm.cc ('k') | test/cctest/compiler/value-helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698