Commit 4d8bcd11 authored by jyan's avatar jyan Committed by Commit bot

S390: 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/2036523003
Cr-Commit-Position: refs/heads/master@{#36691}
parent 70e302ee
...@@ -1318,8 +1318,13 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1318,8 +1318,13 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
int num_slots = i.InputInt32(1); int num_slots = i.InputInt32(1);
__ lay(sp, MemOperand(sp, -num_slots * kPointerSize)); __ lay(sp, MemOperand(sp, -num_slots * kPointerSize));
if (instr->InputAt(0)->IsFPRegister()) { if (instr->InputAt(0)->IsFPRegister()) {
__ StoreDouble(i.InputDoubleRegister(0), LocationOperand* op = LocationOperand::cast(instr->InputAt(0));
MemOperand(sp)); if (op->representation() == MachineRepresentation::kFloat64) {
__ StoreDouble(i.InputDoubleRegister(0), MemOperand(sp));
} else {
DCHECK(op->representation() == MachineRepresentation::kFloat32);
__ StoreFloat32(i.InputDoubleRegister(0), MemOperand(sp));
}
} else { } else {
__ StoreP(i.InputRegister(0), __ StoreP(i.InputRegister(0),
MemOperand(sp)); MemOperand(sp));
...@@ -1329,8 +1334,15 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( ...@@ -1329,8 +1334,15 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kS390_StoreToStackSlot: { case kS390_StoreToStackSlot: {
int slot = i.InputInt32(1); int slot = i.InputInt32(1);
if (instr->InputAt(0)->IsFPRegister()) { if (instr->InputAt(0)->IsFPRegister()) {
__ StoreDouble(i.InputDoubleRegister(0), LocationOperand* op = LocationOperand::cast(instr->InputAt(0));
MemOperand(sp, slot * kPointerSize)); if (op->representation() == MachineRepresentation::kFloat64) {
__ StoreDouble(i.InputDoubleRegister(0),
MemOperand(sp, slot * kPointerSize));
} else {
DCHECK(op->representation() == MachineRepresentation::kFloat32);
__ StoreFloat32(i.InputDoubleRegister(0),
MemOperand(sp, slot * kPointerSize));
}
} else { } else {
__ StoreP(i.InputRegister(0), MemOperand(sp, slot * kPointerSize)); __ StoreP(i.InputRegister(0), MemOperand(sp, slot * kPointerSize));
} }
...@@ -2017,17 +2029,33 @@ void CodeGenerator::AssembleMove(InstructionOperand* source, ...@@ -2017,17 +2029,33 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
__ Move(dst, src); __ Move(dst, src);
} else { } else {
DCHECK(destination->IsFPStackSlot()); DCHECK(destination->IsFPStackSlot());
__ StoreDouble(src, g.ToMemOperand(destination)); LocationOperand* op = LocationOperand::cast(source);
if (op->representation() == MachineRepresentation::kFloat64) {
__ StoreDouble(src, g.ToMemOperand(destination));
} else {
__ StoreFloat32(src, g.ToMemOperand(destination));
}
} }
} else if (source->IsFPStackSlot()) { } else if (source->IsFPStackSlot()) {
DCHECK(destination->IsFPRegister() || destination->IsFPStackSlot()); DCHECK(destination->IsFPRegister() || destination->IsFPStackSlot());
MemOperand src = g.ToMemOperand(source); MemOperand src = g.ToMemOperand(source);
if (destination->IsFPRegister()) { if (destination->IsFPRegister()) {
__ LoadDouble(g.ToDoubleRegister(destination), src); LocationOperand* op = LocationOperand::cast(source);
if (op->representation() == MachineRepresentation::kFloat64) {
__ LoadDouble(g.ToDoubleRegister(destination), src);
} else {
__ LoadFloat32(g.ToDoubleRegister(destination), src);
}
} else { } else {
LocationOperand* op = LocationOperand::cast(source);
DoubleRegister temp = kScratchDoubleReg; DoubleRegister temp = kScratchDoubleReg;
__ LoadDouble(temp, src); if (op->representation() == MachineRepresentation::kFloat64) {
__ StoreDouble(temp, g.ToMemOperand(destination)); __ LoadDouble(temp, src);
__ StoreDouble(temp, g.ToMemOperand(destination));
} else {
__ LoadFloat32(temp, src);
__ StoreFloat32(temp, g.ToMemOperand(destination));
}
} }
} else { } else {
UNREACHABLE(); 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