Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s
      2 ; RUN: llc -mtriple=aarch64-linux-android -verify-machineinstrs -o - %s | FileCheck --check-prefix=ANDROID-AARCH64 %s
      3 
      4 @varfloat = global float 0.0
      5 @vardouble = global double 0.0
      6 @varfp128 = global fp128 zeroinitializer
      7 
      8 declare float @llvm.cos.f32(float)
      9 declare double @llvm.cos.f64(double)
     10 declare fp128 @llvm.cos.f128(fp128)
     11 
     12 define void @test_cos(float %float, double %double, fp128 %fp128) {
     13 ; CHECK-LABEL: test_cos:
     14 
     15    %cosfloat = call float @llvm.cos.f32(float %float)
     16    store float %cosfloat, float* @varfloat
     17 ; CHECK: bl cosf
     18 
     19    %cosdouble = call double @llvm.cos.f64(double %double)
     20    store double %cosdouble, double* @vardouble
     21 ; CHECK: bl cos
     22 
     23    %cosfp128 = call fp128 @llvm.cos.f128(fp128 %fp128)
     24    store fp128 %cosfp128, fp128* @varfp128
     25 ; CHECK: bl cosl
     26 
     27   ret void
     28 }
     29 
     30 declare float @llvm.exp.f32(float)
     31 declare double @llvm.exp.f64(double)
     32 declare fp128 @llvm.exp.f128(fp128)
     33 
     34 define void @test_exp(float %float, double %double, fp128 %fp128) {
     35 ; CHECK-LABEL: test_exp:
     36 
     37    %expfloat = call float @llvm.exp.f32(float %float)
     38    store float %expfloat, float* @varfloat
     39 ; CHECK: bl expf
     40 
     41    %expdouble = call double @llvm.exp.f64(double %double)
     42    store double %expdouble, double* @vardouble
     43 ; CHECK: bl exp
     44 
     45    %expfp128 = call fp128 @llvm.exp.f128(fp128 %fp128)
     46    store fp128 %expfp128, fp128* @varfp128
     47 ; CHECK: bl expl
     48 
     49   ret void
     50 }
     51 
     52 declare float @llvm.exp2.f32(float)
     53 declare double @llvm.exp2.f64(double)
     54 declare fp128 @llvm.exp2.f128(fp128)
     55 
     56 define void @test_exp2(float %float, double %double, fp128 %fp128) {
     57 ; CHECK-LABEL: test_exp2:
     58 
     59    %exp2float = call float @llvm.exp2.f32(float %float)
     60    store float %exp2float, float* @varfloat
     61 ; CHECK: bl exp2f
     62 
     63    %exp2double = call double @llvm.exp2.f64(double %double)
     64    store double %exp2double, double* @vardouble
     65 ; CHECK: bl exp2
     66 
     67    %exp2fp128 = call fp128 @llvm.exp2.f128(fp128 %fp128)
     68    store fp128 %exp2fp128, fp128* @varfp128
     69 ; CHECK: bl exp2l
     70   ret void
     71 
     72 }
     73 
     74 declare float @llvm.log.f32(float)
     75 declare double @llvm.log.f64(double)
     76 declare fp128 @llvm.log.f128(fp128)
     77 
     78 define void @test_log(float %float, double %double, fp128 %fp128) {
     79 ; CHECK-LABEL: test_log:
     80 
     81    %logfloat = call float @llvm.log.f32(float %float)
     82    store float %logfloat, float* @varfloat
     83 ; CHECK: bl logf
     84 
     85    %logdouble = call double @llvm.log.f64(double %double)
     86    store double %logdouble, double* @vardouble
     87 ; CHECK: bl log
     88 
     89    %logfp128 = call fp128 @llvm.log.f128(fp128 %fp128)
     90    store fp128 %logfp128, fp128* @varfp128
     91 ; CHECK: bl logl
     92 
     93   ret void
     94 }
     95 
     96 declare float @llvm.log2.f32(float)
     97 declare double @llvm.log2.f64(double)
     98 declare fp128 @llvm.log2.f128(fp128)
     99 
    100 define void @test_log2(float %float, double %double, fp128 %fp128) {
    101 ; CHECK-LABEL: test_log2:
    102 
    103    %log2float = call float @llvm.log2.f32(float %float)
    104    store float %log2float, float* @varfloat
    105 ; CHECK: bl log2f
    106 
    107    %log2double = call double @llvm.log2.f64(double %double)
    108    store double %log2double, double* @vardouble
    109 ; CHECK: bl log2
    110 
    111    %log2fp128 = call fp128 @llvm.log2.f128(fp128 %fp128)
    112    store fp128 %log2fp128, fp128* @varfp128
    113 ; CHECK: bl log2l
    114   ret void
    115 
    116 }
    117 
    118 declare float @llvm.log10.f32(float)
    119 declare double @llvm.log10.f64(double)
    120 declare fp128 @llvm.log10.f128(fp128)
    121 
    122 define void @test_log10(float %float, double %double, fp128 %fp128) {
    123 ; CHECK-LABEL: test_log10:
    124 
    125    %log10float = call float @llvm.log10.f32(float %float)
    126    store float %log10float, float* @varfloat
    127 ; CHECK: bl log10f
    128 
    129    %log10double = call double @llvm.log10.f64(double %double)
    130    store double %log10double, double* @vardouble
    131 ; CHECK: bl log10
    132 
    133    %log10fp128 = call fp128 @llvm.log10.f128(fp128 %fp128)
    134    store fp128 %log10fp128, fp128* @varfp128
    135 ; CHECK: bl log10l
    136 
    137   ret void
    138 }
    139 
    140 declare float @llvm.sin.f32(float)
    141 declare double @llvm.sin.f64(double)
    142 declare fp128 @llvm.sin.f128(fp128)
    143 
    144 define void @test_sin(float %float, double %double, fp128 %fp128) {
    145 ; CHECK-LABEL: test_sin:
    146 
    147    %sinfloat = call float @llvm.sin.f32(float %float)
    148    store float %sinfloat, float* @varfloat
    149 ; CHECK: bl sinf
    150 
    151    %sindouble = call double @llvm.sin.f64(double %double)
    152    store double %sindouble, double* @vardouble
    153 ; CHECK: bl sin
    154 
    155    %sinfp128 = call fp128 @llvm.sin.f128(fp128 %fp128)
    156    store fp128 %sinfp128, fp128* @varfp128
    157 ; CHECK: bl sinl
    158   ret void
    159 
    160 }
    161 
    162 declare float @llvm.pow.f32(float, float)
    163 declare double @llvm.pow.f64(double, double)
    164 declare fp128 @llvm.pow.f128(fp128, fp128)
    165 
    166 define void @test_pow(float %float, double %double, fp128 %fp128) {
    167 ; CHECK-LABEL: test_pow:
    168 
    169    %powfloat = call float @llvm.pow.f32(float %float, float %float)
    170    store float %powfloat, float* @varfloat
    171 ; CHECK: bl powf
    172 
    173    %powdouble = call double @llvm.pow.f64(double %double, double %double)
    174    store double %powdouble, double* @vardouble
    175 ; CHECK: bl pow
    176 
    177    %powfp128 = call fp128 @llvm.pow.f128(fp128 %fp128, fp128 %fp128)
    178    store fp128 %powfp128, fp128* @varfp128
    179 ; CHECK: bl powl
    180 
    181   ret void
    182 }
    183 
    184 declare float @llvm.powi.f32(float, i32)
    185 declare double @llvm.powi.f64(double, i32)
    186 declare fp128 @llvm.powi.f128(fp128, i32)
    187 
    188 define void @test_powi(float %float, double %double, i32 %exponent, fp128 %fp128) {
    189 ; CHECK-LABEL: test_powi:
    190 
    191    %powifloat = call float @llvm.powi.f32(float %float, i32 %exponent)
    192    store float %powifloat, float* @varfloat
    193 ; CHECK: bl __powisf2
    194 
    195    %powidouble = call double @llvm.powi.f64(double %double, i32 %exponent)
    196    store double %powidouble, double* @vardouble
    197 ; CHECK: bl __powidf2
    198 
    199    %powifp128 = call fp128 @llvm.powi.f128(fp128 %fp128, i32 %exponent)
    200    store fp128 %powifp128, fp128* @varfp128
    201 ; CHECK: bl __powitf2
    202   ret void
    203 
    204 }
    205 
    206 define void @test_frem(float %float, double %double, fp128 %fp128) {
    207 ; CHECK-LABEL: test_frem:
    208 
    209   %fremfloat = frem float %float, %float
    210   store float %fremfloat, float* @varfloat
    211 ; CHECK: bl fmodf
    212 
    213   %fremdouble = frem double %double, %double
    214   store double %fremdouble, double* @vardouble
    215 ; CHECK: bl fmod
    216 
    217   %fremfp128 = frem fp128 %fp128, %fp128
    218   store fp128 %fremfp128, fp128* @varfp128
    219 ; CHECK: bl fmodl
    220 
    221   ret void
    222 }
    223 
    224 declare fp128 @llvm.fma.f128(fp128, fp128, fp128)
    225 
    226 define void @test_fma(fp128 %fp128) {
    227 ; CHECK-LABEL: test_fma:
    228 
    229   %fmafp128 = call fp128 @llvm.fma.f128(fp128 %fp128, fp128 %fp128, fp128 %fp128)
    230   store fp128 %fmafp128, fp128* @varfp128
    231 ; CHECK: bl fmal
    232 
    233   ret void
    234 }
    235 
    236 declare fp128 @llvm.fmuladd.f128(fp128, fp128, fp128)
    237 
    238 define void @test_fmuladd(fp128 %fp128) {
    239 ; CHECK-LABEL: test_fmuladd:
    240 
    241   %fmuladdfp128 = call fp128 @llvm.fmuladd.f128(fp128 %fp128, fp128 %fp128, fp128 %fp128)
    242   store fp128 %fmuladdfp128, fp128* @varfp128
    243 ; CHECK-NOT: bl fmal
    244 ; CHECK: bl __multf3
    245 ; CHECK: bl __addtf3
    246 
    247   ret void
    248 }
    249 
    250 define void @test_exp_finite(double %double) #0 {
    251   %expdouble = call double @llvm.exp.f64(double %double)
    252   store double %expdouble, double* @vardouble
    253   ; ANDROID-AARCH64-NOT: bl __exp_finite
    254   ; CHECK: bl __exp_finite
    255 
    256   ret void
    257 }
    258 
    259 define void @test_exp2_finite(double %double) #0 {
    260   %expdouble = call double @llvm.exp2.f64(double %double)
    261   store double %expdouble, double* @vardouble
    262   ; ANDROID-AARCH64-NOT: bl __exp2_finite
    263   ; CHECK: bl __exp2_finite
    264 
    265   ret void
    266 }
    267 
    268 define void @test_log_finite(double %double) #0 {
    269   %logdouble = call double @llvm.log.f64(double %double)
    270   store double %logdouble, double* @vardouble
    271   ; ANDROID-AARCH64-NOT: bl __log_finite
    272   ; CHECK: bl __log_finite
    273   ret void
    274 }
    275 
    276 define void @test_log2_finite(double %double) #0 {
    277   %log2double = call double @llvm.log2.f64(double %double)
    278   store double %log2double, double* @vardouble
    279   ; ANDROID-AARCH64-NOT: bl __log2_finite
    280   ; CHECK: bl __log2_finite
    281   ret void
    282 }
    283 
    284 define void @test_log10_finite(double %double) #0 {
    285   %log10double = call double @llvm.log10.f64(double %double)
    286   store double %log10double, double* @vardouble
    287   ; ANDROID-AARCH64-NOT: bl __log10_finite
    288   ; CHECK: bl __log10_finite
    289   ret void
    290 }
    291 
    292 define void @test_pow_finite(double %double) #0 {
    293   %powdouble = call double @llvm.pow.f64(double %double, double %double)
    294   store double %powdouble, double* @vardouble
    295   ; ANDROID-AARCH64-NOT: bl __pow_finite
    296   ; CHECK: bl __pow_finite
    297   ret void
    298 }
    299 
    300 attributes #0 = { "no-infs-fp-math"="true" "no-nans-fp-math"="true" }
    301