[PATCH] D29564: [DAGCombiner] (add X, (adde Y, 0, Carry)) -> (adde X, Y, Carry)
Amaury SECHET via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 6 06:40:06 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294186: [DAGCombiner] (add X, (adde Y, 0, Carry)) -> (adde X, Y, Carry) (authored by deadalnix).
Changed prior to commit:
https://reviews.llvm.org/D29564?vs=87219&id=87220#toc
Repository:
rL LLVM
https://reviews.llvm.org/D29564
Files:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/trunk/test/CodeGen/X86/adde-carry.ll
Index: llvm/trunk/test/CodeGen/X86/adde-carry.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/adde-carry.ll
+++ llvm/trunk/test/CodeGen/X86/adde-carry.ll
@@ -93,17 +93,16 @@
; 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)
Index: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1834,6 +1834,12 @@
}
}
+ // (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();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29564.87220.patch
Type: text/x-patch
Size: 1612 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170206/b35f53e1/attachment.bin>
More information about the llvm-commits
mailing list