Commit 8af394d6 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Better representation selection for comparison with Float64.

For speculative number comparisons with SignedSmall feedback, we always
enforce either TaggedSigned or Word32 comparisons. But this is not
really beneficial if one of the inputs is already in Float64
representation; in that case it's cheaper to just convert the other
input to a Float64.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2790833004
Cr-Commit-Position: refs/heads/master@{#44327}
parent 12faf0f8
......@@ -701,6 +701,11 @@ class RepresentationSelector {
GetUpperBound(node->InputAt(1))->Is(type);
}
bool IsNodeRepresentationFloat64(Node* node) {
MachineRepresentation representation = GetInfo(node)->representation();
return representation == MachineRepresentation::kFloat64;
}
bool IsNodeRepresentationTagged(Node* node) {
MachineRepresentation representation = GetInfo(node)->representation();
return IsAnyTagged(representation);
......@@ -1619,6 +1624,15 @@ class RepresentationSelector {
ChangeToPureOp(
node, changer_->TaggedSignedOperatorFor(node->opcode()));
} else if (IsNodeRepresentationFloat64(lhs) ||
IsNodeRepresentationFloat64(rhs)) {
// If one side is already a Float64, it's pretty expensive to
// do the comparison in Word32, since that means we need a
// checked conversion from Float64 to Word32. It's cheaper to
// just go to Float64 for the comparison.
VisitBinop(node, UseInfo::CheckedNumberAsFloat64(),
MachineRepresentation::kBit);
ChangeToPureOp(node, Float64Op(node));
} else {
VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
MachineRepresentation::kBit);
......
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