Commit bda32bcb authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[ptr-compr] Specialize CompressedSigned -> Word32 conversion

This CL aims to address the regressions that we saw in Octane 2.1,
particularly in the DeltaBlue test.

This CL brings a 5% improvement in said test by doing
CompressedSigned -> Word32 conversion (instead of
CompressedSigned -> TaggedSigned -> Word32).

There seems to be room for optimizations doing more specialized conversions
regarding representation changes.

Cq-Include-Trybots: luci.v8.try:v8_linux64_pointer_compression_rel_ng
Cq-Include-Trybots: luci.v8.try:v8_linux64_arm64_pointer_compression_rel_ng
Bug: v8:7703
Change-Id: I24e5b6c06436fdda9fa6a1ac4699dc55c3d67abd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1684075
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62557}
parent af4905d3
......@@ -58,6 +58,7 @@ class EffectControlLinearizer {
Node* LowerChangeUint64ToTagged(Node* node);
Node* LowerChangeFloat64ToTagged(Node* node);
Node* LowerChangeFloat64ToTaggedPointer(Node* node);
Node* LowerChangeCompressedSignedToInt32(Node* node);
Node* LowerChangeTaggedSignedToInt32(Node* node);
Node* LowerChangeTaggedSignedToInt64(Node* node);
Node* LowerChangeTaggedToBit(Node* node);
......@@ -228,6 +229,7 @@ class EffectControlLinearizer {
Node* ChangeUint32ToUintPtr(Node* value);
Node* ChangeUint32ToSmi(Node* value);
Node* ChangeSmiToIntPtr(Node* value);
Node* ChangeCompressedSmiToInt32(Node* value);
Node* ChangeSmiToInt32(Node* value);
Node* ChangeSmiToInt64(Node* value);
Node* ObjectIsSmi(Node* value);
......@@ -854,6 +856,9 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kChangeFloat64ToTaggedPointer:
result = LowerChangeFloat64ToTaggedPointer(node);
break;
case IrOpcode::kChangeCompressedSignedToInt32:
result = LowerChangeCompressedSignedToInt32(node);
break;
case IrOpcode::kChangeTaggedSignedToInt32:
result = LowerChangeTaggedSignedToInt32(node);
break;
......@@ -1485,6 +1490,11 @@ Node* EffectControlLinearizer::LowerChangeTaggedSignedToInt32(Node* node) {
return ChangeSmiToInt32(value);
}
Node* EffectControlLinearizer::LowerChangeCompressedSignedToInt32(Node* node) {
Node* value = node->InputAt(0);
return ChangeCompressedSmiToInt32(value);
}
Node* EffectControlLinearizer::LowerChangeTaggedSignedToInt64(Node* node) {
Node* value = node->InputAt(0);
return ChangeSmiToInt64(value);
......@@ -4459,6 +4469,11 @@ Node* EffectControlLinearizer::ChangeSmiToInt32(Node* value) {
return ChangeSmiToIntPtr(value);
}
Node* EffectControlLinearizer::ChangeCompressedSmiToInt32(Node* value) {
CHECK(machine()->Is64() && SmiValuesAre31Bits());
return __ Word32Sar(value, SmiShiftBitsConstant());
}
Node* EffectControlLinearizer::ChangeSmiToInt64(Node* value) {
CHECK(machine()->Is64());
return ChangeSmiToIntPtr(value);
......
......@@ -232,6 +232,7 @@
// Opcodes for VirtuaMachine-level operators.
#define SIMPLIFIED_CHANGE_OP_LIST(V) \
V(ChangeCompressedSignedToInt32) \
V(ChangeTaggedSignedToInt32) \
V(ChangeTaggedSignedToInt64) \
V(ChangeTaggedToInt32) \
......
......@@ -1089,11 +1089,15 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
output_type, use_node, use_info);
} else if (output_rep == MachineRepresentation::kCompressedSigned) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedSignedToTaggedSigned();
node = jsgraph()->graph()->NewNode(op, node);
return GetWord32RepresentationFor(node,
MachineRepresentation::kTaggedSigned,
output_type, use_node, use_info);
if (output_type.Is(Type::SignedSmall())) {
op = simplified()->ChangeCompressedSignedToInt32();
} else {
op = machine()->ChangeCompressedSignedToTaggedSigned();
node = jsgraph()->graph()->NewNode(op, node);
return GetWord32RepresentationFor(node,
MachineRepresentation::kTaggedSigned,
output_type, use_node, use_info);
}
} else if (output_rep == MachineRepresentation::kCompressedPointer) {
// TODO(v8:8977): Specialise here
op = machine()->ChangeCompressedPointerToTaggedPointer();
......
......@@ -720,6 +720,7 @@ bool operator==(CheckMinusZeroParameters const& lhs,
V(PlainPrimitiveToNumber, Operator::kNoProperties, 1, 0) \
V(PlainPrimitiveToWord32, Operator::kNoProperties, 1, 0) \
V(PlainPrimitiveToFloat64, Operator::kNoProperties, 1, 0) \
V(ChangeCompressedSignedToInt32, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedSignedToInt32, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedSignedToInt64, Operator::kNoProperties, 1, 0) \
V(ChangeTaggedToInt32, Operator::kNoProperties, 1, 0) \
......
......@@ -695,6 +695,7 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
const Operator* PlainPrimitiveToWord32();
const Operator* PlainPrimitiveToFloat64();
const Operator* ChangeCompressedSignedToInt32();
const Operator* ChangeTaggedSignedToInt32();
const Operator* ChangeTaggedSignedToInt64();
const Operator* ChangeTaggedToInt32();
......
......@@ -1320,6 +1320,7 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
CheckNotTyped(node);
break;
case IrOpcode::kChangeCompressedSignedToInt32:
case IrOpcode::kChangeTaggedSignedToInt32: {
// Signed32 /\ Tagged -> Signed32 /\ UntaggedInt32
// TODO(neis): Activate once ChangeRepresentation works in typer.
......
......@@ -53,6 +53,7 @@ const PureOperator kPureOperators[] = {
PURE(NumberShiftRightLogical, Operator::kNoProperties, 2),
PURE(NumberToInt32, Operator::kNoProperties, 1),
PURE(NumberToUint32, Operator::kNoProperties, 1),
PURE(ChangeCompressedSignedToInt32, Operator::kNoProperties, 1),
PURE(ChangeTaggedSignedToInt32, Operator::kNoProperties, 1),
PURE(ChangeTaggedToInt32, Operator::kNoProperties, 1),
PURE(ChangeTaggedToUint32, Operator::kNoProperties, 1),
......
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