1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
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.
6 ; But it's better for perf to check that the argument is valid rather than the result of
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.
11 define float @f(float %val) nounwind {
14 ; CHECK-NEXT: xorps %xmm1, %xmm1
15 ; CHECK-NEXT: ucomiss %xmm1, %xmm0
16 ; CHECK-NEXT: jb .LBB0_2
17 ; CHECK-NEXT: # %bb.1: # %.split
18 ; CHECK-NEXT: sqrtss %xmm0, %xmm0
20 ; CHECK-NEXT: .LBB0_2: # %call.sqrt
21 ; CHECK-NEXT: jmp sqrtf # TAILCALL
22 %res = tail call float @sqrtf(float %val)
26 define double @d(double %val) nounwind {
29 ; CHECK-NEXT: xorps %xmm1, %xmm1
30 ; CHECK-NEXT: ucomisd %xmm1, %xmm0
31 ; CHECK-NEXT: jb .LBB1_2
32 ; CHECK-NEXT: # %bb.1: # %.split
33 ; CHECK-NEXT: sqrtsd %xmm0, %xmm0
35 ; CHECK-NEXT: .LBB1_2: # %call.sqrt
36 ; CHECK-NEXT: jmp sqrt # TAILCALL
37 %res = tail call double @sqrt(double %val)
41 declare float @sqrtf(float)
42 declare double @sqrt(double)