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. 6; But it's better for perf to check that the argument is valid rather than the result of 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 11define float @f(float %val) nounwind { 12; CHECK-LABEL: f: 13; CHECK: # %bb.0: 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 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 26define double @d(double %val) nounwind { 27; CHECK-LABEL: d: 28; CHECK: # %bb.0: 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 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 41declare float @sqrtf(float) 42declare double @sqrt(double) 43 44