Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -fast-isel -fast-isel-abort -mtriple=x86_64-apple-darwin10                  | FileCheck %s
      2 
      3 ; Test conditional move for the supported types (i16, i32, and i32) and
      4 ; conditon input (argument or cmp). Currently i8 is not supported.
      5 
      6 define zeroext i16 @select_cmov_i16(i1 zeroext %cond, i16 zeroext %a, i16 zeroext %b) {
      7 ; CHECK-LABEL: select_cmov_i16
      8 ; CHECK:       testb   $1, %dil
      9 ; CHECK-NEXT:  cmovew  %dx, %si
     10 ; CHECK-NEXT:  movzwl  %si, %eax
     11   %1 = select i1 %cond, i16 %a, i16 %b
     12   ret i16 %1
     13 }
     14 
     15 define zeroext i16 @select_cmp_cmov_i16(i16 zeroext %a, i16 zeroext %b) {
     16 ; CHECK-LABEL: select_cmp_cmov_i16
     17 ; CHECK:       cmpw    %si, %di
     18 ; CHECK-NEXT:  cmovbw  %di, %si
     19 ; CHECK-NEXT:  movzwl  %si, %eax
     20   %1 = icmp ult i16 %a, %b
     21   %2 = select i1 %1, i16 %a, i16 %b
     22   ret i16 %2
     23 }
     24 
     25 define i32 @select_cmov_i32(i1 zeroext %cond, i32 %a, i32 %b) {
     26 ; CHECK-LABEL: select_cmov_i32
     27 ; CHECK:       testb   $1, %dil
     28 ; CHECK-NEXT:  cmovel  %edx, %esi
     29 ; CHECK-NEXT:  movl    %esi, %eax
     30   %1 = select i1 %cond, i32 %a, i32 %b
     31   ret i32 %1
     32 }
     33 
     34 define i32 @select_cmp_cmov_i32(i32 %a, i32 %b) {
     35 ; CHECK-LABEL: select_cmp_cmov_i32
     36 ; CHECK:       cmpl    %esi, %edi
     37 ; CHECK-NEXT:  cmovbl  %edi, %esi
     38 ; CHECK-NEXT:  movl    %esi, %eax
     39   %1 = icmp ult i32 %a, %b
     40   %2 = select i1 %1, i32 %a, i32 %b
     41   ret i32 %2
     42 }
     43 
     44 define i64 @select_cmov_i64(i1 zeroext %cond, i64 %a, i64 %b) {
     45 ; CHECK-LABEL: select_cmov_i64
     46 ; CHECK:       testb   $1, %dil
     47 ; CHECK-NEXT:  cmoveq  %rdx, %rsi
     48 ; CHECK-NEXT:  movq    %rsi, %rax
     49   %1 = select i1 %cond, i64 %a, i64 %b
     50   ret i64 %1
     51 }
     52 
     53 define i64 @select_cmp_cmov_i64(i64 %a, i64 %b) {
     54 ; CHECK-LABEL: select_cmp_cmov_i64
     55 ; CHECK:       cmpq    %rsi, %rdi
     56 ; CHECK-NEXT:  cmovbq  %rdi, %rsi
     57 ; CHECK-NEXT:  movq    %rsi, %rax
     58   %1 = icmp ult i64 %a, %b
     59   %2 = select i1 %1, i64 %a, i64 %b
     60   ret i64 %2
     61 }
     62 
     63