1 //===----------------------Hexagon builtin routine ------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 .macro FUNCTION_BEGIN name
13 .type \name, @function
17 .macro FUNCTION_END name
18 .size \name, . - \name
29 #define Q6_ALIAS(TAG) .global __qdsp_##TAG ; .set __qdsp_##TAG, __hexagon_##TAG
30 #define FAST_ALIAS(TAG) .global __hexagon_fast_##TAG ; .set __hexagon_fast_##TAG, __hexagon_##TAG
31 #define FAST2_ALIAS(TAG) .global __hexagon_fast2_##TAG ; .set __hexagon_fast2_##TAG, __hexagon_##TAG
33 FUNCTION_BEGIN __hexagon_sqrtf
35 E,p0 = sfinvsqrta(RIN)
37 HALF = ##0x3f000000 // 0.5
38 r1:0 = combine(#0,#0) // clear S/H
41 S += sfmpy(E,R):lib // S0
42 H += sfmpy(E,HALF):lib // H0
47 D -= sfmpy(S,H):lib // d0
48 p1 = sfclass(R,#1) // is zero?
49 //E -= sfmpy(S,S):lib // e0
52 S += sfmpy(S,D):lib // S1
53 H += sfmpy(H,D):lib // H1
58 D -= sfmpy(S,H):lib // d0
59 E -= sfmpy(S,S):lib // e0
62 S += sfmpy(H,E):lib // S2
63 H += sfmpy(H,D):lib // H2
68 //D -= sfmpy(S,H):lib // d2
69 E -= sfmpy(S,S):lib // e2
70 if (p1) r0 = or(r0,R) // sqrt(-0.0) = -0.0
73 S += sfmpy(H,E,p0):scale // S3
77 FUNCTION_END __hexagon_sqrtf