As Dan pointed out, movzbl, movsbl, and friends are nicer than their alias
[oota-llvm.git] / test / CodeGen / X86 / cmov.ll
index f53966c905ad95e4007560070e77d1c57bf819c8..39d9d1e9ec0e211cdc64383dc605cc04da4dc3e8 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=x86-64 | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
 
 define i32 @test1(i32 %x, i32 %n, i32 %w, i32* %vp) nounwind readnone {
@@ -6,7 +6,7 @@ entry:
 ; CHECK: test1:
 ; CHECK: btl
 ; CHECK-NEXT: movl     $12, %eax
-; CHECK-NEXT: cmovae   (%rcx), %eax
+; CHECK-NEXT: cmovael  (%rcx), %eax
 ; CHECK-NEXT: ret
 
        %0 = lshr i32 %x, %n            ; <i32> [#uses=1]
@@ -21,7 +21,7 @@ entry:
 ; CHECK: test2:
 ; CHECK: btl
 ; CHECK-NEXT: movl     $12, %eax
-; CHECK-NEXT: cmovb    (%rcx), %eax
+; CHECK-NEXT: cmovbl   (%rcx), %eax
 ; CHECK-NEXT: ret
 
        %0 = lshr i32 %x, %n            ; <i32> [#uses=1]
@@ -33,11 +33,15 @@ entry:
 }
 
 
+; x86's 32-bit cmov doesn't clobber the high 32 bits of the destination
+; if the condition is false. An explicit zero-extend (movl) is needed
+; after the cmov.
+
 declare void @bar(i64) nounwind
 
 define void @test3(i64 %a, i64 %b, i1 %p) nounwind {
 ; CHECK: test3:
-; CHECK:      cmovne  %edi, %esi
+; CHECK:      cmovnel %edi, %esi
 ; CHECK-NEXT: movl    %esi, %edi
 
   %c = trunc i64 %a to i32