Commit 13b148a3 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[turbofan][CSA] Skip TruncateInt64ToInt32 before Int32Add

Since:
 1) The Int32Add will only look at the lower bits
 2) The output of this instruction will clear the top
    bits (in the same way that the movl does)

then the truncation is not needed.

Change-Id: Ic611ce435ff6216ce8b75bb7316af4372e3290e5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2000747Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65828}
parent b2c54999
......@@ -942,6 +942,17 @@ void InstructionSelector::VisitSimd128ReverseBytes(Node* node) {
void InstructionSelector::VisitInt32Add(Node* node) {
X64OperandGenerator g(this);
// No need to truncate the values before Int32Add.
DCHECK_EQ(node->InputCount(), 2);
Node* left = node->InputAt(0);
Node* right = node->InputAt(1);
if (left->opcode() == IrOpcode::kTruncateInt64ToInt32) {
node->ReplaceInput(0, left->InputAt(0));
}
if (right->opcode() == IrOpcode::kTruncateInt64ToInt32) {
node->ReplaceInput(1, right->InputAt(0));
}
// Try to match the Add to a leal pattern
BaseWithIndexAndDisplacement32Matcher m(node);
if (m.matches() &&
......
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