-; 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 {
; 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]
; 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]
}
+; 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