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

This commit is contained in:
Simon Pilgrim 2022-03-25 10:14:11 +00:00
parent 3d8d60e147
commit 19de2a5768
1 changed files with 16 additions and 0 deletions

View File

@ -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) {