1; Test that library calls are emitted for LLVM IR intrinsics 2; 3; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s 4 5define float @f1(float %x, i32 %y) { 6; CHECK-LABEL: f1: 7; CHECK: brasl %r14, __powisf2@PLT 8 %tmp = call float @llvm.powi.f32(float %x, i32 %y) 9 ret float %tmp 10} 11 12define double @f2(double %x, i32 %y) { 13; CHECK-LABEL: f2: 14; CHECK: brasl %r14, __powidf2@PLT 15 %tmp = call double @llvm.powi.f64(double %x, i32 %y) 16 ret double %tmp 17} 18 19define fp128 @f3(fp128 %x, i32 %y) { 20; CHECK-LABEL: f3: 21; CHECK: brasl %r14, __powitf2@PLT 22 %tmp = call fp128 @llvm.powi.f128(fp128 %x, i32 %y) 23 ret fp128 %tmp 24} 25 26define float @f4(float %x, float %y) { 27; CHECK-LABEL: f4: 28; CHECK: brasl %r14, powf@PLT 29 %tmp = call float @llvm.pow.f32(float %x, float %y) 30 ret float %tmp 31} 32 33define double @f5(double %x, double %y) { 34; CHECK-LABEL: f5: 35; CHECK: brasl %r14, pow@PLT 36 %tmp = call double @llvm.pow.f64(double %x, double %y) 37 ret double %tmp 38} 39 40define fp128 @f6(fp128 %x, fp128 %y) { 41; CHECK-LABEL: f6: 42; CHECK: brasl %r14, powl@PLT 43 %tmp = call fp128 @llvm.pow.f128(fp128 %x, fp128 %y) 44 ret fp128 %tmp 45} 46 47define float @f7(float %x) { 48; CHECK-LABEL: f7: 49; CHECK: brasl %r14, sinf@PLT 50 %tmp = call float @llvm.sin.f32(float %x) 51 ret float %tmp 52} 53 54define double @f8(double %x) { 55; CHECK-LABEL: f8: 56; CHECK: brasl %r14, sin@PLT 57 %tmp = call double @llvm.sin.f64(double %x) 58 ret double %tmp 59} 60 61define fp128 @f9(fp128 %x) { 62; CHECK-LABEL: f9: 63; CHECK: brasl %r14, sinl@PLT 64 %tmp = call fp128 @llvm.sin.f128(fp128 %x) 65 ret fp128 %tmp 66} 67 68define float @f10(float %x) { 69; CHECK-LABEL: f10: 70; CHECK: brasl %r14, cosf@PLT 71 %tmp = call float @llvm.cos.f32(float %x) 72 ret float %tmp 73} 74 75define double @f11(double %x) { 76; CHECK-LABEL: f11: 77; CHECK: brasl %r14, cos@PLT 78 %tmp = call double @llvm.cos.f64(double %x) 79 ret double %tmp 80} 81 82define fp128 @f12(fp128 %x) { 83; CHECK-LABEL: f12: 84; CHECK: brasl %r14, cosl@PLT 85 %tmp = call fp128 @llvm.cos.f128(fp128 %x) 86 ret fp128 %tmp 87} 88 89define float @f13(float %x) { 90; CHECK-LABEL: f13: 91; CHECK: brasl %r14, expf@PLT 92 %tmp = call float @llvm.exp.f32(float %x) 93 ret float %tmp 94} 95 96define double @f14(double %x) { 97; CHECK-LABEL: f14: 98; CHECK: brasl %r14, exp@PLT 99 %tmp = call double @llvm.exp.f64(double %x) 100 ret double %tmp 101} 102 103define fp128 @f15(fp128 %x) { 104; CHECK-LABEL: f15: 105; CHECK: brasl %r14, expl@PLT 106 %tmp = call fp128 @llvm.exp.f128(fp128 %x) 107 ret fp128 %tmp 108} 109 110define float @f16(float %x) { 111; CHECK-LABEL: f16: 112; CHECK: brasl %r14, exp2f@PLT 113 %tmp = call float @llvm.exp2.f32(float %x) 114 ret float %tmp 115} 116 117define double @f17(double %x) { 118; CHECK-LABEL: f17: 119; CHECK: brasl %r14, exp2@PLT 120 %tmp = call double @llvm.exp2.f64(double %x) 121 ret double %tmp 122} 123 124define fp128 @f18(fp128 %x) { 125; CHECK-LABEL: f18: 126; CHECK: brasl %r14, exp2l@PLT 127 %tmp = call fp128 @llvm.exp2.f128(fp128 %x) 128 ret fp128 %tmp 129} 130 131define float @f19(float %x) { 132; CHECK-LABEL: f19: 133; CHECK: brasl %r14, logf@PLT 134 %tmp = call float @llvm.log.f32(float %x) 135 ret float %tmp 136} 137 138define double @f20(double %x) { 139; CHECK-LABEL: f20: 140; CHECK: brasl %r14, log@PLT 141 %tmp = call double @llvm.log.f64(double %x) 142 ret double %tmp 143} 144 145define fp128 @f21(fp128 %x) { 146; CHECK-LABEL: f21: 147; CHECK: brasl %r14, logl@PLT 148 %tmp = call fp128 @llvm.log.f128(fp128 %x) 149 ret fp128 %tmp 150} 151 152define float @f22(float %x) { 153; CHECK-LABEL: f22: 154; CHECK: brasl %r14, log2f@PLT 155 %tmp = call float @llvm.log2.f32(float %x) 156 ret float %tmp 157} 158 159define double @f23(double %x) { 160; CHECK-LABEL: f23: 161; CHECK: brasl %r14, log2@PLT 162 %tmp = call double @llvm.log2.f64(double %x) 163 ret double %tmp 164} 165 166define fp128 @f24(fp128 %x) { 167; CHECK-LABEL: f24: 168; CHECK: brasl %r14, log2l@PLT 169 %tmp = call fp128 @llvm.log2.f128(fp128 %x) 170 ret fp128 %tmp 171} 172 173define float @f25(float %x) { 174; CHECK-LABEL: f25: 175; CHECK: brasl %r14, log10f@PLT 176 %tmp = call float @llvm.log10.f32(float %x) 177 ret float %tmp 178} 179 180define double @f26(double %x) { 181; CHECK-LABEL: f26: 182; CHECK: brasl %r14, log10@PLT 183 %tmp = call double @llvm.log10.f64(double %x) 184 ret double %tmp 185} 186 187define fp128 @f27(fp128 %x) { 188; CHECK-LABEL: f27: 189; CHECK: brasl %r14, log10l@PLT 190 %tmp = call fp128 @llvm.log10.f128(fp128 %x) 191 ret fp128 %tmp 192} 193 194define float @f28(float %x, float %y) { 195; CHECK-LABEL: f28: 196; CHECK: brasl %r14, fminf@PLT 197 %tmp = call float @llvm.minnum.f32(float %x, float %y) 198 ret float %tmp 199} 200 201define double @f29(double %x, double %y) { 202; CHECK-LABEL: f29: 203; CHECK: brasl %r14, fmin@PLT 204 %tmp = call double @llvm.minnum.f64(double %x, double %y) 205 ret double %tmp 206} 207 208define fp128 @f30(fp128 %x, fp128 %y) { 209; CHECK-LABEL: f30: 210; CHECK: brasl %r14, fminl@PLT 211 %tmp = call fp128 @llvm.minnum.f128(fp128 %x, fp128 %y) 212 ret fp128 %tmp 213} 214 215define float @f31(float %x, float %y) { 216; CHECK-LABEL: f31: 217; CHECK: brasl %r14, fmaxf@PLT 218 %tmp = call float @llvm.maxnum.f32(float %x, float %y) 219 ret float %tmp 220} 221 222define double @f32(double %x, double %y) { 223; CHECK-LABEL: f32: 224; CHECK: brasl %r14, fmax@PLT 225 %tmp = call double @llvm.maxnum.f64(double %x, double %y) 226 ret double %tmp 227} 228 229define fp128 @f33(fp128 %x, fp128 %y) { 230; CHECK-LABEL: f33: 231; CHECK: brasl %r14, fmaxl@PLT 232 %tmp = call fp128 @llvm.maxnum.f128(fp128 %x, fp128 %y) 233 ret fp128 %tmp 234} 235 236; Verify that "nnan" minnum/maxnum calls are transformed to 237; compare+select sequences instead of libcalls. 238define float @f34(float %x, float %y) { 239; CHECK-LABEL: f34: 240; CHECK: cebr %f0, %f2 241; CHECK: blr %r14 242; CHECK: ler %f0, %f2 243; CHECK: br %r14 244 %tmp = call nnan float @llvm.minnum.f32(float %x, float %y) 245 ret float %tmp 246} 247 248define double @f35(double %x, double %y) { 249; CHECK-LABEL: f35: 250; CHECK: cdbr %f0, %f2 251; CHECK: blr %r14 252; CHECK: ldr %f0, %f2 253; CHECK: br %r14 254 %tmp = call nnan double @llvm.minnum.f64(double %x, double %y) 255 ret double %tmp 256} 257 258define fp128 @f36(fp128 %x, fp128 %y) { 259; CHECK-LABEL: f36: 260; CHECK: cxbr 261; CHECK: jl 262; CHECK: lxr 263; CHECK: br %r14 264 %tmp = call nnan fp128 @llvm.minnum.f128(fp128 %x, fp128 %y) 265 ret fp128 %tmp 266} 267 268define float @f37(float %x, float %y) { 269; CHECK-LABEL: f37: 270; CHECK: cebr %f0, %f2 271; CHECK: bhr %r14 272; CHECK: ler %f0, %f2 273; CHECK: br %r14 274 %tmp = call nnan float @llvm.maxnum.f32(float %x, float %y) 275 ret float %tmp 276} 277 278define double @f38(double %x, double %y) { 279; CHECK-LABEL: f38: 280; CHECK: cdbr %f0, %f2 281; CHECK: bhr %r14 282; CHECK: ldr %f0, %f2 283; CHECK: br %r14 284 %tmp = call nnan double @llvm.maxnum.f64(double %x, double %y) 285 ret double %tmp 286} 287 288define fp128 @f39(fp128 %x, fp128 %y) { 289; CHECK-LABEL: f39: 290; CHECK: cxbr 291; CHECK: jh 292; CHECK: lxr 293; CHECK: br %r14 294 %tmp = call nnan fp128 @llvm.maxnum.f128(fp128 %x, fp128 %y) 295 ret fp128 %tmp 296} 297 298declare float @llvm.powi.f32(float, i32) 299declare double @llvm.powi.f64(double, i32) 300declare fp128 @llvm.powi.f128(fp128, i32) 301declare float @llvm.pow.f32(float, float) 302declare double @llvm.pow.f64(double, double) 303declare fp128 @llvm.pow.f128(fp128, fp128) 304 305declare float @llvm.sin.f32(float) 306declare double @llvm.sin.f64(double) 307declare fp128 @llvm.sin.f128(fp128) 308declare float @llvm.cos.f32(float) 309declare double @llvm.cos.f64(double) 310declare fp128 @llvm.cos.f128(fp128) 311 312declare float @llvm.exp.f32(float) 313declare double @llvm.exp.f64(double) 314declare fp128 @llvm.exp.f128(fp128) 315declare float @llvm.exp2.f32(float) 316declare double @llvm.exp2.f64(double) 317declare fp128 @llvm.exp2.f128(fp128) 318 319declare float @llvm.log.f32(float) 320declare double @llvm.log.f64(double) 321declare fp128 @llvm.log.f128(fp128) 322declare float @llvm.log2.f32(float) 323declare double @llvm.log2.f64(double) 324declare fp128 @llvm.log2.f128(fp128) 325declare float @llvm.log10.f32(float) 326declare double @llvm.log10.f64(double) 327declare fp128 @llvm.log10.f128(fp128) 328 329declare float @llvm.minnum.f32(float, float) 330declare double @llvm.minnum.f64(double, double) 331declare fp128 @llvm.minnum.f128(fp128, fp128) 332declare float @llvm.maxnum.f32(float, float) 333declare double @llvm.maxnum.f64(double, double) 334declare fp128 @llvm.maxnum.f128(fp128, fp128) 335 336