summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-01-29 10:58:42 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-01-29 10:58:42 +0000
commit4293ad8ab2480c28e77ee40fa4c0c13af20bd5f8 (patch)
tree219476a8eccf2f125b600dbbf28cfa53e229ec9e /llvm/test/CodeGen
parent4684f824d4c143d483e31fa859a9948497f19c02 (diff)
downloadbcm5719-llvm-4293ad8ab2480c28e77ee40fa4c0c13af20bd5f8.tar.gz
bcm5719-llvm-4293ad8ab2480c28e77ee40fa4c0c13af20bd5f8.zip
[X86] Add PR40483 test case
llvm-svn: 352480
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/combine-sbb.ll57
1 files changed, 57 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/combine-sbb.ll b/llvm/test/CodeGen/X86/combine-sbb.ll
index 646e6f5ed0c..f72e4e5199a 100644
--- a/llvm/test/CodeGen/X86/combine-sbb.ll
+++ b/llvm/test/CodeGen/X86/combine-sbb.ll
@@ -149,4 +149,61 @@ define i8 @PR24545(i32, i32, i32* nocapture readonly) {
%12 = zext i1 %11 to i8
ret i8 %12
}
+
+define i32 @PR40483_sub1(i32*, i32) nounwind {
+; X86-LABEL: PR40483_sub1:
+; X86: # %bb.0:
+; X86-NEXT: pushl %esi
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: movl (%ecx), %edx
+; X86-NEXT: movl %edx, %esi
+; X86-NEXT: subl %eax, %esi
+; X86-NEXT: movl %esi, (%ecx)
+; X86-NEXT: subl %edx, %eax
+; X86-NEXT: addl %esi, %eax
+; X86-NEXT: popl %esi
+; X86-NEXT: retl
+;
+; X64-LABEL: PR40483_sub1:
+; X64: # %bb.0:
+; X64-NEXT: movl (%rdi), %ecx
+; X64-NEXT: movl %ecx, %eax
+; X64-NEXT: subl %esi, %eax
+; X64-NEXT: movl %eax, (%rdi)
+; X64-NEXT: subl %ecx, %esi
+; X64-NEXT: addl %esi, %eax
+; X64-NEXT: retq
+ %3 = load i32, i32* %0, align 4
+ %4 = tail call { i8, i32 } @llvm.x86.subborrow.32(i8 0, i32 %3, i32 %1)
+ %5 = extractvalue { i8, i32 } %4, 1
+ store i32 %5, i32* %0, align 4
+ %6 = sub i32 %1, %3
+ %7 = add i32 %6, %5
+ ret i32 %7
+}
+
+define i32 @PR40483_sub2(i32*, i32) nounwind {
+; X86-LABEL: PR40483_sub2:
+; X86: # %bb.0:
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: subl %eax, (%ecx)
+; X86-NEXT: xorl %eax, %eax
+; X86-NEXT: retl
+;
+; X64-LABEL: PR40483_sub2:
+; X64: # %bb.0:
+; X64-NEXT: subl %esi, (%rdi)
+; X64-NEXT: xorl %eax, %eax
+; X64-NEXT: retq
+ %3 = load i32, i32* %0, align 4
+ %4 = sub i32 %3, %1
+ %5 = tail call { i8, i32 } @llvm.x86.subborrow.32(i8 0, i32 %3, i32 %1)
+ %6 = extractvalue { i8, i32 } %5, 1
+ store i32 %6, i32* %0, align 4
+ %7 = sub i32 %4, %6
+ ret i32 %7
+}
+
declare { i8, i32 } @llvm.x86.subborrow.32(i8, i32, i32)
OpenPOWER on IntegriCloud