Commit d048ed80 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC: Store Floats as 4 bytes and Double as 8 bytes for codegen

R=joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com, bjaideep@ca.ibm.com

BUG=

Review-Url: https://codereview.chromium.org/2043553002
Cr-Commit-Position: refs/heads/master@{#36749}
parent 0b919529
......@@ -1340,8 +1340,15 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kPPC_PushFrame: {
int num_slots = i.InputInt32(1);
if (instr->InputAt(0)->IsFPRegister()) {
__ StoreDoubleU(i.InputDoubleRegister(0),
LocationOperand* op = LocationOperand::cast(instr->InputAt(0));
if (op->representation() == MachineRepresentation::kFloat64) {
__ StoreDoubleU(i.InputDoubleRegister(0),
MemOperand(sp, -num_slots * kPointerSize), r0);
} else {
DCHECK(op->representation() == MachineRepresentation::kFloat32);
__ StoreSingleU(i.InputDoubleRegister(0),
MemOperand(sp, -num_slots * kPointerSize), r0);
}
} else {
__ StorePU(i.InputRegister(0),
MemOperand(sp, -num_slots * kPointerSize), r0);
......@@ -1351,8 +1358,15 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kPPC_StoreToStackSlot: {
int slot = i.InputInt32(1);
if (instr->InputAt(0)->IsFPRegister()) {
__ StoreDouble(i.InputDoubleRegister(0),
MemOperand(sp, slot * kPointerSize), r0);
LocationOperand* op = LocationOperand::cast(instr->InputAt(0));
if (op->representation() == MachineRepresentation::kFloat64) {
__ StoreDouble(i.InputDoubleRegister(0),
MemOperand(sp, slot * kPointerSize), r0);
} else {
DCHECK(op->representation() == MachineRepresentation::kFloat32);
__ StoreSingle(i.InputDoubleRegister(0),
MemOperand(sp, slot * kPointerSize), r0);
}
} else {
__ StoreP(i.InputRegister(0), MemOperand(sp, slot * kPointerSize), r0);
}
......@@ -2016,17 +2030,33 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
__ Move(dst, src);
} else {
DCHECK(destination->IsFPStackSlot());
__ StoreDouble(src, g.ToMemOperand(destination), r0);
LocationOperand* op = LocationOperand::cast(source);
if (op->representation() == MachineRepresentation::kFloat64) {
__ StoreDouble(src, g.ToMemOperand(destination), r0);
} else {
__ StoreSingle(src, g.ToMemOperand(destination), r0);
}
}
} else if (source->IsFPStackSlot()) {
DCHECK(destination->IsFPRegister() || destination->IsFPStackSlot());
MemOperand src = g.ToMemOperand(source);
if (destination->IsFPRegister()) {
__ LoadDouble(g.ToDoubleRegister(destination), src, r0);
LocationOperand* op = LocationOperand::cast(source);
if (op->representation() == MachineRepresentation::kFloat64) {
__ LoadDouble(g.ToDoubleRegister(destination), src, r0);
} else {
__ LoadSingle(g.ToDoubleRegister(destination), src, r0);
}
} else {
LocationOperand* op = LocationOperand::cast(source);
DoubleRegister temp = kScratchDoubleReg;
__ LoadDouble(temp, src, r0);
__ StoreDouble(temp, g.ToMemOperand(destination), r0);
if (op->representation() == MachineRepresentation::kFloat64) {
__ LoadDouble(temp, src, r0);
__ StoreDouble(temp, g.ToMemOperand(destination), r0);
} else {
__ LoadSingle(temp, src, r0);
__ StoreSingle(temp, g.ToMemOperand(destination), r0);
}
}
} else {
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