OLD | NEW |
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 <list> | 5 #include <list> |
6 | 6 |
7 #include "test/compiler-unittests/instruction-selector-unittest.h" | 7 #include "test/compiler-unittests/instruction-selector-unittest.h" |
8 | 8 |
9 #include "test/cctest/compiler/instruction-selector-tester.h" | 9 #include "test/cctest/compiler/instruction-selector-tester.h" |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 {&RawMachineAssembler::Int64Div, "Int64Div", kArm64Idiv}, | 70 {&RawMachineAssembler::Int64Div, "Int64Div", kArm64Idiv}, |
71 {&RawMachineAssembler::Int32UDiv, "Int32UDiv", kArm64Udiv32}, | 71 {&RawMachineAssembler::Int32UDiv, "Int32UDiv", kArm64Udiv32}, |
72 {&RawMachineAssembler::Int64UDiv, "Int64UDiv", kArm64Udiv}}; | 72 {&RawMachineAssembler::Int64UDiv, "Int64UDiv", kArm64Udiv}}; |
73 | 73 |
74 } // namespace | 74 } // namespace |
75 | 75 |
76 | 76 |
77 // TODO(all): Use TEST_P, see instruction-selector-arm-unittest.cc. | 77 // TODO(all): Use TEST_P, see instruction-selector-arm-unittest.cc. |
78 TEST_F(InstructionSelectorTest, LogicalWithParameter) { | 78 TEST_F(InstructionSelectorTest, LogicalWithParameter) { |
79 TRACED_FOREACH(DPI, dpi, kLogicalInstructions) { | 79 TRACED_FOREACH(DPI, dpi, kLogicalInstructions) { |
80 StreamBuilder m(this, kMachineWord32, kMachineWord32, kMachineWord32); | 80 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
81 m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1))); | 81 m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1))); |
82 Stream s = m.Build(); | 82 Stream s = m.Build(); |
83 ASSERT_EQ(1U, s.size()); | 83 ASSERT_EQ(1U, s.size()); |
84 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); | 84 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 // TODO(all): Use TEST_P, see instruction-selector-arm-unittest.cc. | 89 // TODO(all): Use TEST_P, see instruction-selector-arm-unittest.cc. |
90 TEST_F(InstructionSelectorTest, AddSubWithParameter) { | 90 TEST_F(InstructionSelectorTest, AddSubWithParameter) { |
91 TRACED_FOREACH(DPI, dpi, kAddSubInstructions) { | 91 TRACED_FOREACH(DPI, dpi, kAddSubInstructions) { |
92 StreamBuilder m(this, kMachineWord32, kMachineWord32, kMachineWord32); | 92 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
93 m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1))); | 93 m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1))); |
94 Stream s = m.Build(); | 94 Stream s = m.Build(); |
95 ASSERT_EQ(1U, s.size()); | 95 ASSERT_EQ(1U, s.size()); |
96 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); | 96 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 // TODO(all): Use TEST_P, see instruction-selector-arm-unittest.cc. | 101 // TODO(all): Use TEST_P, see instruction-selector-arm-unittest.cc. |
102 TEST_F(InstructionSelectorTest, AddSubWithImmediate) { | 102 TEST_F(InstructionSelectorTest, AddSubWithImmediate) { |
103 AddSubImmediates immediates; | 103 AddSubImmediates immediates; |
104 TRACED_FOREACH(DPI, dpi, kAddSubInstructions) { | 104 TRACED_FOREACH(DPI, dpi, kAddSubInstructions) { |
105 for (AddSubImmediates::const_iterator j = immediates.begin(); | 105 for (AddSubImmediates::const_iterator j = immediates.begin(); |
106 j != immediates.end(); ++j) { | 106 j != immediates.end(); ++j) { |
107 int32_t imm = *j; | 107 int32_t imm = *j; |
108 SCOPED_TRACE(::testing::Message() << "imm = " << imm); | 108 SCOPED_TRACE(::testing::Message() << "imm = " << imm); |
109 StreamBuilder m(this, kMachineWord32, kMachineWord32); | 109 StreamBuilder m(this, kMachInt32, kMachInt32); |
110 m.Return((m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm))); | 110 m.Return((m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm))); |
111 Stream s = m.Build(); | 111 Stream s = m.Build(); |
112 ASSERT_EQ(1U, s.size()); | 112 ASSERT_EQ(1U, s.size()); |
113 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); | 113 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); |
114 EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate()); | 114 EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate()); |
115 } | 115 } |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 | 119 |
120 // TODO(all): Use TEST_P, see instruction-selector-arm-unittest.cc. | 120 // TODO(all): Use TEST_P, see instruction-selector-arm-unittest.cc. |
121 TEST_F(InstructionSelectorTest, MulDivWithParameter) { | 121 TEST_F(InstructionSelectorTest, MulDivWithParameter) { |
122 TRACED_FOREACH(DPI, dpi, kMulDivInstructions) { | 122 TRACED_FOREACH(DPI, dpi, kMulDivInstructions) { |
123 StreamBuilder m(this, kMachineWord32, kMachineWord32, kMachineWord32); | 123 StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32); |
124 m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1))); | 124 m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1))); |
125 Stream s = m.Build(); | 125 Stream s = m.Build(); |
126 ASSERT_EQ(1U, s.size()); | 126 ASSERT_EQ(1U, s.size()); |
127 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); | 127 EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 } // namespace compiler | 131 } // namespace compiler |
132 } // namespace internal | 132 } // namespace internal |
133 } // namespace v8 | 133 } // namespace v8 |
OLD | NEW |