]> granicus.if.org Git - llvm/commitdiff
[x86] add test for setcc sub->shift transform; NFC
authorSanjay Patel <spatel@rotateright.com>
Sat, 9 Feb 2019 16:41:20 +0000 (16:41 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sat, 9 Feb 2019 16:41:20 +0000 (16:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353618 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/X86/setcc-combine.ll

index 749d99bcaff63156c950a946b6586477e9cc64f7..c13d2f114cf9b3f08933780335e6d69c1445b51a 100644 (file)
@@ -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
+}
+