1 #include <asm/ppc_asm.h>
5 * The routines below are in assembler so we can closely control the
6 * usage of floating-point registers. These routines must be called
7 * with preempt disabled.
14 .long 0x3f800000 /* 1.0 in single-precision FP */
16 .long 0x3f000000 /* 0.5 in single-precision FP */
18 #define LDCONST(fr, name) \
27 .tc FD_3ff00000_0[TC],0x3ff0000000000000 /* 1.0 */
29 .tc FD_3fe00000_0[TC],0x3fe0000000000000 /* 0.5 */
31 #define LDCONST(fr, name) \
37 * Internal routine to enable floating point and set FPSCR to 0.
38 * Don't call it from C; it doesn't use the normal calling convention.
70 * Vector add, floating point.
87 * Vector subtract, floating point.
104 * Vector multiply and add, floating point.
116 fmadds fr0,fr0,fr2,fr1
124 * Vector negative multiply and subtract, floating point.
136 fnmsubs fr0,fr0,fr2,fr1
144 * Vector reciprocal estimate. We just compute 1.0/x.
145 * r3 -> destination, r4 -> source.
162 * Vector reciprocal square-root estimate, floating point.
163 * We use the frsqrte instruction for the initial estimate followed
164 * by 2 iterations of Newton-Raphson to get sufficient accuracy.
165 * r3 -> destination, r4 -> source.
180 frsqrte fr1,fr0 /* r = frsqrte(s) */
181 fmuls fr3,fr1,fr0 /* r * s */
182 fmuls fr2,fr1,fr5 /* r * 0.5 */
183 fnmsubs fr3,fr1,fr3,fr4 /* 1 - s * r * r */
184 fmadds fr1,fr2,fr3,fr1 /* r = r + 0.5 * r * (1 - s * r * r) */
185 fmuls fr3,fr1,fr0 /* r * s */
186 fmuls fr2,fr1,fr5 /* r * 0.5 */
187 fnmsubs fr3,fr1,fr3,fr4 /* 1 - s * r * r */
188 fmadds fr1,fr2,fr3,fr1 /* r = r + 0.5 * r * (1 - s * r * r) */