Commit 2798e118 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: [turbofan] Add TruncationMode for TruncateFloat64ToInt32.

Port 4b38c158

Original commit message:
    We actually need round to zero truncation to implement the counterpart
    of LDoubleToI in TurboFan, which tries to convert a double to an integer
    as required for keyed load/store optimizations.

    Drive-by-cleanup: Reduce some code duplication in the InstructionSelector
    implementations.

R=bmeurer@chromium.org, dstence@us.ibm.com, michael_dawson@ca.ibm.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29533}
parent ce8034ba
......@@ -874,26 +874,31 @@ void InstructionSelector::VisitChangeInt32ToInt64(Node* node) {
void InstructionSelector::VisitChangeUint32ToUint64(Node* node) {
// TODO(mbrandy): inspect input to see if nop is appropriate.
PPCOperandGenerator g(this);
Emit(kPPC_Uint32ToUint64, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
VisitRR(this, kPPC_Uint32ToUint64, node);
}
#endif
void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
PPCOperandGenerator g(this);
Emit(kPPC_DoubleToFloat32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
VisitRR(this, kPPC_DoubleToFloat32, node);
}
void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) {
switch (TruncationModeOf(node->op())) {
case TruncationMode::kJavaScript:
return VisitRR(this, kArchTruncateDoubleToI, node);
case TruncationMode::kRoundToZero:
return VisitRR(this, kPPC_DoubleToInt32, node);
}
UNREACHABLE();
}
#if V8_TARGET_ARCH_PPC64
void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) {
PPCOperandGenerator g(this);
// TODO(mbrandy): inspect input to see if nop is appropriate.
Emit(kPPC_Int64ToInt32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
VisitRR(this, kPPC_Int64ToInt32, node);
}
#endif
......
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