Lines Matching full:y

44  * Perform an FPU add (return x + y).
46 * To subtract, negate y and call add.
61 struct fpn *x = &fe->fe_f1, *y = &fe->fe_f2, *r; in fpu_add() local
70 * - y = NaN. Implied: if only one is a signalling NaN, y is. in fpu_add()
71 * The result is y. in fpu_add()
72 * - y = Inf. Implied: x != NaN (is 0, number, or Inf: the NaN in fpu_add()
74 * If x = -y, the result is NaN. Otherwise the result in fpu_add()
75 * is y (an Inf of whichever sign). in fpu_add()
76 * - y is 0. Implied: x = 0. in fpu_add()
77 * If x and y differ in sign (one positive, one negative), in fpu_add()
80 * - x is 0. Implied: y != 0. in fpu_add()
81 * Result is y. in fpu_add()
82 * - other. Implied: both x and y are numbers. in fpu_add()
87 DUMPFPN(FPE_REG, y); in fpu_add()
89 ORDER(x, y); in fpu_add()
90 if (ISNAN(y)) { in fpu_add()
92 DUMPFPN(FPE_REG, y); in fpu_add()
93 return (y); in fpu_add()
95 if (ISINF(y)) { in fpu_add()
96 if (ISINF(x) && x->fp_sign != y->fp_sign) { in fpu_add()
100 DUMPFPN(FPE_REG, y); in fpu_add()
101 return (y); in fpu_add()
104 if (ISZERO(y)) { in fpu_add()
106 y->fp_sign &= x->fp_sign; in fpu_add()
108 y->fp_sign |= x->fp_sign; in fpu_add()
109 DUMPFPN(FPE_REG, y); in fpu_add()
110 return (y); in fpu_add()
113 DUMPFPN(FPE_REG, y); in fpu_add()
114 return (y); in fpu_add()
121 * of x and y here. in fpu_add()
125 if (x->fp_exp == y->fp_exp) { in fpu_add()
129 if (x->fp_exp < y->fp_exp) { in fpu_add()
134 SWAP(x, y); in fpu_add()
136 /* now x->fp_exp > y->fp_exp */ in fpu_add()
138 r->fp_sticky = fpu_shr(y, x->fp_exp - y->fp_exp); in fpu_add()
141 if (x->fp_sign == y->fp_sign) { in fpu_add()
150 /* r->fp_mant = x->fp_mant + y->fp_mant */ in fpu_add()
151 FPU_ADDS(r->fp_mant[3], x->fp_mant[3], y->fp_mant[3]); in fpu_add()
152 FPU_ADDCS(r->fp_mant[2], x->fp_mant[2], y->fp_mant[2]); in fpu_add()
153 FPU_ADDCS(r->fp_mant[1], x->fp_mant[1], y->fp_mant[1]); in fpu_add()
154 FPU_ADDC(r0, x->fp_mant[0], y->fp_mant[0]); in fpu_add()
167 * y from x, regardless of whether y itself is the negative in fpu_add()
169 * hold, depending on the magnitudes of x and y: in fpu_add()
170 * case i) |x| > |y|. The result is just x - y, in fpu_add()
172 * case ii) |x| = |y|. The result is 0 (maybe -0) in fpu_add()
174 * case iii) |x| < |y|. We goofed; the result should in fpu_add()
175 * be (y - x), with the same sign as y. in fpu_add()
176 * We could compare |x| and |y| here and avoid case iii, in fpu_add()
180 * N.B.: since x->fp_exp >= y->fp_exp, x->fp_sticky = 0. in fpu_add()
182 /* r->fp_mant = x->fp_mant - y->fp_mant */ in fpu_add()
183 FPU_SET_CARRY(y->fp_sticky); in fpu_add()
184 FPU_SUBCS(r3, x->fp_mant[3], y->fp_mant[3]); in fpu_add()
185 FPU_SUBCS(r2, x->fp_mant[2], y->fp_mant[2]); in fpu_add()
186 FPU_SUBCS(r1, x->fp_mant[1], y->fp_mant[1]); in fpu_add()
187 FPU_SUBC(r0, x->fp_mant[0], y->fp_mant[0]); in fpu_add()
200 * x nor y have sticky bits set. Flip the sign in fpu_add()
201 * (to y's sign) and negate the result to get y - x. in fpu_add()
204 if (x->fp_exp != y->fp_exp || r->fp_sticky) in fpu_add()
207 r->fp_sign = y->fp_sign; in fpu_add()