[llvm] r294186 - [DAGCombiner] (add X, (adde Y, 0, Carry)) -> (adde X, Y, Carry)
Amaury Sechet via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 6 06:28:40 PST 2017
Author: deadalnix
Date: Mon Feb 6 08:28:39 2017
New Revision: 294186
URL: http://llvm.org/viewvc/llvm-project?rev=294186&view=rev
Log:
[DAGCombiner] (add X, (adde Y, 0, Carry)) -> (adde X, Y, Carry)
Summary: This is extracted from D29443 .
Reviewers: mkuper, spatel, RKSimon, zvi, bkramer
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D29564
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/trunk/test/CodeGen/X86/adde-carry.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=294186&r1=294185&r2=294186&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Feb 6 08:28:39 2017
@@ -1834,6 +1834,12 @@ SDValue DAGCombiner::visitADDLike(SDValu
}
}
+ // (add X, (adde Y, 0, Carry)) -> (adde X, Y, Carry)
+ if (N1.getOpcode() == ISD::ADDE && N1->hasOneUse() &&
+ isNullConstant(N1.getOperand(1)))
+ return DAG.getNode(ISD::ADDE, DL, DAG.getVTList(VT, MVT::Glue),
+ N0, N1->getOperand(0), N1->getOperand(2));
+
return SDValue();
}
Modified: llvm/trunk/test/CodeGen/X86/adde-carry.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/adde-carry.ll?rev=294186&r1=294185&r2=294186&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/adde-carry.ll (original)
+++ llvm/trunk/test/CodeGen/X86/adde-carry.ll Mon Feb 6 08:28:39 2017
@@ -93,17 +93,16 @@ define %scalar @pr31719(%scalar* nocaptu
; CHECK-NEXT: sbbq %r10, %r10
; CHECK-NEXT: andl $1, %r10d
; CHECK-NEXT: addq 8(%rsi), %rcx
-; CHECK-NEXT: sbbq %r11, %r11
-; CHECK-NEXT: andl $1, %r11d
-; CHECK-NEXT: addq %r10, %rcx
-; CHECK-NEXT: adcq $0, %r11
-; CHECK-NEXT: addq 16(%rsi), %r8
; CHECK-NEXT: sbbq %rax, %rax
; CHECK-NEXT: andl $1, %eax
-; CHECK-NEXT: addq %r11, %r8
+; CHECK-NEXT: addq %r10, %rcx
; CHECK-NEXT: adcq $0, %rax
+; CHECK-NEXT: addq 16(%rsi), %r8
+; CHECK-NEXT: sbbq %r10, %r10
+; CHECK-NEXT: andl $1, %r10d
; CHECK-NEXT: addq 24(%rsi), %r9
-; CHECK-NEXT: addq %rax, %r9
+; CHECK-NEXT: addq %rax, %r8
+; CHECK-NEXT: adcq %r10, %r9
; CHECK-NEXT: movq %rdx, (%rdi)
; CHECK-NEXT: movq %rcx, 8(%rdi)
; CHECK-NEXT: movq %r8, 16(%rdi)
More information about the llvm-commits
mailing list