aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-01-26 12:51:52 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-01-26 12:51:52 +0000
commit3cdf3f681d424070e8d13973f037ec07b521056c (patch)
tree6e03b1d9731abb90ea4f013ec4000ac37f7a249a
parent21cdcd7b2b6980f15a7bfe0ee191ddf6498251b7 (diff)
downloadllvm-3cdf3f681d424070e8d13973f037ec07b521056c.zip
llvm-3cdf3f681d424070e8d13973f037ec07b521056c.tar.gz
llvm-3cdf3f681d424070e8d13973f037ec07b521056c.tar.bz2
[X86] Add 'less_than_ideal' followup test case from PR24545
llvm-svn: 352272
-rw-r--r--llvm/test/CodeGen/X86/combine-sbb.ll35
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/combine-sbb.ll b/llvm/test/CodeGen/X86/combine-sbb.ll
index a7bdb4a..78a4537 100644
--- a/llvm/test/CodeGen/X86/combine-sbb.ll
+++ b/llvm/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)