[x86] add test for setcc sub->shift transform; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353618 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/X86/setcc-combine.ll b/test/CodeGen/X86/setcc-combine.ll
index 749d99b..c13d2f1 100644
--- a/test/CodeGen/X86/setcc-combine.ll
+++ b/test/CodeGen/X86/setcc-combine.ll
@@ -283,3 +283,17 @@
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
+}
+