From 04e18cd6ef2b70b210ae2610de3ffb8dc6570567 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Sat, 9 Feb 2019 16:41:20 +0000 Subject: [PATCH] [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 --- test/CodeGen/X86/setcc-combine.ll | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/CodeGen/X86/setcc-combine.ll b/test/CodeGen/X86/setcc-combine.ll index 749d99bcaff..c13d2f114cf 100644 --- a/test/CodeGen/X86/setcc-combine.ll +++ b/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 +} + -- 2.50.1