Commit 46bf5aa2 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: [turbofan] Add RoundUint32ToFloat32 operator to Turbofan.

Port 187b3f28

R=joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1680833002

Cr-Commit-Position: refs/heads/master@{#33825}
parent 770a1bf5
...@@ -1196,14 +1196,18 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { ...@@ -1196,14 +1196,18 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
break; break;
#endif #endif
case kPPC_Int32ToFloat32: case kPPC_Int32ToFloat32:
__ ConvertIntToFloat(i.OutputDoubleRegister(), i.InputRegister(0), __ ConvertIntToFloat(i.InputRegister(0), i.OutputDoubleRegister());
kScratchReg);
DCHECK_EQ(LeaveRC, i.OutputRCBit()); DCHECK_EQ(LeaveRC, i.OutputRCBit());
break; break;
case kPPC_Int32ToDouble: case kPPC_Int32ToDouble:
__ ConvertIntToDouble(i.InputRegister(0), i.OutputDoubleRegister()); __ ConvertIntToDouble(i.InputRegister(0), i.OutputDoubleRegister());
DCHECK_EQ(LeaveRC, i.OutputRCBit()); DCHECK_EQ(LeaveRC, i.OutputRCBit());
break; break;
case kPPC_Uint32ToFloat32:
__ ConvertUnsignedIntToFloat(i.InputRegister(0),
i.OutputDoubleRegister());
DCHECK_EQ(LeaveRC, i.OutputRCBit());
break;
case kPPC_Uint32ToDouble: case kPPC_Uint32ToDouble:
__ ConvertUnsignedIntToDouble(i.InputRegister(0), __ ConvertUnsignedIntToDouble(i.InputRegister(0),
i.OutputDoubleRegister()); i.OutputDoubleRegister());
......
...@@ -84,6 +84,7 @@ namespace compiler { ...@@ -84,6 +84,7 @@ namespace compiler {
V(PPC_Uint64ToDouble) \ V(PPC_Uint64ToDouble) \
V(PPC_Int32ToFloat32) \ V(PPC_Int32ToFloat32) \
V(PPC_Int32ToDouble) \ V(PPC_Int32ToDouble) \
V(PPC_Uint32ToFloat32) \
V(PPC_Uint32ToDouble) \ V(PPC_Uint32ToDouble) \
V(PPC_Float32ToDouble) \ V(PPC_Float32ToDouble) \
V(PPC_DoubleToInt32) \ V(PPC_DoubleToInt32) \
...@@ -115,7 +116,6 @@ namespace compiler { ...@@ -115,7 +116,6 @@ namespace compiler {
V(PPC_StoreFloat32) \ V(PPC_StoreFloat32) \
V(PPC_StoreDouble) V(PPC_StoreDouble)
// Addressing modes represent the "shape" of inputs to an instruction. // Addressing modes represent the "shape" of inputs to an instruction.
// Many instructions support multiple addressing modes. Addressing modes // Many instructions support multiple addressing modes. Addressing modes
// are encoded into the InstructionCode of the instruction and tell the // are encoded into the InstructionCode of the instruction and tell the
......
...@@ -83,6 +83,7 @@ int InstructionScheduler::GetTargetInstructionFlags( ...@@ -83,6 +83,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_Uint64ToDouble: case kPPC_Uint64ToDouble:
case kPPC_Int32ToFloat32: case kPPC_Int32ToFloat32:
case kPPC_Int32ToDouble: case kPPC_Int32ToDouble:
case kPPC_Uint32ToFloat32:
case kPPC_Uint32ToDouble: case kPPC_Uint32ToDouble:
case kPPC_Float32ToDouble: case kPPC_Float32ToDouble:
case kPPC_DoubleToInt32: case kPPC_DoubleToInt32:
......
...@@ -946,7 +946,7 @@ void InstructionSelector::VisitRoundInt32ToFloat32(Node* node) { ...@@ -946,7 +946,7 @@ void InstructionSelector::VisitRoundInt32ToFloat32(Node* node) {
void InstructionSelector::VisitRoundUint32ToFloat32(Node* node) { void InstructionSelector::VisitRoundUint32ToFloat32(Node* node) {
UNIMPLEMENTED(); VisitRR(this, kPPC_Uint32ToFloat32, node);
} }
......
...@@ -716,28 +716,27 @@ void MacroAssembler::CanonicalizeNaN(const DoubleRegister dst, ...@@ -716,28 +716,27 @@ void MacroAssembler::CanonicalizeNaN(const DoubleRegister dst,
fsub(dst, src, kDoubleRegZero); fsub(dst, src, kDoubleRegZero);
} }
void MacroAssembler::ConvertIntToDouble(Register src, DoubleRegister dst) {
void MacroAssembler::ConvertIntToDouble(Register src, MovIntToDouble(dst, src, r0);
DoubleRegister double_dst) { fcfid(dst, dst);
MovIntToDouble(double_dst, src, r0);
fcfid(double_dst, double_dst);
} }
void MacroAssembler::ConvertUnsignedIntToDouble(Register src, void MacroAssembler::ConvertUnsignedIntToDouble(Register src,
DoubleRegister double_dst) { DoubleRegister dst) {
MovUnsignedIntToDouble(double_dst, src, r0); MovUnsignedIntToDouble(dst, src, r0);
fcfid(double_dst, double_dst); fcfid(dst, dst);
} }
void MacroAssembler::ConvertIntToFloat(Register src, DoubleRegister dst) {
void MacroAssembler::ConvertIntToFloat(const DoubleRegister dst, MovIntToDouble(dst, src, r0);
const Register src,
const Register int_scratch) {
MovIntToDouble(dst, src, int_scratch);
fcfids(dst, dst); fcfids(dst, dst);
} }
void MacroAssembler::ConvertUnsignedIntToFloat(Register src,
DoubleRegister dst) {
MovUnsignedIntToDouble(dst, src, r0);
fcfids(dst, dst);
}
#if V8_TARGET_ARCH_PPC64 #if V8_TARGET_ARCH_PPC64
void MacroAssembler::ConvertInt64ToDouble(Register src, void MacroAssembler::ConvertInt64ToDouble(Register src,
......
...@@ -375,18 +375,20 @@ class MacroAssembler : public Assembler { ...@@ -375,18 +375,20 @@ class MacroAssembler : public Assembler {
} }
// Converts the integer (untagged smi) in |src| to a double, storing // Converts the integer (untagged smi) in |src| to a double, storing
// the result to |double_dst| // the result to |dst|
void ConvertIntToDouble(Register src, DoubleRegister double_dst); void ConvertIntToDouble(Register src, DoubleRegister dst);
// Converts the unsigned integer (untagged smi) in |src| to // Converts the unsigned integer (untagged smi) in |src| to
// a double, storing the result to |double_dst| // a double, storing the result to |dst|
void ConvertUnsignedIntToDouble(Register src, DoubleRegister double_dst); void ConvertUnsignedIntToDouble(Register src, DoubleRegister dst);
// Converts the integer (untagged smi) in |src| to // Converts the integer (untagged smi) in |src| to
// a float, storing the result in |dst| // a float, storing the result in |dst|
// Warning: The value in |int_scrach| will be changed in the process! void ConvertIntToFloat(Register src, DoubleRegister dst);
void ConvertIntToFloat(const DoubleRegister dst, const Register src,
const Register int_scratch); // Converts the unsigned integer (untagged smi) in |src| to
// a float, storing the result in |dst|
void ConvertUnsignedIntToFloat(Register src, DoubleRegister dst);
#if V8_TARGET_ARCH_PPC64 #if V8_TARGET_ARCH_PPC64
void ConvertInt64ToFloat(Register src, DoubleRegister double_dst); void ConvertInt64ToFloat(Register src, DoubleRegister double_dst);
......
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