[llvm] 19de2a5 - [X86] Add test showing failure to fold add(adc(x,0,carry),c) -> adc(x,c,carry)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 03:14:34 PDT 2022


Author: Simon Pilgrim
Date: 2022-03-25T10:14:11Z
New Revision: 19de2a5768d1b2acdf43059116f551dd150dc1ce

URL: https://github.com/llvm/llvm-project/commit/19de2a5768d1b2acdf43059116f551dd150dc1ce
DIFF: https://github.com/llvm/llvm-project/commit/19de2a5768d1b2acdf43059116f551dd150dc1ce.diff

LOG: [X86] Add test showing failure to fold add(adc(x,0,carry),c) -> adc(x,c,carry)

Added: 
    

Modified: 
    llvm/test/CodeGen/X86/combine-add.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/X86/combine-add.ll b/llvm/test/CodeGen/X86/combine-add.ll
index 5c3e17849b2a8..510a1ac92e4fd 100644
--- a/llvm/test/CodeGen/X86/combine-add.ll
+++ b/llvm/test/CodeGen/X86/combine-add.ll
@@ -376,6 +376,22 @@ define <4 x i32> @combine_vec_add_add_not(<4 x i32> %a, <4 x i32> %b) {
   ret <4 x i32> %r
 }
 
+; FIXME: Fold to adc $32, %edi
+define i32 @combine_add_adc_constant(i32 %x, i32 %y, i32 %z) {
+; CHECK-LABEL: combine_add_adc_constant:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    # kill: def $edi killed $edi def $rdi
+; CHECK-NEXT:    btl $7, %edx
+; CHECK-NEXT:    adcl $0, %edi
+; CHECK-NEXT:    leal 32(%rdi), %eax
+; CHECK-NEXT:    retq
+  %and = lshr i32 %z, 7
+  %bit = and i32 %and, 1
+  %add = add i32 %x, 32
+  %r = add i32 %add, %bit
+  ret i32 %r
+}
+
 declare {i32, i1} @llvm.sadd.with.overflow.i32(i32 %a, i32 %b)
 
 define i1 @sadd_add(i32 %a, i32 %b, i32* %p) {


        


More information about the llvm-commits mailing list