[ptr-compr][turbofan] Adding tests in Word64Equal decompression when lhs == rhs
This is a border case that appeared in one of our tests. It seems a good idea to test for it. It does not seem to be common enough to handle it specifically (i.e replacing the Word64Equal with a true bool constant) 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:8977, v8:7703 Change-Id: I27e85a2493ab03b92591e788a185d6109904eef1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1613252 Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org> Cr-Commit-Position: refs/heads/master@{#61726}
This commit is contained in:
parent
0fa243af70
commit
e8b5eb4698
@ -303,6 +303,51 @@ TEST_F(DecompressionEliminationTest, TwoDecompressionComparison) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Word64Equal comparison of two decompressions, where lhs == rhs
|
||||||
|
|
||||||
|
TEST_F(DecompressionEliminationTest, TwoDecompressionWord64EqualSameInput) {
|
||||||
|
// Skip test if pointer compression is not enabled
|
||||||
|
if (!COMPRESS_POINTERS_BOOL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define variables
|
||||||
|
Node* const control = graph()->start();
|
||||||
|
Node* object = Parameter(Type::Any(), 0);
|
||||||
|
Node* effect = graph()->start();
|
||||||
|
Node* index = Parameter(Type::UnsignedSmall(), 1);
|
||||||
|
|
||||||
|
const Operator* DecompressionOps[] = {
|
||||||
|
machine()->ChangeCompressedToTagged(),
|
||||||
|
machine()->ChangeCompressedSignedToTaggedSigned(),
|
||||||
|
machine()->ChangeCompressedPointerToTaggedPointer()};
|
||||||
|
|
||||||
|
const ElementAccess ElementAccesses[] = {
|
||||||
|
{kTaggedBase, kTaggedSize, Type::Any(), MachineType::AnyTagged(),
|
||||||
|
kNoWriteBarrier},
|
||||||
|
{kTaggedBase, kTaggedSize, Type::Any(), MachineType::TaggedSigned(),
|
||||||
|
kNoWriteBarrier},
|
||||||
|
{kTaggedBase, kTaggedSize, Type::Any(), MachineType::TaggedPointer(),
|
||||||
|
kNoWriteBarrier}};
|
||||||
|
|
||||||
|
ASSERT_EQ(arraysize(DecompressionOps), arraysize(ElementAccesses));
|
||||||
|
|
||||||
|
// For every decompression (same for lhs and rhs)
|
||||||
|
for (size_t j = 0; j < arraysize(DecompressionOps); ++j) {
|
||||||
|
// Create the graph
|
||||||
|
Node* load = graph()->NewNode(simplified()->LoadElement(ElementAccesses[j]),
|
||||||
|
object, index, effect, control);
|
||||||
|
Node* changeToTagged = graph()->NewNode(DecompressionOps[j], load);
|
||||||
|
Node* comparison = graph()->NewNode(machine()->Word64Equal(),
|
||||||
|
changeToTagged, changeToTagged);
|
||||||
|
// Reduce
|
||||||
|
Reduction r = Reduce(comparison);
|
||||||
|
ASSERT_TRUE(r.Changed());
|
||||||
|
EXPECT_EQ(r.replacement()->opcode(), IrOpcode::kWord32Equal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace compiler
|
} // namespace compiler
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace v8
|
} // namespace v8
|
||||||
|
Loading…
Reference in New Issue
Block a user