Lines Matching +full:left +full:- +full:shift
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Linux/PA-RISC Project (http://www.parisc-linux.org/)
5 * Floating-point emulation code
6 * Copyright (C) 2001 Hewlett-Packard (Paul Bame) <bame@debian.org>
42 register unsigned int left, right, result, extent; in sgl_fadd() local
52 left = *leftptr; in sgl_fadd()
57 Sgl_xortointp1(left,right,/*to*/save); in sgl_fadd()
62 if ((result_exponent = Sgl_exponent(left)) == SGL_INFINITY_EXPONENT) in sgl_fadd()
64 if (Sgl_iszero_mantissa(left)) in sgl_fadd()
82 *dstptr = left; in sgl_fadd()
91 if (Sgl_isone_signaling(left)) in sgl_fadd()
97 Sgl_set_quiet(left); in sgl_fadd()
115 *dstptr = left; in sgl_fadd()
118 } /* End left NaN or Infinity processing */ in sgl_fadd()
151 Sgl_copytoint_exponentmantissa(left,signless_upper_left); in sgl_fadd()
157 /* Set the left operand to the larger one by XOR swap * in sgl_fadd()
160 Sgl_xorfromintp1(save,left,/*to*/left); in sgl_fadd()
161 result_exponent = Sgl_exponent(left); in sgl_fadd()
163 /* Invariant: left is not smaller than right. */ in sgl_fadd()
171 if(Sgl_iszero_exponentmantissa(left)) in sgl_fadd()
176 Sgl_or_signs(left,/*with*/right); in sgl_fadd()
180 Sgl_and_signs(left,/*with*/right); in sgl_fadd()
185 /* Left is not a zero and must be the result. Trapped in sgl_fadd()
186 * underflows are signaled if left is denormalized. Result in sgl_fadd()
191 sign_save = Sgl_signextendedsign(left); in sgl_fadd()
192 Sgl_leftshiftby1(left); in sgl_fadd()
193 Sgl_normalize(left,result_exponent); in sgl_fadd()
194 Sgl_set_sign(left,/*using*/sign_save); in sgl_fadd()
195 Sgl_setwrapped_exponent(left,result_exponent,unfl); in sgl_fadd()
196 *dstptr = left; in sgl_fadd()
200 *dstptr = left; in sgl_fadd()
213 Sgl_subtract(left,/*minus*/right,/*into*/result); in sgl_fadd()
230 Sgl_addition(left,right,/*into*/result); in sgl_fadd()
258 Sgl_clear_exponent_set_hidden(left); in sgl_fadd()
259 diff_exponent = result_exponent - right_exponent; in sgl_fadd()
284 Sgl_subtract_withextension(left,/*minus*/right,/*with*/extent,/*into*/result); in sgl_fadd()
288 /* A straightforward algorithm would now shift the result in sgl_fadd()
289 * and extension left until the hidden bit becomes one. Not in sgl_fadd()
290 * all of the extension bits need participate in the shift. in sgl_fadd()
292 * needed. If only a single shift is needed then the guard in sgl_fadd()
295 * shift is needed, then all bits to the right of the guard in sgl_fadd()
305 /* Must have been "x-x" or "x+(-x)". */ in sgl_fadd()
311 result_exponent--; in sgl_fadd()
317 /* Denormalized, exponent should be zero. Left operand * in sgl_fadd()
330 /* Check for denormalized, exponent should be zero. Left * in sgl_fadd()
335 /* Shift extension to complete one bit of normalization and in sgl_fadd()
339 /* Discover first one bit to determine shift amount. Use a in sgl_fadd()
347 if((result_exponent -= 8) <= 0 && !underflowtrap) in sgl_fadd()
355 if((result_exponent -= 4) <= 0 && !underflowtrap) in sgl_fadd()
359 * otherwise select the proper shift. */ in sgl_fadd()
375 result_exponent -= 3; in sgl_fadd()
382 result_exponent -= 2; in sgl_fadd()
391 result_exponent -= 1; in sgl_fadd()
415 Sgl_right_align(result,/*by*/(1-result_exponent),extent); in sgl_fadd()
426 Sgl_addition(left,right,/*to*/result); in sgl_fadd()
439 * all zeros so no shift is needed. */ in sgl_fadd()