Lines Matching +full:a +full:- +full:z
5 This C source fragment is part of the SoftFloat IEC/IEEE Floating-point
11 National Science Foundation under grant MIP-9311980. The original version
12 of this code was written as part of a project to build a fixed-point vector
16 http://www.jhauser.us/arithmetic/SoftFloat-2b/SoftFloat-source.txt
33 -------------------------------------------------------------------------------
34 Shifts `a' right by the number of bits given in `count'. If any nonzero
38 result will be either 0 or 1, depending on whether `a' is zero or nonzero.
40 -------------------------------------------------------------------------------
42 INLINE void shift32RightJamming( bits32 a, int16 count, bits32 *zPtr )
44 bits32 z;
46 z = a;
49 z = ( a>>count ) | ( ( a<<( ( - count ) & 31 ) ) != 0 );
52 z = ( a != 0 );
54 *zPtr = z;
58 -------------------------------------------------------------------------------
59 Shifts `a' right by the number of bits given in `count'. If any nonzero
63 result will be either 0 or 1, depending on whether `a' is zero or nonzero.
65 -------------------------------------------------------------------------------
67 INLINE void shift64RightJamming( bits64 a, int16 count, bits64 *zPtr )
69 bits64 z;
71 __asm__("@shift64RightJamming -- start");
73 z = a;
76 z = ( a>>count ) | ( ( a<<( ( - count ) & 63 ) ) != 0 );
79 z = ( a != 0 );
81 __asm__("@shift64RightJamming -- end");
82 *zPtr = z;
86 -------------------------------------------------------------------------------
87 Shifts the 128-bit value formed by concatenating `a0' and `a1' right by 64
90 bits shifted off form a second 64-bit result as follows: The _last_ bit
91 shifted off is the most-significant bit of the extra result, and the other
95 (This routine makes more sense if `a0' and `a1' are considered to form a
96 fixed-point value with binary point between `a0' and `a1'. This fixed-point
101 -------------------------------------------------------------------------------
108 int8 negCount = ( - count ) & 63;
133 -------------------------------------------------------------------------------
134 Shifts the 128-bit value formed by concatenating `a0' and `a1' right by the
137 than 128, the result will be 0. The result is broken into two 64-bit pieces
139 -------------------------------------------------------------------------------
146 int8 negCount = ( - count ) & 63;
166 -------------------------------------------------------------------------------
167 Shifts the 128-bit value formed by concatenating `a0' and `a1' right by the
173 nonzero. The result is broken into two 64-bit pieces which are stored at
175 -------------------------------------------------------------------------------
182 int8 negCount = ( - count ) & 63;
210 -------------------------------------------------------------------------------
211 Shifts the 192-bit value formed by concatenating `a0', `a1', and `a2' right
213 at most 128 nonzero bits; these are broken into two 64-bit pieces which are
215 off form a third 64-bit result as follows: The _last_ bit shifted off is
216 the most-significant bit of the extra result, and the other 63 bits of the
221 to form a fixed-point value with binary point between `a1' and `a2'. This
222 fixed-point value is shifted right by the number of bits given in `count',
227 -------------------------------------------------------------------------------
241 int8 negCount = ( - count ) & 63;
281 -------------------------------------------------------------------------------
282 Shifts the 128-bit value formed by concatenating `a0' and `a1' left by the
284 of `count' must be less than 64. The result is broken into two 64-bit
286 -------------------------------------------------------------------------------
295 ( count == 0 ) ? a0 : ( a0<<count ) | ( a1>>( ( - count ) & 63 ) );
300 -------------------------------------------------------------------------------
301 Shifts the 192-bit value formed by concatenating `a0', `a1', and `a2' left
304 64-bit pieces which are stored at the locations pointed to by `z0Ptr',
306 -------------------------------------------------------------------------------
326 negCount = ( ( - count ) & 63 );
337 -------------------------------------------------------------------------------
338 Adds the 128-bit value formed by concatenating `a0' and `a1' to the 128-bit
340 any carry out is lost. The result is broken into two 64-bit pieces which
342 -------------------------------------------------------------------------------
357 -------------------------------------------------------------------------------
358 Adds the 192-bit value formed by concatenating `a0', `a1', and `a2' to the
359 192-bit value formed by concatenating `b0', `b1', and `b2'. Addition is
361 64-bit pieces which are stored at the locations pointed to by `z0Ptr',
363 -------------------------------------------------------------------------------
396 -------------------------------------------------------------------------------
397 Subtracts the 128-bit value formed by concatenating `b0' and `b1' from the
398 128-bit value formed by concatenating `a0' and `a1'. Subtraction is modulo
400 64-bit pieces which are stored at the locations pointed to by `z0Ptr' and
402 -------------------------------------------------------------------------------
409 *z1Ptr = a1 - b1;
410 *z0Ptr = a0 - b0 - ( a1 < b1 );
415 -------------------------------------------------------------------------------
416 Subtracts the 192-bit value formed by concatenating `b0', `b1', and `b2'
417 from the 192-bit value formed by concatenating `a0', `a1', and `a2'.
419 result is broken into three 64-bit pieces which are stored at the locations
421 -------------------------------------------------------------------------------
439 z2 = a2 - b2;
441 z1 = a1 - b1;
443 z0 = a0 - b0;
444 z0 -= ( z1 < borrow1 );
445 z1 -= borrow1;
446 z0 -= borrow0;
454 -------------------------------------------------------------------------------
455 Multiplies `a' by `b' to obtain a 128-bit product. The product is broken
456 into two 64-bit pieces which are stored at the locations pointed to by
458 -------------------------------------------------------------------------------
460 INLINE void mul64To128( bits64 a, bits64 b, bits64 *z0Ptr, bits64 *z1Ptr )
465 aLow = a;
466 aHigh = a>>32;
484 -------------------------------------------------------------------------------
485 Multiplies the 128-bit value formed by concatenating `a0' and `a1' by `b' to
486 obtain a 192-bit product. The product is broken into three 64-bit pieces
489 -------------------------------------------------------------------------------
513 -------------------------------------------------------------------------------
514 Multiplies the 128-bit value formed by concatenating `a0' and `a1' to the
515 128-bit value formed by concatenating `b0' and `b1' to obtain a 256-bit
516 product. The product is broken into four 64-bit pieces which are stored at
518 -------------------------------------------------------------------------------
551 -------------------------------------------------------------------------------
552 Returns an approximation to the 64-bit integer quotient obtained by dividing
553 `b' into the 128-bit value formed by concatenating `a0' and `a1'. The
556 If the exact quotient q is larger than 64 bits, the maximum positive 64-bit
558 -------------------------------------------------------------------------------
564 bits64 z;
568 z = LIT64( 0xFFFFFFFF00000000 );
570 z = a0;
571 do_div( z, b0 );
572 z <<= 32;
574 mul64To128( b, z, &term0, &term1 );
577 z -= LIT64( 0x100000000 );
583 z |= 0xFFFFFFFF;
586 z |= rem0;
588 return z;
593 -------------------------------------------------------------------------------
594 Returns an approximation to the square root of the 32-bit significand given
595 by `a'. Considered as an integer, `a' must be at least 2^31. If bit 0 of
597 2^31*sqrt(`a'/2^31), where `a' is considered an integer. If bit 0 of `aExp'
598 is 0, the integer returned approximates 2^31*sqrt(`a'/2^30). In either
599 case, the approximation returned lies strictly within +/-2 of the exact
601 -------------------------------------------------------------------------------
603 static bits32 estimateSqrt32( int16 aExp, bits32 a )
614 bits32 z;
615 bits64 A;
617 index = ( a>>27 ) & 15;
619 z = 0x4000 + ( a>>17 ) - sqrtOddAdjustments[ index ];
620 z = ( ( a / z )<<14 ) + ( z<<15 );
621 a >>= 1;
624 z = 0x8000 + ( a>>17 ) - sqrtEvenAdjustments[ index ];
625 z = a / z + z;
626 z = ( 0x20000 <= z ) ? 0xFFFF8000 : ( z<<15 );
627 if ( z <= a ) return (bits32) ( ( (sbits32) a )>>1 );
629 A = ( (bits64) a )<<31;
630 do_div( A, z );
631 return ( (bits32) A ) + ( z>>1 );
636 -------------------------------------------------------------------------------
637 Returns the number of leading 0 bits before the most-significant 1 bit
638 of `a'. If `a' is zero, 32 is returned.
639 -------------------------------------------------------------------------------
641 static int8 countLeadingZeros32( bits32 a )
664 if ( a < 0x10000 ) {
666 a <<= 16;
668 if ( a < 0x1000000 ) {
670 a <<= 8;
672 shiftCount += countLeadingZerosHigh[ a>>24 ];
678 -------------------------------------------------------------------------------
679 Returns the number of leading 0 bits before the most-significant 1 bit
680 of `a'. If `a' is zero, 64 is returned.
681 -------------------------------------------------------------------------------
683 static int8 countLeadingZeros64( bits64 a )
688 if ( a < ( (bits64) 1 )<<32 ) {
692 a >>= 32;
694 shiftCount += countLeadingZeros32( a );
700 -------------------------------------------------------------------------------
701 Returns 1 if the 128-bit value formed by concatenating `a0' and `a1'
702 is equal to the 128-bit value formed by concatenating `b0' and `b1'.
704 -------------------------------------------------------------------------------
714 -------------------------------------------------------------------------------
715 Returns 1 if the 128-bit value formed by concatenating `a0' and `a1' is less
716 than or equal to the 128-bit value formed by concatenating `b0' and `b1'.
718 -------------------------------------------------------------------------------
728 -------------------------------------------------------------------------------
729 Returns 1 if the 128-bit value formed by concatenating `a0' and `a1' is less
730 than the 128-bit value formed by concatenating `b0' and `b1'. Otherwise,
732 -------------------------------------------------------------------------------
742 -------------------------------------------------------------------------------
743 Returns 1 if the 128-bit value formed by concatenating `a0' and `a1' is
744 not equal to the 128-bit value formed by concatenating `b0' and `b1'.
746 -------------------------------------------------------------------------------