From: Simon Pilgrim Date: Sat, 26 Jan 2019 12:51:52 +0000 (+0000) Subject: [X86] Add 'less_than_ideal' followup test case from PR24545 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc43c7511d24da48e94694634f2d419fc8431de1;p=llvm [X86] Add 'less_than_ideal' followup test case from PR24545 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352272 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/X86/combine-sbb.ll b/test/CodeGen/X86/combine-sbb.ll index a7bdb4a0ab1..78a45379874 100644 --- a/test/CodeGen/X86/combine-sbb.ll +++ b/test/CodeGen/X86/combine-sbb.ll @@ -122,3 +122,38 @@ top: } declare { i64, i1 } @llvm.usub.with.overflow.i64(i64, i64) + +; PR24545 less_than_ideal() +define i8 @PR24545(i32, i32, i32* nocapture readonly) { +; X86-LABEL: PR24545: +; X86: # %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: movl (%ecx), %edx +; X86-NEXT: cmpl {{[0-9]+}}(%esp), %edx +; X86-NEXT: seta %dl +; X86-NEXT: addb $-1, %dl +; X86-NEXT: sbbl 4(%ecx), %eax +; X86-NEXT: setb %al +; X86-NEXT: retl +; +; X64-LABEL: PR24545: +; X64: # %bb.0: +; X64-NEXT: cmpl %edi, (%rdx) +; X64-NEXT: seta %al +; X64-NEXT: addb $-1, %al +; X64-NEXT: sbbl 4(%rdx), %esi +; X64-NEXT: setb %al +; X64-NEXT: retq + %4 = load i32, i32* %2 + %5 = icmp ugt i32 %4, %0 + %6 = zext i1 %5 to i8 + %7 = getelementptr inbounds i32, i32* %2, i32 1 + %8 = load i32, i32* %7 + %9 = tail call { i8, i32 } @llvm.x86.subborrow.32(i8 %6, i32 %1, i32 %8) + %10 = extractvalue { i8, i32 } %9, 0 + %11 = icmp ne i8 %10, 0 + %12 = zext i1 %11 to i8 + ret i8 %12 +} +declare { i8, i32 } @llvm.x86.subborrow.32(i8, i32, i32)