summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-02-09 16:41:20 +0000
committerSanjay Patel <spatel@rotateright.com>2019-02-09 16:41:20 +0000
commitf31cf49c587ec1d72c9b93a80bd085640b4d50ca (patch)
tree7de59197325715c60e084e91d7ead11fd718b0d2
parent9419b5bd04f84d565776fe8ad4b8750e4c1266c1 (diff)
downloadbcm5719-llvm-f31cf49c587ec1d72c9b93a80bd085640b4d50ca.tar.gz
bcm5719-llvm-f31cf49c587ec1d72c9b93a80bd085640b4d50ca.zip
[x86] add test for setcc sub->shift transform; NFC
llvm-svn: 353618
-rw-r--r--llvm/test/CodeGen/X86/setcc-combine.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/setcc-combine.ll b/llvm/test/CodeGen/X86/setcc-combine.ll
index 749d99bcaff..c13d2f114cf 100644
--- a/llvm/test/CodeGen/X86/setcc-combine.ll
+++ b/llvm/test/CodeGen/X86/setcc-combine.ll
@@ -283,3 +283,17 @@ define i64 @PR40657(i8 %var2, i8 %var9) {
ret i64 %res.cast
}
+define i64 @sub_to_shift_to_add(i32 %x, i32 %y, i64 %s1, i64 %s2) {
+; CHECK-LABEL: sub_to_shift_to_add:
+; CHECK: # %bb.0:
+; CHECK-NEXT: movq %rdx, %rax
+; CHECK-NEXT: addl %esi, %esi
+; CHECK-NEXT: cmpl %esi, %edi
+; CHECK-NEXT: cmovneq %rcx, %rax
+; CHECK-NEXT: retq
+ %sub = sub i32 %x, %y
+ %cmp = icmp eq i32 %sub, %y
+ %r = select i1 %cmp, i64 %s1, i64 %s2
+ ret i64 %r
+}
+
OpenPOWER on IntegriCloud