Update SoftFloat
[riscv-isa-sim.git] / softfloat / f32_sqrt.c
index d0b489c5ba459a1fdde8e14c97fde8ced02f8624..5ef659e4f2d696bb901461d48af6d7c12a8bd818 100644 (file)
@@ -2,10 +2,10 @@
 /*============================================================================
 
 This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
-Package, Release 3a, by John R. Hauser.
+Package, Release 3d, by John R. Hauser.
 
-Copyright 2011, 2012, 2013, 2014 The Regents of the University of California.
-All rights reserved.
+Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
+California.  All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
@@ -94,13 +94,13 @@ float32_t f32_sqrt( float32_t a )
         ((uint_fast64_t) sigA * softfloat_approxRecipSqrt32_1( expA, sigA ))
             >>32;
     if ( expA ) sigZ >>= 1;
-    sigZ += 2;
     /*------------------------------------------------------------------------
     *------------------------------------------------------------------------*/
+    sigZ += 2;
     if ( (sigZ & 0x3F) < 2 ) {
         shiftedSigZ = sigZ>>2;
         negRem = shiftedSigZ * shiftedSigZ;
-        sigZ = shiftedSigZ<<2;
+        sigZ &= ~3;
         if ( negRem & 0x80000000 ) {
             sigZ |= 1;
         } else {