1 #include <asm/ppc_asm.h>
2 #include <asm/processor.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.
13 .tc FD_3ff00000_0[TC],0x3ff0000000000000 /* 1.0 */
15 .tc FD_3fe00000_0[TC],0x3fe0000000000000 /* 0.5 */
19 * Internal routine to enable floating point and set FPSCR to 0.
20 * Don't call it from C; it doesn't use the normal calling convention.
31 lfd fr1,fpzero@toc(r2)
46 * Vector add, floating point.
63 * Vector subtract, floating point.
80 * Vector multiply and add, floating point.
92 fmadds fr0,fr0,fr2,fr1
100 * Vector negative multiply and subtract, floating point.
112 fnmsubs fr0,fr0,fr2,fr1
120 * Vector reciprocal estimate. We just compute 1.0/x.
121 * r3 -> destination, r4 -> source.
127 lfd fr1,fpone@toc(r2)
138 * Vector reciprocal square-root estimate, floating point.
139 * We use the frsqrte instruction for the initial estimate followed
140 * by 2 iterations of Newton-Raphson to get sufficient accuracy.
141 * r3 -> destination, r4 -> source.
151 lfd fr4,fpone@toc(r2)
152 lfd fr5,fphalf@toc(r2)
156 frsqrte fr1,fr0 /* r = frsqrte(s) */
157 fmuls fr3,fr1,fr0 /* r * s */
158 fmuls fr2,fr1,fr5 /* r * 0.5 */
159 fnmsubs fr3,fr1,fr3,fr4 /* 1 - s * r * r */
160 fmadds fr1,fr2,fr3,fr1 /* r = r + 0.5 * r * (1 - s * r * r) */
161 fmuls fr3,fr1,fr0 /* r * s */
162 fmuls fr2,fr1,fr5 /* r * 0.5 */
163 fnmsubs fr3,fr1,fr3,fr4 /* 1 - s * r * r */
164 fmadds fr1,fr2,fr3,fr1 /* r = r + 0.5 * r * (1 - s * r * r) */