1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=x86_64-pc-linux-gnu | FileCheck %s --check-prefix=CHECK --check-prefix=GNU 3 ; RUN: llc < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefix=CHECK --check-prefix=WIN 4 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s --check-prefix=CHECK --check-prefix=MAC 5 6 ; PR35672 - https://bugs.llvm.org/show_bug.cgi?id=35672 7 ; FIXME: We would not need the function-level attributes if FMF were propagated to DAG nodes for this case. 8 9 define float @exp_f32(float %x) #0 { 10 ; GNU-LABEL: exp_f32: 11 ; GNU: # %bb.0: 12 ; GNU-NEXT: jmp __expf_finite # TAILCALL 13 ; 14 ; WIN-LABEL: exp_f32: 15 ; WIN: # %bb.0: 16 ; WIN-NEXT: jmp expf # TAILCALL 17 ; 18 ; MAC-LABEL: exp_f32: 19 ; MAC: ## %bb.0: 20 ; MAC-NEXT: jmp _expf ## TAILCALL 21 %r = tail call nnan ninf float @llvm.exp.f32(float %x) 22 ret float %r 23 } 24 25 define double @exp_f64(double %x) #0 { 26 ; GNU-LABEL: exp_f64: 27 ; GNU: # %bb.0: 28 ; GNU-NEXT: jmp __exp_finite # TAILCALL 29 ; 30 ; WIN-LABEL: exp_f64: 31 ; WIN: # %bb.0: 32 ; WIN-NEXT: jmp exp # TAILCALL 33 ; 34 ; MAC-LABEL: exp_f64: 35 ; MAC: ## %bb.0: 36 ; MAC-NEXT: jmp _exp ## TAILCALL 37 %r = tail call nnan ninf double @llvm.exp.f64(double %x) 38 ret double %r 39 } 40 41 define x86_fp80 @exp_f80(x86_fp80 %x) #0 { 42 ; GNU-LABEL: exp_f80: 43 ; GNU: # %bb.0: 44 ; GNU-NEXT: subq $24, %rsp 45 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp) 46 ; GNU-NEXT: fstpt (%rsp) 47 ; GNU-NEXT: callq __expl_finite 48 ; GNU-NEXT: addq $24, %rsp 49 ; GNU-NEXT: retq 50 ; 51 ; WIN-LABEL: exp_f80: 52 ; WIN: # %bb.0: 53 ; WIN-NEXT: pushq %rsi 54 ; WIN-NEXT: subq $64, %rsp 55 ; WIN-NEXT: movq %rcx, %rsi 56 ; WIN-NEXT: fldt (%rdx) 57 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp) 58 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx 59 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx 60 ; WIN-NEXT: callq expl 61 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp) 62 ; WIN-NEXT: fstpt (%rsi) 63 ; WIN-NEXT: movq %rsi, %rax 64 ; WIN-NEXT: addq $64, %rsp 65 ; WIN-NEXT: popq %rsi 66 ; WIN-NEXT: retq 67 ; 68 ; MAC-LABEL: exp_f80: 69 ; MAC: ## %bb.0: 70 ; MAC-NEXT: subq $24, %rsp 71 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp) 72 ; MAC-NEXT: fstpt (%rsp) 73 ; MAC-NEXT: callq _expl 74 ; MAC-NEXT: addq $24, %rsp 75 ; MAC-NEXT: retq 76 %r = tail call nnan ninf x86_fp80 @llvm.exp.f80(x86_fp80 %x) 77 ret x86_fp80 %r 78 } 79 80 define float @exp2_f32(float %x) #0 { 81 ; GNU-LABEL: exp2_f32: 82 ; GNU: # %bb.0: 83 ; GNU-NEXT: jmp __exp2f_finite # TAILCALL 84 ; 85 ; WIN-LABEL: exp2_f32: 86 ; WIN: # %bb.0: 87 ; WIN-NEXT: jmp exp2f # TAILCALL 88 ; 89 ; MAC-LABEL: exp2_f32: 90 ; MAC: ## %bb.0: 91 ; MAC-NEXT: jmp _exp2f ## TAILCALL 92 %r = tail call nnan ninf float @llvm.exp2.f32(float %x) 93 ret float %r 94 } 95 96 define double @exp2_f64(double %x) #0 { 97 ; GNU-LABEL: exp2_f64: 98 ; GNU: # %bb.0: 99 ; GNU-NEXT: jmp __exp2_finite # TAILCALL 100 ; 101 ; WIN-LABEL: exp2_f64: 102 ; WIN: # %bb.0: 103 ; WIN-NEXT: jmp exp2 # TAILCALL 104 ; 105 ; MAC-LABEL: exp2_f64: 106 ; MAC: ## %bb.0: 107 ; MAC-NEXT: jmp _exp2 ## TAILCALL 108 %r = tail call nnan ninf double @llvm.exp2.f64(double %x) 109 ret double %r 110 } 111 112 define x86_fp80 @exp2_f80(x86_fp80 %x) #0 { 113 ; GNU-LABEL: exp2_f80: 114 ; GNU: # %bb.0: 115 ; GNU-NEXT: subq $24, %rsp 116 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp) 117 ; GNU-NEXT: fstpt (%rsp) 118 ; GNU-NEXT: callq __exp2l_finite 119 ; GNU-NEXT: addq $24, %rsp 120 ; GNU-NEXT: retq 121 ; 122 ; WIN-LABEL: exp2_f80: 123 ; WIN: # %bb.0: 124 ; WIN-NEXT: pushq %rsi 125 ; WIN-NEXT: subq $64, %rsp 126 ; WIN-NEXT: movq %rcx, %rsi 127 ; WIN-NEXT: fldt (%rdx) 128 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp) 129 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx 130 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx 131 ; WIN-NEXT: callq exp2l 132 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp) 133 ; WIN-NEXT: fstpt (%rsi) 134 ; WIN-NEXT: movq %rsi, %rax 135 ; WIN-NEXT: addq $64, %rsp 136 ; WIN-NEXT: popq %rsi 137 ; WIN-NEXT: retq 138 ; 139 ; MAC-LABEL: exp2_f80: 140 ; MAC: ## %bb.0: 141 ; MAC-NEXT: subq $24, %rsp 142 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp) 143 ; MAC-NEXT: fstpt (%rsp) 144 ; MAC-NEXT: callq _exp2l 145 ; MAC-NEXT: addq $24, %rsp 146 ; MAC-NEXT: retq 147 %r = tail call nnan ninf x86_fp80 @llvm.exp2.f80(x86_fp80 %x) 148 ret x86_fp80 %r 149 } 150 151 define float @log_f32(float %x) #0 { 152 ; GNU-LABEL: log_f32: 153 ; GNU: # %bb.0: 154 ; GNU-NEXT: jmp __logf_finite # TAILCALL 155 ; 156 ; WIN-LABEL: log_f32: 157 ; WIN: # %bb.0: 158 ; WIN-NEXT: jmp logf # TAILCALL 159 ; 160 ; MAC-LABEL: log_f32: 161 ; MAC: ## %bb.0: 162 ; MAC-NEXT: jmp _logf ## TAILCALL 163 %r = tail call nnan ninf float @llvm.log.f32(float %x) 164 ret float %r 165 } 166 167 define double @log_f64(double %x) #0 { 168 ; GNU-LABEL: log_f64: 169 ; GNU: # %bb.0: 170 ; GNU-NEXT: jmp __log_finite # TAILCALL 171 ; 172 ; WIN-LABEL: log_f64: 173 ; WIN: # %bb.0: 174 ; WIN-NEXT: jmp log # TAILCALL 175 ; 176 ; MAC-LABEL: log_f64: 177 ; MAC: ## %bb.0: 178 ; MAC-NEXT: jmp _log ## TAILCALL 179 %r = tail call nnan ninf double @llvm.log.f64(double %x) 180 ret double %r 181 } 182 183 define x86_fp80 @log_f80(x86_fp80 %x) #0 { 184 ; GNU-LABEL: log_f80: 185 ; GNU: # %bb.0: 186 ; GNU-NEXT: subq $24, %rsp 187 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp) 188 ; GNU-NEXT: fstpt (%rsp) 189 ; GNU-NEXT: callq __logl_finite 190 ; GNU-NEXT: addq $24, %rsp 191 ; GNU-NEXT: retq 192 ; 193 ; WIN-LABEL: log_f80: 194 ; WIN: # %bb.0: 195 ; WIN-NEXT: pushq %rsi 196 ; WIN-NEXT: subq $64, %rsp 197 ; WIN-NEXT: movq %rcx, %rsi 198 ; WIN-NEXT: fldt (%rdx) 199 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp) 200 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx 201 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx 202 ; WIN-NEXT: callq logl 203 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp) 204 ; WIN-NEXT: fstpt (%rsi) 205 ; WIN-NEXT: movq %rsi, %rax 206 ; WIN-NEXT: addq $64, %rsp 207 ; WIN-NEXT: popq %rsi 208 ; WIN-NEXT: retq 209 ; 210 ; MAC-LABEL: log_f80: 211 ; MAC: ## %bb.0: 212 ; MAC-NEXT: subq $24, %rsp 213 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp) 214 ; MAC-NEXT: fstpt (%rsp) 215 ; MAC-NEXT: callq _logl 216 ; MAC-NEXT: addq $24, %rsp 217 ; MAC-NEXT: retq 218 %r = tail call nnan ninf x86_fp80 @llvm.log.f80(x86_fp80 %x) 219 ret x86_fp80 %r 220 } 221 222 define float @log2_f32(float %x) #0 { 223 ; GNU-LABEL: log2_f32: 224 ; GNU: # %bb.0: 225 ; GNU-NEXT: jmp __log2f_finite # TAILCALL 226 ; 227 ; WIN-LABEL: log2_f32: 228 ; WIN: # %bb.0: 229 ; WIN-NEXT: jmp log2f # TAILCALL 230 ; 231 ; MAC-LABEL: log2_f32: 232 ; MAC: ## %bb.0: 233 ; MAC-NEXT: jmp _log2f ## TAILCALL 234 %r = tail call nnan ninf float @llvm.log2.f32(float %x) 235 ret float %r 236 } 237 238 define double @log2_f64(double %x) #0 { 239 ; GNU-LABEL: log2_f64: 240 ; GNU: # %bb.0: 241 ; GNU-NEXT: jmp __log2_finite # TAILCALL 242 ; 243 ; WIN-LABEL: log2_f64: 244 ; WIN: # %bb.0: 245 ; WIN-NEXT: jmp log2 # TAILCALL 246 ; 247 ; MAC-LABEL: log2_f64: 248 ; MAC: ## %bb.0: 249 ; MAC-NEXT: jmp _log2 ## TAILCALL 250 %r = tail call nnan ninf double @llvm.log2.f64(double %x) 251 ret double %r 252 } 253 254 define x86_fp80 @log2_f80(x86_fp80 %x) #0 { 255 ; GNU-LABEL: log2_f80: 256 ; GNU: # %bb.0: 257 ; GNU-NEXT: subq $24, %rsp 258 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp) 259 ; GNU-NEXT: fstpt (%rsp) 260 ; GNU-NEXT: callq __log2l_finite 261 ; GNU-NEXT: addq $24, %rsp 262 ; GNU-NEXT: retq 263 ; 264 ; WIN-LABEL: log2_f80: 265 ; WIN: # %bb.0: 266 ; WIN-NEXT: pushq %rsi 267 ; WIN-NEXT: subq $64, %rsp 268 ; WIN-NEXT: movq %rcx, %rsi 269 ; WIN-NEXT: fldt (%rdx) 270 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp) 271 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx 272 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx 273 ; WIN-NEXT: callq log2l 274 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp) 275 ; WIN-NEXT: fstpt (%rsi) 276 ; WIN-NEXT: movq %rsi, %rax 277 ; WIN-NEXT: addq $64, %rsp 278 ; WIN-NEXT: popq %rsi 279 ; WIN-NEXT: retq 280 ; 281 ; MAC-LABEL: log2_f80: 282 ; MAC: ## %bb.0: 283 ; MAC-NEXT: subq $24, %rsp 284 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp) 285 ; MAC-NEXT: fstpt (%rsp) 286 ; MAC-NEXT: callq _log2l 287 ; MAC-NEXT: addq $24, %rsp 288 ; MAC-NEXT: retq 289 %r = tail call nnan ninf x86_fp80 @llvm.log2.f80(x86_fp80 %x) 290 ret x86_fp80 %r 291 } 292 293 define float @log10_f32(float %x) #0 { 294 ; GNU-LABEL: log10_f32: 295 ; GNU: # %bb.0: 296 ; GNU-NEXT: jmp __log10f_finite # TAILCALL 297 ; 298 ; WIN-LABEL: log10_f32: 299 ; WIN: # %bb.0: 300 ; WIN-NEXT: jmp log10f # TAILCALL 301 ; 302 ; MAC-LABEL: log10_f32: 303 ; MAC: ## %bb.0: 304 ; MAC-NEXT: jmp _log10f ## TAILCALL 305 %r = tail call nnan ninf float @llvm.log10.f32(float %x) 306 ret float %r 307 } 308 309 define double @log10_f64(double %x) #0 { 310 ; GNU-LABEL: log10_f64: 311 ; GNU: # %bb.0: 312 ; GNU-NEXT: jmp __log10_finite # TAILCALL 313 ; 314 ; WIN-LABEL: log10_f64: 315 ; WIN: # %bb.0: 316 ; WIN-NEXT: jmp log10 # TAILCALL 317 ; 318 ; MAC-LABEL: log10_f64: 319 ; MAC: ## %bb.0: 320 ; MAC-NEXT: jmp _log10 ## TAILCALL 321 %r = tail call nnan ninf double @llvm.log10.f64(double %x) 322 ret double %r 323 } 324 325 define x86_fp80 @log10_f80(x86_fp80 %x) #0 { 326 ; GNU-LABEL: log10_f80: 327 ; GNU: # %bb.0: 328 ; GNU-NEXT: subq $24, %rsp 329 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp) 330 ; GNU-NEXT: fstpt (%rsp) 331 ; GNU-NEXT: callq __log10l_finite 332 ; GNU-NEXT: addq $24, %rsp 333 ; GNU-NEXT: retq 334 ; 335 ; WIN-LABEL: log10_f80: 336 ; WIN: # %bb.0: 337 ; WIN-NEXT: pushq %rsi 338 ; WIN-NEXT: subq $64, %rsp 339 ; WIN-NEXT: movq %rcx, %rsi 340 ; WIN-NEXT: fldt (%rdx) 341 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp) 342 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx 343 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx 344 ; WIN-NEXT: callq log10l 345 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp) 346 ; WIN-NEXT: fstpt (%rsi) 347 ; WIN-NEXT: movq %rsi, %rax 348 ; WIN-NEXT: addq $64, %rsp 349 ; WIN-NEXT: popq %rsi 350 ; WIN-NEXT: retq 351 ; 352 ; MAC-LABEL: log10_f80: 353 ; MAC: ## %bb.0: 354 ; MAC-NEXT: subq $24, %rsp 355 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp) 356 ; MAC-NEXT: fstpt (%rsp) 357 ; MAC-NEXT: callq _log10l 358 ; MAC-NEXT: addq $24, %rsp 359 ; MAC-NEXT: retq 360 %r = tail call nnan ninf x86_fp80 @llvm.log10.f80(x86_fp80 %x) 361 ret x86_fp80 %r 362 } 363 364 define float @pow_f32(float %x) #0 { 365 ; GNU-LABEL: pow_f32: 366 ; GNU: # %bb.0: 367 ; GNU-NEXT: movaps %xmm0, %xmm1 368 ; GNU-NEXT: jmp __powf_finite # TAILCALL 369 ; 370 ; WIN-LABEL: pow_f32: 371 ; WIN: # %bb.0: 372 ; WIN-NEXT: movaps %xmm0, %xmm1 373 ; WIN-NEXT: jmp powf # TAILCALL 374 ; 375 ; MAC-LABEL: pow_f32: 376 ; MAC: ## %bb.0: 377 ; MAC-NEXT: movaps %xmm0, %xmm1 378 ; MAC-NEXT: jmp _powf ## TAILCALL 379 %r = tail call nnan ninf float @llvm.pow.f32(float %x, float %x) 380 ret float %r 381 } 382 383 define double @pow_f64(double %x) #0 { 384 ; GNU-LABEL: pow_f64: 385 ; GNU: # %bb.0: 386 ; GNU-NEXT: movaps %xmm0, %xmm1 387 ; GNU-NEXT: jmp __pow_finite # TAILCALL 388 ; 389 ; WIN-LABEL: pow_f64: 390 ; WIN: # %bb.0: 391 ; WIN-NEXT: movaps %xmm0, %xmm1 392 ; WIN-NEXT: jmp pow # TAILCALL 393 ; 394 ; MAC-LABEL: pow_f64: 395 ; MAC: ## %bb.0: 396 ; MAC-NEXT: movaps %xmm0, %xmm1 397 ; MAC-NEXT: jmp _pow ## TAILCALL 398 %r = tail call nnan ninf double @llvm.pow.f64(double %x, double %x) 399 ret double %r 400 } 401 402 define x86_fp80 @pow_f80(x86_fp80 %x) #0 { 403 ; GNU-LABEL: pow_f80: 404 ; GNU: # %bb.0: 405 ; GNU-NEXT: subq $40, %rsp 406 ; GNU-NEXT: fldt {{[0-9]+}}(%rsp) 407 ; GNU-NEXT: fld %st(0) 408 ; GNU-NEXT: fstpt {{[0-9]+}}(%rsp) 409 ; GNU-NEXT: fstpt (%rsp) 410 ; GNU-NEXT: callq __powl_finite 411 ; GNU-NEXT: addq $40, %rsp 412 ; GNU-NEXT: retq 413 ; 414 ; WIN-LABEL: pow_f80: 415 ; WIN: # %bb.0: 416 ; WIN-NEXT: pushq %rsi 417 ; WIN-NEXT: subq $80, %rsp 418 ; WIN-NEXT: movq %rcx, %rsi 419 ; WIN-NEXT: fldt (%rdx) 420 ; WIN-NEXT: fld %st(0) 421 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp) 422 ; WIN-NEXT: fstpt {{[0-9]+}}(%rsp) 423 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rcx 424 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %rdx 425 ; WIN-NEXT: leaq {{[0-9]+}}(%rsp), %r8 426 ; WIN-NEXT: callq powl 427 ; WIN-NEXT: fldt {{[0-9]+}}(%rsp) 428 ; WIN-NEXT: fstpt (%rsi) 429 ; WIN-NEXT: movq %rsi, %rax 430 ; WIN-NEXT: addq $80, %rsp 431 ; WIN-NEXT: popq %rsi 432 ; WIN-NEXT: retq 433 ; 434 ; MAC-LABEL: pow_f80: 435 ; MAC: ## %bb.0: 436 ; MAC-NEXT: subq $40, %rsp 437 ; MAC-NEXT: fldt {{[0-9]+}}(%rsp) 438 ; MAC-NEXT: fld %st(0) 439 ; MAC-NEXT: fstpt {{[0-9]+}}(%rsp) 440 ; MAC-NEXT: fstpt (%rsp) 441 ; MAC-NEXT: callq _powl 442 ; MAC-NEXT: addq $40, %rsp 443 ; MAC-NEXT: retq 444 %r = tail call nnan ninf x86_fp80 @llvm.pow.f80(x86_fp80 %x, x86_fp80 %x) 445 ret x86_fp80 %r 446 } 447 448 declare float @llvm.exp.f32(float) #1 449 declare double @llvm.exp.f64(double) #1 450 declare x86_fp80 @llvm.exp.f80(x86_fp80) #1 451 452 declare float @llvm.exp2.f32(float) #1 453 declare double @llvm.exp2.f64(double) #1 454 declare x86_fp80 @llvm.exp2.f80(x86_fp80) #1 455 456 declare float @llvm.log.f32(float) #1 457 declare double @llvm.log.f64(double) #1 458 declare x86_fp80 @llvm.log.f80(x86_fp80) #1 459 460 declare float @llvm.log2.f32(float) #1 461 declare double @llvm.log2.f64(double) #1 462 declare x86_fp80 @llvm.log2.f80(x86_fp80) #1 463 464 declare float @llvm.log10.f32(float) #1 465 declare double @llvm.log10.f64(double) #1 466 declare x86_fp80 @llvm.log10.f80(x86_fp80) #1 467 468 declare float @llvm.pow.f32(float, float) #1 469 declare double @llvm.pow.f64(double, double) #1 470 declare x86_fp80 @llvm.pow.f80(x86_fp80, x86_fp80) #1 471 472 attributes #0 = { nounwind "no-infs-fp-math"="true" "no-nans-fp-math"="true" } 473 attributes #1 = { nounwind readnone speculatable } 474 475