Commit fc59eb8a authored by bbudge's avatar bbudge Committed by Commit bot

[tests] Don't test moves between different reps in test-gap-resolver.cc

Moves between operands with different representations shouldn't happen,
so don't test them. This makes it easier to modify canonicalization to
differentiate between floating point types, which is needed to support
floating point register aliasing for ARM and MIPS.

This change also expands tests to include explicit FP moves (both register and stack slot).

LOG=N
BUG=v8:4124

Review-Url: https://codereview.chromium.org/2060273003
Cr-Commit-Position: refs/heads/master@{#36963}
parent fd20e49f
......@@ -167,8 +167,10 @@ class ParallelMoveCreator : public HandleAndZoneScope {
ParallelMove* Create(int size) {
ParallelMove* parallel_move = new (main_zone()) ParallelMove(main_zone());
std::set<InstructionOperand, CompareOperandModuloType> seen;
MachineRepresentation rep = RandomRepresentation();
for (int i = 0; i < size; ++i) {
MoveOperands mo(CreateRandomOperand(true), CreateRandomOperand(false));
MoveOperands mo(CreateRandomOperand(true, rep),
CreateRandomOperand(false, rep));
if (!mo.IsRedundant() && seen.find(mo.destination()) == seen.end()) {
parallel_move->AddMove(mo.source(), mo.destination());
seen.insert(mo.destination());
......@@ -179,52 +181,43 @@ class ParallelMoveCreator : public HandleAndZoneScope {
private:
MachineRepresentation RandomRepresentation() {
int index = rng_->NextInt(3);
int index = rng_->NextInt(5);
switch (index) {
case 0:
return MachineRepresentation::kWord32;
case 1:
return MachineRepresentation::kWord64;
case 2:
return MachineRepresentation::kFloat32;
case 3:
return MachineRepresentation::kFloat64;
case 4:
return MachineRepresentation::kTagged;
}
UNREACHABLE();
return MachineRepresentation::kNone;
}
MachineRepresentation RandomDoubleRepresentation() {
int index = rng_->NextInt(2);
if (index == 0) return MachineRepresentation::kFloat64;
return MachineRepresentation::kFloat32;
}
InstructionOperand CreateRandomOperand(bool is_source) {
InstructionOperand CreateRandomOperand(bool is_source,
MachineRepresentation rep) {
int index = rng_->NextInt(7);
// destination can't be Constant.
switch (rng_->NextInt(is_source ? 7 : 6)) {
switch (rng_->NextInt(is_source ? 5 : 4)) {
case 0:
return AllocatedOperand(LocationOperand::STACK_SLOT,
RandomRepresentation(), index);
return AllocatedOperand(LocationOperand::STACK_SLOT, rep, index);
case 1:
return AllocatedOperand(LocationOperand::STACK_SLOT,
RandomDoubleRepresentation(), index);
return AllocatedOperand(LocationOperand::REGISTER, rep, index);
case 2:
return AllocatedOperand(LocationOperand::REGISTER,
RandomRepresentation(), index);
case 3:
return AllocatedOperand(LocationOperand::REGISTER,
RandomDoubleRepresentation(), index);
case 4:
return ExplicitOperand(
LocationOperand::REGISTER, RandomRepresentation(),
LocationOperand::REGISTER, rep,
RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
->GetAllocatableGeneralCode(1));
case 5:
case 3:
return ExplicitOperand(
LocationOperand::STACK_SLOT, RandomRepresentation(),
LocationOperand::STACK_SLOT, rep,
RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
->GetAllocatableGeneralCode(index));
case 6:
case 4:
return ConstantOperand(index);
}
UNREACHABLE();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment