Lines Matching +full:x +full:- +full:y

1 /* Software floating-point emulation.
2 Basic one-word fraction declaration and manipulation.
23 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
28 #define _FP_FRAC_DECL_1(X) _FP_W_TYPE X##_f=0 argument
30 #define _FP_FRAC_SET_1(X,I) (X##_f = I) argument
31 #define _FP_FRAC_HIGH_1(X) (X##_f) argument
32 #define _FP_FRAC_LOW_1(X) (X##_f) argument
33 #define _FP_FRAC_WORD_1(X,w) (X##_f) argument
35 #define _FP_FRAC_ADDI_1(X,I) (X##_f += I) argument
36 #define _FP_FRAC_SLL_1(X,N) \ argument
39 X##_f += X##_f; \
41 X##_f <<= (N); \
43 #define _FP_FRAC_SRL_1(X,N) (X##_f >>= N) argument
45 /* Right shift with sticky-lsb. */
46 #define _FP_FRAC_SRS_1(X,N,sz) __FP_FRAC_SRS_1(X##_f, N, sz) argument
48 #define __FP_FRAC_SRS_1(X,N,sz) \ argument
49 (X = (X >> (N) | (__builtin_constant_p(N) && (N) == 1 \
50 ? X & 1 : (X << (_FP_W_TYPE_SIZE - (N))) != 0)))
52 #define _FP_FRAC_ADD_1(R,X,Y) (R##_f = X##_f + Y##_f) argument
53 #define _FP_FRAC_SUB_1(R,X,Y) (R##_f = X##_f - Y##_f) argument
54 #define _FP_FRAC_DEC_1(X,Y) (X##_f -= Y##_f) argument
55 #define _FP_FRAC_CLZ_1(z, X) __FP_CLZ(z, X##_f) argument
58 #define _FP_FRAC_NEGP_1(X) ((_FP_WS_TYPE)X##_f < 0) argument
59 #define _FP_FRAC_ZEROP_1(X) (X##_f == 0) argument
60 #define _FP_FRAC_OVERP_1(fs,X) (X##_f & _FP_OVERFLOW_##fs) argument
61 #define _FP_FRAC_CLEAR_OVERP_1(fs,X) (X##_f &= ~_FP_OVERFLOW_##fs) argument
62 #define _FP_FRAC_EQ_1(X, Y) (X##_f == Y##_f) argument
63 #define _FP_FRAC_GE_1(X, Y) (X##_f >= Y##_f) argument
64 #define _FP_FRAC_GT_1(X, Y) (X##_f > Y##_f) argument
75 #define _FP_UNPACK_RAW_1(fs, X, val) \ argument
79 X##_f = _flo.bits.frac; \
80 X##_e = _flo.bits.exp; \
81 X##_s = _flo.bits.sign; \
84 #define _FP_UNPACK_RAW_1_P(fs, X, val) \ argument
89 X##_f = _flo->bits.frac; \
90 X##_e = _flo->bits.exp; \
91 X##_s = _flo->bits.sign; \
98 #define _FP_PACK_RAW_1(fs, val, X) \ argument
102 _flo.bits.frac = X##_f; \
103 _flo.bits.exp = X##_e; \
104 _flo.bits.sign = X##_s; \
109 #define _FP_PACK_RAW_1_P(fs, val, X) \ argument
114 _flo->bits.frac = X##_f; \
115 _flo->bits.exp = X##_e; \
116 _flo->bits.sign = X##_s; \
127 #define _FP_MUL_MEAT_1_imm(wfracbits, R, X, Y) \ argument
129 R##_f = X##_f * Y##_f; \
132 at either 2B or 2B-1. */ \
133 _FP_FRAC_SRS_1(R, wfracbits-1, 2*wfracbits); \
138 #define _FP_MUL_MEAT_1_wide(wfracbits, R, X, Y, doit) \ argument
141 doit(_Z_f1, _Z_f0, X##_f, Y##_f); \
144 at either 2B or 2B-1. */ \
145 _FP_FRAC_SRS_2(_Z, wfracbits-1, 2*wfracbits); \
151 #define _FP_MUL_MEAT_1_hard(wfracbits, R, X, Y) \ argument
156 _xh = X##_f >> (_FP_W_TYPE_SIZE/2); \
157 _xl = X##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1); \
158 _yh = Y##_f >> (_FP_W_TYPE_SIZE/2); \
159 _yl = Y##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1); \
175 _FP_FRAC_SRS_2(_z, wfracbits - 1, 2*wfracbits); \
189 #define _FP_DIV_MEAT_1_imm(fs, R, X, Y, doit) \ argument
192 X##_f <<= (X##_f < Y##_f \
193 ? R##_e--, _FP_WFRACBITS_##fs \
194 : _FP_WFRACBITS_##fs - 1); \
195 doit(_q, _r, X##_f, Y##_f); \
204 #define _FP_DIV_MEAT_1_udiv_norm(fs, R, X, Y) \ argument
208 /* Normalize Y -- i.e. make the most significant bit set. */ \
209 _y = Y##_f << _FP_WFRACXBITS_##fs; \
211 /* Shift X op correspondingly high, that is, up one full word. */ \
212 if (X##_f < Y##_f) \
214 R##_e--; \
216 _nh = X##_f; \
220 _nl = X##_f << (_FP_W_TYPE_SIZE - 1); \
221 _nh = X##_f >> 1; \
228 #define _FP_DIV_MEAT_1_udiv(fs, R, X, Y) \ argument
231 if (X##_f < Y##_f) \
233 R##_e--; \
234 _nl = X##_f << _FP_WFRACBITS_##fs; \
235 _nh = X##_f >> _FP_WFRACXBITS_##fs; \
239 _nl = X##_f << (_FP_WFRACBITS_##fs - 1); \
240 _nh = X##_f >> (_FP_WFRACXBITS_##fs + 1); \
242 udiv_qrnnd(_q, _r, _nh, _nl, Y##_f); \
253 #define _FP_SQRT_MEAT_1(R, S, T, X, q) \ argument
258 if (T##_f <= X##_f) \
261 X##_f -= T##_f; \
264 _FP_FRAC_SLL_1(X, 1); \
267 if (X##_f) \
269 if (S##_f < X##_f) \
280 #define _FP_FRAC_ASSEMBLE_1(r, X, rsize) (r = X##_f) argument
281 #define _FP_FRAC_DISASSEMBLE_1(X, r, rsize) (X##_f = r) argument
294 _FP_FRAC_SRS_1(D, (_FP_WFRACBITS_##sfs-_FP_WFRACBITS_##dfs), \
297 _FP_FRAC_SRL_1(D, (_FP_WFRACBITS_##sfs-_FP_WFRACBITS_##dfs)); \
300 D##_f <<= _FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs; \