| Sanjay Patel | c021892 | 2017-11-19 17:31:37 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| 2 | ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s |
| 3 | |
| 4 | ; PR31455 - https://bugs.llvm.org/show_bug.cgi?id=31455 |
| 5 | ; We have to assume that errno can be set, so we have to make a libcall in that case. |
| Sanjay Patel | 0de1a4b | 2017-11-27 21:15:43 +0000 | [diff] [blame] | 6 | ; But it's better for perf to check that the argument is valid rather than the result of |
| Sanjay Patel | c021892 | 2017-11-19 17:31:37 +0000 | [diff] [blame] | 7 | ; sqrtss/sqrtsd. |
| 8 | ; Note: This is really a test of the -partially-inline-libcalls IR pass (and we have an IR test |
| 9 | ; for that), but we're checking the final asm to make sure that comes out as expected too. |
| 10 | |
| 11 | define float @f(float %val) nounwind { |
| 12 | ; CHECK-LABEL: f: |
| Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 13 | ; CHECK: # %bb.0: |
| Sanjay Patel | 0de1a4b | 2017-11-27 21:15:43 +0000 | [diff] [blame] | 14 | ; CHECK-NEXT: xorps %xmm1, %xmm1 |
| 15 | ; CHECK-NEXT: ucomiss %xmm1, %xmm0 |
| 16 | ; CHECK-NEXT: jb .LBB0_2 |
| Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 17 | ; CHECK-NEXT: # %bb.1: # %.split |
| Sanjay Patel | 0de1a4b | 2017-11-27 21:15:43 +0000 | [diff] [blame] | 18 | ; CHECK-NEXT: sqrtss %xmm0, %xmm0 |
| Sanjay Patel | c021892 | 2017-11-19 17:31:37 +0000 | [diff] [blame] | 19 | ; CHECK-NEXT: retq |
| 20 | ; CHECK-NEXT: .LBB0_2: # %call.sqrt |
| 21 | ; CHECK-NEXT: jmp sqrtf # TAILCALL |
| 22 | %res = tail call float @sqrtf(float %val) |
| 23 | ret float %res |
| 24 | } |
| 25 | |
| 26 | define double @d(double %val) nounwind { |
| 27 | ; CHECK-LABEL: d: |
| Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 28 | ; CHECK: # %bb.0: |
| Sanjay Patel | 0de1a4b | 2017-11-27 21:15:43 +0000 | [diff] [blame] | 29 | ; CHECK-NEXT: xorps %xmm1, %xmm1 |
| 30 | ; CHECK-NEXT: ucomisd %xmm1, %xmm0 |
| 31 | ; CHECK-NEXT: jb .LBB1_2 |
| Francis Visoiu Mistrih | 25528d6 | 2017-12-04 17:18:51 +0000 | [diff] [blame] | 32 | ; CHECK-NEXT: # %bb.1: # %.split |
| Sanjay Patel | 0de1a4b | 2017-11-27 21:15:43 +0000 | [diff] [blame] | 33 | ; CHECK-NEXT: sqrtsd %xmm0, %xmm0 |
| Sanjay Patel | c021892 | 2017-11-19 17:31:37 +0000 | [diff] [blame] | 34 | ; CHECK-NEXT: retq |
| 35 | ; CHECK-NEXT: .LBB1_2: # %call.sqrt |
| 36 | ; CHECK-NEXT: jmp sqrt # TAILCALL |
| 37 | %res = tail call double @sqrt(double %val) |
| 38 | ret double %res |
| 39 | } |
| 40 | |
| 41 | declare float @sqrtf(float) |
| 42 | declare double @sqrt(double) |
| 43 | |