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

Unified Diff: test/unittests/compiler/move-optimizer-unittest.cc

Issue 2400513002: [Turbofan] Allow FP operands and vregs in InstructionSequenceTest. (Closed)
Patch Set: Rebase. Created 4 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 side-by-side diff with in-line comments
Download patch
Index: test/unittests/compiler/move-optimizer-unittest.cc
diff --git a/test/unittests/compiler/move-optimizer-unittest.cc b/test/unittests/compiler/move-optimizer-unittest.cc
index 4c693846670393cb3e34fb1d8cd2a2f73d65d160..378eb59c5bb9fdb604fe00269708857356632027 100644
--- a/test/unittests/compiler/move-optimizer-unittest.cc
+++ b/test/unittests/compiler/move-optimizer-unittest.cc
@@ -61,6 +61,8 @@ class MoveOptimizerTest : public InstructionSequenceTest {
}
private:
+ bool DoesRegisterAllocation() override { return false; }
+
InstructionOperand ConvertMoveArg(TestOperand op) {
CHECK_EQ(kNoValue, op.vreg_.value_);
CHECK_NE(kNoValue, op.value_);
@@ -70,14 +72,16 @@ class MoveOptimizerTest : public InstructionSequenceTest {
case kFixedSlot:
return AllocatedOperand(LocationOperand::STACK_SLOT,
MachineRepresentation::kWord32, op.value_);
- case kFixedRegister:
- CHECK(0 <= op.value_ && op.value_ < num_general_registers());
- return AllocatedOperand(LocationOperand::REGISTER,
- MachineRepresentation::kWord32, op.value_);
- case kExplicit:
- CHECK(0 <= op.value_ && op.value_ < num_general_registers());
- return ExplicitOperand(LocationOperand::REGISTER,
- MachineRepresentation::kWord32, op.value_);
+ case kFixedRegister: {
+ MachineRepresentation rep = GetCanonicalRep(op);
+ CHECK(0 <= op.value_ && op.value_ < GetNumRegs(rep));
+ return AllocatedOperand(LocationOperand::REGISTER, rep, op.value_);
+ }
+ case kExplicit: {
+ MachineRepresentation rep = GetCanonicalRep(op);
+ CHECK(0 <= op.value_ && op.value_ < GetNumRegs(rep));
+ return ExplicitOperand(LocationOperand::REGISTER, rep, op.value_);
+ }
default:
break;
}
@@ -93,14 +97,19 @@ TEST_F(MoveOptimizerTest, RemovesRedundant) {
AddMove(first_instr, Reg(0), Reg(1));
auto last_instr = EmitNop();
AddMove(last_instr, Reg(1), Reg(0));
+
+ AddMove(first_instr, FPReg(kFloat64, 0), FPReg(kFloat64, 1));
+ AddMove(last_instr, FPReg(kFloat64, 1), FPReg(kFloat64, 0));
+
EndBlock(Last());
Optimize();
CHECK_EQ(0, NonRedundantSize(first_instr->parallel_moves()[0]));
auto move = last_instr->parallel_moves()[0];
- CHECK_EQ(1, NonRedundantSize(move));
+ CHECK_EQ(2, NonRedundantSize(move));
CHECK(Contains(move, Reg(0), Reg(1)));
+ CHECK(Contains(move, FPReg(kFloat64, 0), FPReg(kFloat64, 1)));
}
@@ -325,7 +334,8 @@ TEST_F(MoveOptimizerTest, ClobberedDestinationsAreEliminated) {
EmitNop();
Instruction* first_instr = LastInstruction();
AddMove(first_instr, Reg(0), Reg(1));
- EmitOI(Reg(1), 0, nullptr);
+ AddMove(first_instr, FPReg(kFloat64, 0), FPReg(kFloat64, 1));
+ EmitOOI(Reg(1), FPReg(kFloat64, 1), 0, nullptr);
Instruction* last_instr = LastInstruction();
EndBlock();
Optimize();

Powered by Google App Engine
This is Rietveld 408576698