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

Side by Side Diff: test/unittests/compiler/instruction-selector-unittest.cc

Issue 671393002: [x86] Fix register constraints for multiply-high. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added regression test. Created 6 years, 2 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 "test/unittests/compiler/instruction-selector-unittest.h" 5 #include "test/unittests/compiler/instruction-selector-unittest.h"
6 6
7 #include "src/compiler/graph-inl.h" 7 #include "src/compiler/graph-inl.h"
8 #include "src/flags.h" 8 #include "src/flags.h"
9 #include "test/unittests/compiler/compiler-test-utils.h" 9 #include "test/unittests/compiler/compiler-test-utils.h"
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 124
125 int InstructionSelectorTest::Stream::ToVreg(const Node* node) const { 125 int InstructionSelectorTest::Stream::ToVreg(const Node* node) const {
126 VirtualRegisters::const_iterator i = virtual_registers_.find(node->id()); 126 VirtualRegisters::const_iterator i = virtual_registers_.find(node->id());
127 CHECK(i != virtual_registers_.end()); 127 CHECK(i != virtual_registers_.end());
128 return i->second; 128 return i->second;
129 } 129 }
130 130
131 131
132 bool InstructionSelectorTest::Stream::IsFixed(const InstructionOperand* operand,
133 Register reg) const {
134 if (!operand->IsUnallocated()) return false;
135 const UnallocatedOperand* unallocated = UnallocatedOperand::cast(operand);
136 if (!unallocated->HasFixedRegisterPolicy()) return false;
137 const int index = Register::ToAllocationIndex(reg);
138 return unallocated->fixed_register_index() == index;
139 }
140
141
142 bool InstructionSelectorTest::Stream::IsUsedAtStart(
143 const InstructionOperand* operand) const {
144 if (!operand->IsUnallocated()) return false;
145 const UnallocatedOperand* unallocated = UnallocatedOperand::cast(operand);
146 return unallocated->IsUsedAtStart();
147 }
148
149
132 // ----------------------------------------------------------------------------- 150 // -----------------------------------------------------------------------------
133 // Return. 151 // Return.
134 152
135 153
136 TARGET_TEST_F(InstructionSelectorTest, ReturnFloat32Constant) { 154 TARGET_TEST_F(InstructionSelectorTest, ReturnFloat32Constant) {
137 const float kValue = 4.2f; 155 const float kValue = 4.2f;
138 StreamBuilder m(this, kMachFloat32); 156 StreamBuilder m(this, kMachFloat32);
139 m.Return(m.Float32Constant(kValue)); 157 m.Return(m.Float32Constant(kValue));
140 Stream s = m.Build(kAllInstructions); 158 Stream s = m.Build(kAllInstructions);
141 ASSERT_EQ(2U, s.size()); 159 ASSERT_EQ(2U, s.size());
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12))); 569 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12)));
552 // Continuation. 570 // Continuation.
553 571
554 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); 572 EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
555 EXPECT_EQ(index, s.size()); 573 EXPECT_EQ(index, s.size());
556 } 574 }
557 575
558 } // namespace compiler 576 } // namespace compiler
559 } // namespace internal 577 } // namespace internal
560 } // namespace v8 578 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698