OSDN Git Service

[x86] add test to show bug in select lowering; NFC
authorSanjay Patel <spatel@rotateright.com>
Thu, 5 Jan 2017 18:35:44 +0000 (18:35 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 5 Jan 2017 18:35:44 +0000 (18:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291151 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/X86/cmov.ll

index a961dba..8e9bc8b 100644 (file)
@@ -156,3 +156,21 @@ define i8 @test7(i1 inreg %c, i8 inreg %a, i8 inreg %b) nounwind {
   %d = select i1 %c, i8 %a, i8 %b
   ret i8 %d
 }
+
+; FIXME: The 'not' is redundant.
+
+define i32 @smin(i32 %x) {
+; CHECK-LABEL: smin:
+; CHECK:       ## BB#0:
+; CHECK-NEXT:    movl %edi, %ecx
+; CHECK-NEXT:    notl %ecx
+; CHECK-NEXT:    xorl $-1, %edi
+; CHECK-NEXT:    movl $-1, %eax
+; CHECK-NEXT:    cmovsl %ecx, %eax
+; CHECK-NEXT:    retq
+  %not_x = xor i32 %x, -1
+  %1 = icmp slt i32 %not_x, -1
+  %sel = select i1 %1, i32 %not_x, i32 -1
+  ret i32 %sel
+}
+