[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/+/2000747
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65828}
This commit is contained in:
Santiago Aboy Solanes 2020-01-15 16:38:52 +00:00 committed by Commit Bot
parent b2c5499907
commit 13b148a31f

View File

@ -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() &&