1; RUN: llc -mtriple=arm64-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 7declare float @llvm.cos.f32(float) 8declare double @llvm.cos.f64(double) 9declare fp128 @llvm.cos.f128(fp128) 10 11define 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 29declare float @llvm.exp.f32(float) 30declare double @llvm.exp.f64(double) 31declare fp128 @llvm.exp.f128(fp128) 32 33define 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 51declare float @llvm.exp2.f32(float) 52declare double @llvm.exp2.f64(double) 53declare fp128 @llvm.exp2.f128(fp128) 54 55define 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 73declare float @llvm.log.f32(float) 74declare double @llvm.log.f64(double) 75declare fp128 @llvm.log.f128(fp128) 76 77define 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 95declare float @llvm.log2.f32(float) 96declare double @llvm.log2.f64(double) 97declare fp128 @llvm.log2.f128(fp128) 98 99define 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 117declare float @llvm.log10.f32(float) 118declare double @llvm.log10.f64(double) 119declare fp128 @llvm.log10.f128(fp128) 120 121define 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 139declare float @llvm.sin.f32(float) 140declare double @llvm.sin.f64(double) 141declare fp128 @llvm.sin.f128(fp128) 142 143define 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 161declare float @llvm.pow.f32(float, float) 162declare double @llvm.pow.f64(double, double) 163declare fp128 @llvm.pow.f128(fp128, fp128) 164 165define 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 183declare float @llvm.powi.f32(float, i32) 184declare double @llvm.powi.f64(double, i32) 185declare fp128 @llvm.powi.f128(fp128, i32) 186 187define 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 205define 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 223declare fp128 @llvm.fma.f128(fp128, fp128, fp128) 224 225define 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 235declare fp128 @llvm.fmuladd.f128(fp128, fp128, fp128) 236 237define 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 249define i32 @test_fptosi32(fp128 %a) { 250; CHECK-LABEL: test_fptosi32: 251; CHECK: bl __fixtfsi 252 %conv.i = fptosi fp128 %a to i32 253 %b = add nsw i32 %conv.i, 48 254 ret i32 %b 255} 256 257define i64 @test_fptosi64(fp128 %a) { 258; CHECK-LABEL: test_fptosi64: 259; CHECK: bl __fixtfdi 260 %conv.i = fptosi fp128 %a to i64 261 %b = add nsw i64 %conv.i, 48 262 ret i64 %b 263} 264 265define i128 @test_fptosi128(fp128 %a) { 266; CHECK-LABEL: test_fptosi128: 267; CHECK: bl __fixtfti 268 %conv.i = fptosi fp128 %a to i128 269 %b = add nsw i128 %conv.i, 48 270 ret i128 %b 271} 272 273define i32 @test_fptoui32(fp128 %a) { 274; CHECK-LABEL: test_fptoui32: 275; CHECK: bl __fixunstfsi 276 %conv.i = fptoui fp128 %a to i32 277 %b = add nsw i32 %conv.i, 48 278 ret i32 %b 279} 280 281define i64 @test_fptoui64(fp128 %a) { 282; CHECK-LABEL: test_fptoui64: 283; CHECK: bl __fixunstfdi 284 %conv.i = fptoui fp128 %a to i64 285 %b = add nsw i64 %conv.i, 48 286 ret i64 %b 287} 288 289define i128 @test_fptoui128(fp128 %a) { 290; CHECK-LABEL: test_fptoui128: 291; CHECK: bl __fixunstfti 292 %conv.i = fptoui fp128 %a to i128 293 %b = add nsw i128 %conv.i, 48 294 ret i128 %b 295} 296