Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/fpu/fpu_sqrt.c
Show First 20 Lines • Show All 308 Lines • ▼ Show 20 Lines | #define t0 tt | ||||
x->fp_mant[0] = q; | x->fp_mant[0] = q; | ||||
#undef t0 | #undef t0 | ||||
/* calculate q1. note (y0&1)==0. */ | /* calculate q1. note (y0&1)==0. */ | ||||
#define t0 y0 | #define t0 y0 | ||||
#define t1 tt | #define t1 tt | ||||
q = 0; | q = 0; | ||||
y1 = 0; | y1 = 0; | ||||
bit = 1 << 31; | bit = 1U << 31; | ||||
EVEN_DOUBLE; | EVEN_DOUBLE; | ||||
t1 = bit; | t1 = bit; | ||||
FPU_SUBS(d1, x1, t1); | FPU_SUBS(d1, x1, t1); | ||||
FPU_SUBC(d0, x0, t0); /* d = x - t */ | FPU_SUBC(d0, x0, t0); /* d = x - t */ | ||||
if ((int)d0 >= 0) { /* if d >= 0 (i.e., x >= t) then */ | if ((int)d0 >= 0) { /* if d >= 0 (i.e., x >= t) then */ | ||||
x0 = d0, x1 = d1; /* x -= t */ | x0 = d0, x1 = d1; /* x -= t */ | ||||
q = bit; /* q += bit */ | q = bit; /* q += bit */ | ||||
y0 |= 1; /* y += bit << 1 */ | y0 |= 1; /* y += bit << 1 */ | ||||
Show All 14 Lines | #define t1 tt | ||||
x->fp_mant[1] = q; | x->fp_mant[1] = q; | ||||
#undef t1 | #undef t1 | ||||
/* calculate q2. note (y1&1)==0; y0 (aka t0) is fixed. */ | /* calculate q2. note (y1&1)==0; y0 (aka t0) is fixed. */ | ||||
#define t1 y1 | #define t1 y1 | ||||
#define t2 tt | #define t2 tt | ||||
q = 0; | q = 0; | ||||
y2 = 0; | y2 = 0; | ||||
bit = 1 << 31; | bit = 1U << 31; | ||||
EVEN_DOUBLE; | EVEN_DOUBLE; | ||||
t2 = bit; | t2 = bit; | ||||
FPU_SUBS(d2, x2, t2); | FPU_SUBS(d2, x2, t2); | ||||
FPU_SUBCS(d1, x1, t1); | FPU_SUBCS(d1, x1, t1); | ||||
FPU_SUBC(d0, x0, t0); | FPU_SUBC(d0, x0, t0); | ||||
if ((int)d0 >= 0) { | if ((int)d0 >= 0) { | ||||
x0 = d0, x1 = d1, x2 = d2; | x0 = d0, x1 = d1, x2 = d2; | ||||
q |= bit; | q |= bit; | ||||
Show All 16 Lines | #define t2 tt | ||||
x->fp_mant[2] = q; | x->fp_mant[2] = q; | ||||
#undef t2 | #undef t2 | ||||
/* calculate q3. y0, t0, y1, t1 all fixed; y2, t2, almost done. */ | /* calculate q3. y0, t0, y1, t1 all fixed; y2, t2, almost done. */ | ||||
#define t2 y2 | #define t2 y2 | ||||
#define t3 tt | #define t3 tt | ||||
q = 0; | q = 0; | ||||
y3 = 0; | y3 = 0; | ||||
bit = 1 << 31; | bit = 1U << 31; | ||||
EVEN_DOUBLE; | EVEN_DOUBLE; | ||||
t3 = bit; | t3 = bit; | ||||
FPU_SUBS(d3, x3, t3); | FPU_SUBS(d3, x3, t3); | ||||
FPU_SUBCS(d2, x2, t2); | FPU_SUBCS(d2, x2, t2); | ||||
FPU_SUBCS(d1, x1, t1); | FPU_SUBCS(d1, x1, t1); | ||||
FPU_SUBC(d0, x0, t0); | FPU_SUBC(d0, x0, t0); | ||||
ODD_DOUBLE; | ODD_DOUBLE; | ||||
if ((int)d0 >= 0) { | if ((int)d0 >= 0) { | ||||
Show All 28 Lines |