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