summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-07-12 18:38:29 +0000
committerSanjay Patel <spatel@rotateright.com>2019-07-12 18:38:29 +0000
commite26bacb652abd3dd9a44f51563ecf2c98257bb6c (patch)
tree11a29c9c4284d407df983b458d379a197038bc53
parent495b0f5cc3e1da54d457783d6d9093c1295c639b (diff)
downloadbcm5719-llvm-e26bacb652abd3dd9a44f51563ecf2c98257bb6c.tar.gz
bcm5719-llvm-e26bacb652abd3dd9a44f51563ecf2c98257bb6c.zip
[x86] add test for bogus cmov (PR40483); NFC
llvm-svn: 365941
-rw-r--r--llvm/test/CodeGen/X86/combine-sbb.ll29
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/combine-sbb.ll b/llvm/test/CodeGen/X86/combine-sbb.ll
index 8a86c4dbb95..f9ac10755aa 100644
--- a/llvm/test/CodeGen/X86/combine-sbb.ll
+++ b/llvm/test/CodeGen/X86/combine-sbb.ll
@@ -278,4 +278,33 @@ define i32 @PR40483_sub4(i32*, i32) nounwind {
ret i32 %10
}
+; Verify that a bogus cmov is simplified.
+
+define i32 @PR40483_sub5(i32*, i32) {
+; X86-LABEL: PR40483_sub5:
+; 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_sub5:
+; X64: # %bb.0:
+; X64-NEXT: xorl %eax, %eax
+; X64-NEXT: subl %esi, (%rdi)
+; X64-NEXT: cmovael %eax, %eax
+; X64-NEXT: retq
+ %3 = load i32, i32* %0, align 8
+ %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 8
+ %6 = extractvalue { i8, i32 } %4, 0
+ %7 = icmp eq i8 %6, 0
+ %8 = sub i32 %1, %3
+ %9 = add i32 %8, %5
+ %10 = select i1 %7, i32 %9, i32 0
+ ret i32 %10
+}
+
declare { i8, i32 } @llvm.x86.subborrow.32(i8, i32, i32)
OpenPOWER on IntegriCloud