Home | History | Annotate | Download | only in X86
      1 ; RUN: llc -mtriple=i386-pc-linux < %s | FileCheck %s
      2 ; RUN: llc -mtriple=x86_64-pc-linux < %s | FileCheck %s
      3 
      4 ; Function Attrs: nounwind
      5 ; CHECK-LABEL: s64_to_d:
      6 ; CHECK: call{{l|q}} __floatdidf
      7 define double @s64_to_d(i64 %n) #0 {
      8 entry:
      9   %conv = sitofp i64 %n to double
     10   ret double %conv
     11 }
     12 
     13 ; CHECK-LABEL: s64_to_f:
     14 ; CHECK: call{{l|q}} __floatdisf
     15 define float @s64_to_f(i64 %n) #0 {
     16 entry:
     17   %conv = sitofp i64 %n to float
     18   ret float %conv
     19 }
     20 
     21 ; CHECK-LABEL: s32_to_d:
     22 ; CHECK: call{{l|q}} __floatsidf
     23 define double @s32_to_d(i32 %n) #0 {
     24 entry:
     25   %conv = sitofp i32 %n to double
     26   ret double %conv
     27 }
     28 
     29 ; CHECK-LABEL: s32_to_f:
     30 ; CHECK: call{{l|q}} __floatsisf
     31 define float @s32_to_f(i32 %n) #0 {
     32 entry:
     33   %conv = sitofp i32 %n to float
     34   ret float %conv
     35 }
     36 
     37 ; CHECK-LABEL: u64_to_d:
     38 ; CHECK: call{{l|q}} __floatundidf
     39 define double @u64_to_d(i64 %n) #0 {
     40 entry:
     41   %conv = uitofp i64 %n to double
     42   ret double %conv
     43 }
     44 
     45 ; CHECK-LABEL: u64_to_f:
     46 ; CHECK: call{{l|q}} __floatundisf
     47 define float @u64_to_f(i64 %n) #0 {
     48 entry:
     49   %conv = uitofp i64 %n to float
     50   ret float %conv
     51 }
     52 
     53 ; CHECK-LABEL: u32_to_d:
     54 ; CHECK: call{{l|q}} __floatunsidf
     55 define double @u32_to_d(i32 %n) #0 {
     56 entry:
     57   %conv = uitofp i32 %n to double
     58   ret double %conv
     59 }
     60 
     61 ; CHECK-LABEL: u32_to_f:
     62 ; CHECK: call{{l|q}} __floatunsisf
     63 define float @u32_to_f(i32 %n) #0 {
     64 entry:
     65   %conv = uitofp i32 %n to float
     66   ret float %conv
     67 }
     68 
     69 ; CHECK-LABEL: d_to_s64:
     70 ; CHECK: call{{l|q}} __fixdfdi
     71 define i64 @d_to_s64(double %n) #0 {
     72 entry:
     73   %conv = fptosi double %n to i64
     74   ret i64 %conv
     75 }
     76 
     77 ; CHECK-LABEL: d_to_s32:
     78 ; CHECK: call{{l|q}} __fixdfsi
     79 define i32 @d_to_s32(double %n) #0 {
     80 entry:
     81   %conv = fptosi double %n to i32
     82   ret i32 %conv
     83 }
     84 
     85 ; CHECK-LABEL: f_to_s64:
     86 ; CHECK: call{{l|q}} __fixsfdi
     87 define i64 @f_to_s64(float %n) #0 {
     88 entry:
     89   %conv = fptosi float %n to i64
     90   ret i64 %conv
     91 }
     92 
     93 ; CHECK-LABEL: f_to_s32:
     94 ; CHECK: call{{l|q}} __fixsfsi
     95 define i32 @f_to_s32(float %n) #0 {
     96 entry:
     97   %conv = fptosi float %n to i32
     98   ret i32 %conv
     99 }
    100 
    101 ; CHECK-LABEL: d_to_u64:
    102 ; CHECK: call{{l|q}} __fixunsdfdi
    103 define i64 @d_to_u64(double %n) #0 {
    104 entry:
    105   %conv = fptoui double %n to i64
    106   ret i64 %conv
    107 }
    108 
    109 ; CHECK-LABEL: d_to_u32:
    110 ; CHECK: call{{l|q}} __fixunsdfsi
    111 define i32 @d_to_u32(double %n) #0 {
    112 entry:
    113   %conv = fptoui double %n to i32
    114   ret i32 %conv
    115 }
    116 
    117 ; CHECK-LABEL: f_to_u64:
    118 ; CHECK: call{{l|q}} __fixunssfdi
    119 define i64 @f_to_u64(float %n) #0 {
    120 entry:
    121   %conv = fptoui float %n to i64
    122   ret i64 %conv
    123 }
    124 
    125 ; CHECK-LABEL: f_to_u32:
    126 ; CHECK: call{{l|q}} __fixunssfsi
    127 define i32 @f_to_u32(float %n) #0 {
    128 entry:
    129   %conv = fptoui float %n to i32
    130   ret i32 %conv
    131 }
    132 
    133 ; CHECK-LABEL: f_to_s8:
    134 ; CHECK: call{{l|q}} __fixsfsi
    135 define i8 @f_to_s8(float %f, i8 %i) #0 {
    136 entry:
    137   %conv = fptosi float %f to i8
    138   %add = add i8 %conv, %i
    139   ret i8 %add
    140 }
    141 
    142 ; CHECK-LABEL: f_to_u8:
    143 ; CHECK: call{{l|q}} __fixunssfsi
    144 define i8 @f_to_u8(float %f, i8 %i) #0 {
    145 entry:
    146   %conv = fptoui float %f to i8
    147   %add = add i8 %conv, %i
    148   ret i8 %add
    149 }
    150 
    151 ; CHECK-LABEL: f_to_s16:
    152 ; CHECK: call{{l|q}} __fixsfsi
    153 define i16 @f_to_s16(float %f, i16 %i) #0 {
    154 entry:
    155   %conv = fptosi float %f to i16
    156   %add = add i16 %conv, %i
    157   ret i16 %add
    158 }
    159 
    160 ; CHECK-LABEL: f_to_u16:
    161 ; CHECK: call{{l|q}} __fixunssfsi
    162 define i16 @f_to_u16(float %f, i16 %i) #0 {
    163 entry:
    164   %conv = fptoui float %f to i16
    165   %add = add i16 %conv, %i
    166   ret i16 %add
    167 }
    168 
    169 attributes #0 = { nounwind "use-soft-float"="true" }
    170