[llvm] r353618 - [x86] add test for setcc sub->shift transform; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 9 08:41:21 PST 2019
Author: spatel
Date: Sat Feb 9 08:41:20 2019
New Revision: 353618
URL: http://llvm.org/viewvc/llvm-project?rev=353618&view=rev
Log:
[x86] add test for setcc sub->shift transform; NFC
Modified:
llvm/trunk/test/CodeGen/X86/setcc-combine.ll
Modified: llvm/trunk/test/CodeGen/X86/setcc-combine.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/setcc-combine.ll?rev=353618&r1=353617&r2=353618&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/setcc-combine.ll (original)
+++ llvm/trunk/test/CodeGen/X86/setcc-combine.ll Sat Feb 9 08:41:20 2019
@@ -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
+}
+
More information about the llvm-commits
mailing list