1 #include <linux/config.h>
2 #include <asm/ppc_asm.h>
6 * The routines below are in assembler so we can closely control the
7 * usage of floating-point registers. These routines must be called
8 * with preempt disabled.
15 .long 0x3f800000 /* 1.0 in single-precision FP */
17 .long 0x3f000000 /* 0.5 in single-precision FP */
19 #define LDCONST(fr, name) \
28 .tc FD_3ff00000_0[TC],0x3ff0000000000000 /* 1.0 */
30 .tc FD_3fe00000_0[TC],0x3fe0000000000000 /* 0.5 */
32 #define LDCONST(fr, name) \
38 * Internal routine to enable floating point and set FPSCR to 0.
39 * Don't call it from C; it doesn't use the normal calling convention.
71 * Vector add, floating point.
88 * Vector subtract, floating point.
105 * Vector multiply and add, floating point.
117 fmadds fr0,fr0,fr2,fr1
125 * Vector negative multiply and subtract, floating point.
137 fnmsubs fr0,fr0,fr2,fr1
145 * Vector reciprocal estimate. We just compute 1.0/x.
146 * r3 -> destination, r4 -> source.
163 * Vector reciprocal square-root estimate, floating point.
164 * We use the frsqrte instruction for the initial estimate followed
165 * by 2 iterations of Newton-Raphson to get sufficient accuracy.
166 * r3 -> destination, r4 -> source.
181 frsqrte fr1,fr0 /* r = frsqrte(s) */
182 fmuls fr3,fr1,fr0 /* r * s */
183 fmuls fr2,fr1,fr5 /* r * 0.5 */
184 fnmsubs fr3,fr1,fr3,fr4 /* 1 - s * r * r */
185 fmadds fr1,fr2,fr3,fr1 /* r = r + 0.5 * r * (1 - s * r * r) */
186 fmuls fr3,fr1,fr0 /* r * s */
187 fmuls fr2,fr1,fr5 /* r * 0.5 */
188 fnmsubs fr3,fr1,fr3,fr4 /* 1 - s * r * r */
189 fmadds fr1,fr2,fr3,fr1 /* r = r + 0.5 * r * (1 - s * r * r) */