Module Name:    src
Committed By:   matt
Date:           Thu Jan 10 08:16:11 UTC 2013

Modified Files:
        src/lib/libc/softfloat: fpsetmask.c fpsetround.c fpsetsticky.c
            softfloat-specialize
        src/lib/libc/softfloat/bits32: softfloat.c
        src/lib/libc/softfloat/bits64: softfloat.c

Log Message:
Add hooks to softfloat to support per-lwp exception state.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/softfloat/fpsetmask.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/softfloat/fpsetround.c \
    src/lib/libc/softfloat/fpsetsticky.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/softfloat/softfloat-specialize
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/softfloat/bits32/softfloat.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/softfloat/bits64/softfloat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/softfloat/fpsetmask.c
diff -u src/lib/libc/softfloat/fpsetmask.c:1.4 src/lib/libc/softfloat/fpsetmask.c:1.5
--- src/lib/libc/softfloat/fpsetmask.c:1.4	Mon Apr 28 20:23:00 2008
+++ src/lib/libc/softfloat/fpsetmask.c	Thu Jan 10 08:16:10 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: fpsetmask.c,v 1.4 2008/04/28 20:23:00 martin Exp $ */
+/* $NetBSD: fpsetmask.c,v 1.5 2013/01/10 08:16:10 matt Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetmask.c,v 1.4 2008/04/28 20:23:00 martin Exp $");
+__RCSID("$NetBSD: fpsetmask.c,v 1.5 2013/01/10 08:16:10 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -50,9 +50,11 @@ __weak_alias(fpsetmask,_fpsetmask)
 fp_except
 fpsetmask(fp_except mask)
 {
-	fp_except old;
-
-	old = float_exception_mask;
+#ifdef set_float_exception_mask
+	return set_float_exception_mask(mask);
+#else
+	const fp_except old = float_exception_mask;
 	float_exception_mask = mask;
 	return old;
+#endif
 }

Index: src/lib/libc/softfloat/fpsetround.c
diff -u src/lib/libc/softfloat/fpsetround.c:1.3 src/lib/libc/softfloat/fpsetround.c:1.4
--- src/lib/libc/softfloat/fpsetround.c:1.3	Mon Apr 28 20:23:00 2008
+++ src/lib/libc/softfloat/fpsetround.c	Thu Jan 10 08:16:10 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: fpsetround.c,v 1.3 2008/04/28 20:23:00 martin Exp $ */
+/* $NetBSD: fpsetround.c,v 1.4 2013/01/10 08:16:10 matt Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetround.c,v 1.3 2008/04/28 20:23:00 martin Exp $");
+__RCSID("$NetBSD: fpsetround.c,v 1.4 2013/01/10 08:16:10 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -50,9 +50,11 @@ __weak_alias(fpsetround,_fpsetround)
 fp_rnd
 fpsetround(fp_rnd rnd_dir)
 {
-	fp_rnd old;
-
-	old = float_rounding_mode;
+#ifdef set_float_rounding_mode
+	return set_float_rounding_mode(rnd_dir);
+#else
+	const fp_rnd old = float_rounding_mode;
 	float_rounding_mode = rnd_dir;
 	return old;
+#endif
 }
Index: src/lib/libc/softfloat/fpsetsticky.c
diff -u src/lib/libc/softfloat/fpsetsticky.c:1.3 src/lib/libc/softfloat/fpsetsticky.c:1.4
--- src/lib/libc/softfloat/fpsetsticky.c:1.3	Mon Apr 28 20:23:00 2008
+++ src/lib/libc/softfloat/fpsetsticky.c	Thu Jan 10 08:16:10 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: fpsetsticky.c,v 1.3 2008/04/28 20:23:00 martin Exp $ */
+/* $NetBSD: fpsetsticky.c,v 1.4 2013/01/10 08:16:10 matt Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetsticky.c,v 1.3 2008/04/28 20:23:00 martin Exp $");
+__RCSID("$NetBSD: fpsetsticky.c,v 1.4 2013/01/10 08:16:10 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -50,9 +50,11 @@ __weak_alias(fpsetsticky,_fpsetsticky)
 fp_except
 fpsetsticky(fp_except except)
 {
-	fp_except old;
-
-	old = float_exception_flags;
+#ifdef set_float_exception_flags
+	return set_float_exception_flags(except, 1);
+#else
+	const fp_except old = float_exception_flags;
 	float_exception_flags = except;
 	return old;
+#endif
 }

Index: src/lib/libc/softfloat/softfloat-specialize
diff -u src/lib/libc/softfloat/softfloat-specialize:1.7 src/lib/libc/softfloat/softfloat-specialize:1.8
--- src/lib/libc/softfloat/softfloat-specialize:1.7	Wed Mar 21 02:32:26 2012
+++ src/lib/libc/softfloat/softfloat-specialize	Thu Jan 10 08:16:10 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: softfloat-specialize,v 1.7 2012/03/21 02:32:26 christos Exp $	*/
+/*	$NetBSD: softfloat-specialize,v 1.8 2013/01/10 08:16:10 matt Exp $	*/
 
 /* This is a derivative work. */
 
@@ -56,16 +56,28 @@ should be simply `float_exception_flags 
 -------------------------------------------------------------------------------
 */
 #ifdef SOFTFLOAT_FOR_GCC
+#ifndef set_float_exception_mask
 #define float_exception_mask	_softfloat_float_exception_mask
 #endif
+#endif
+#ifndef set_float_exception_mask
 fp_except float_exception_mask = 0;
-void float_raise( fp_except flags )
+#endif
+void
+float_raise( fp_except flags )
 {
     siginfo_t info;
+    fp_except mask = float_exception_mask;
 
+#ifdef set_float_exception_mask
+    flags |= set_float_exception_flags(flags, 0);
+#else
     float_exception_flags |= flags;
+    flags = float_exception_flags;
+#endif
 
-    if ( flags & float_exception_mask ) {
+    flags &= mask;
+    if ( flags ) {
 	memset(&info, 0, sizeof info);
 	info.si_signo = SIGFPE;
 	info.si_pid = getpid();

Index: src/lib/libc/softfloat/bits32/softfloat.c
diff -u src/lib/libc/softfloat/bits32/softfloat.c:1.2 src/lib/libc/softfloat/bits32/softfloat.c:1.3
--- src/lib/libc/softfloat/bits32/softfloat.c:1.2	Wed Mar 21 14:17:54 2012
+++ src/lib/libc/softfloat/bits32/softfloat.c	Thu Jan 10 08:16:11 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat.c,v 1.2 2012/03/21 14:17:54 christos Exp $ */
+/* $NetBSD: softfloat.c,v 1.3 2013/01/10 08:16:11 matt Exp $ */
 
 /*
  * This version hacked for use with gcc -msoft-float by bjh21.
@@ -53,7 +53,7 @@ this code that are retained.
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: softfloat.c,v 1.2 2012/03/21 14:17:54 christos Exp $");
+__RCSID("$NetBSD: softfloat.c,v 1.3 2013/01/10 08:16:11 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef SOFTFLOAT_FOR_GCC
@@ -79,8 +79,14 @@ __RCSID("$NetBSD: softfloat.c,v 1.2 2012
 Floating-point rounding mode and exception flags.
 -------------------------------------------------------------------------------
 */
+#ifndef set_float_rounding_mode
 fp_rnd float_rounding_mode = float_round_nearest_even;
 fp_except float_exception_flags = 0;
+#endif
+#ifndef set_float_exception_inexact_flag
+#define set_float_exception_inexact_flag() \
+	((void)(float_exception_flags |= float_flag_inexact))
+#endif
 
 /*
 -------------------------------------------------------------------------------
@@ -244,7 +250,7 @@ static float32 roundAndPackFloat32( flag
             if ( isTiny && roundBits ) float_raise( float_flag_underflow );
         }
     }
-    if ( roundBits ) float_exception_flags |= float_flag_inexact;
+    if ( roundBits ) set_float_exception_inexact_flag();
     zSig = ( zSig + roundIncrement )>>7;
     zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
     if ( zSig == 0 ) zExp = 0;
@@ -472,7 +478,7 @@ static float64
             }
         }
     }
-    if ( zSig2 ) float_exception_flags |= float_flag_inexact;
+    if ( zSig2 ) set_float_exception_inexact_flag();
     if ( increment ) {
         add64( zSig0, zSig1, 0, 1, &zSig0, &zSig1 );
         zSig1 &= ~ ( ( zSig2 + zSig2 == 0 ) & roundNearestEven );
@@ -615,7 +621,7 @@ int32 float32_to_int32( float32 a )
             aSigExtra = aSig<<( shiftCount & 31 );
             z = aSig>>( - shiftCount );
         }
-        if ( aSigExtra ) float_exception_flags |= float_flag_inexact;
+        if ( aSigExtra ) set_float_exception_inexact_flag();
         roundingMode = float_rounding_mode;
         if ( roundingMode == float_round_nearest_even ) {
             if ( (sbits32) aSigExtra < 0 ) {
@@ -670,13 +676,13 @@ int32 float32_to_int32_round_to_zero( fl
         return (sbits32) 0x80000000;
     }
     else if ( aExp <= 0x7E ) {
-        if ( aExp | aSig ) float_exception_flags |= float_flag_inexact;
+        if ( aExp | aSig ) set_float_exception_inexact_flag();
         return 0;
     }
     aSig = ( aSig | 0x00800000 )<<8;
     z = aSig>>( - shiftCount );
     if ( (bits32) ( aSig<<( shiftCount & 31 ) ) ) {
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
     }
     if ( aSign ) z = - z;
     return z;
@@ -740,7 +746,7 @@ float32 float32_round_to_int( float32 a 
     }
     if ( aExp <= 0x7E ) {
         if ( (bits32) ( a<<1 ) == 0 ) return a;
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
         aSign = extractFloat32Sign( a );
         switch ( float_rounding_mode ) {
          case float_round_nearest_even:
@@ -772,7 +778,7 @@ float32 float32_round_to_int( float32 a 
         }
     }
     z &= ~ roundBitsMask;
-    if ( z != a ) float_exception_flags |= float_flag_inexact;
+    if ( z != a ) set_float_exception_inexact_flag();
     return z;
 
 }
@@ -1463,7 +1469,7 @@ int32 float64_to_int32( float64 a )
         float_raise( float_flag_invalid );
         return aSign ? (sbits32) 0x80000000 : 0x7FFFFFFF;
     }
-    if ( aSigExtra ) float_exception_flags |= float_flag_inexact;
+    if ( aSigExtra ) set_float_exception_inexact_flag();
     return z;
 
 }
@@ -1503,7 +1509,7 @@ int32 float64_to_int32_round_to_zero( fl
     else {
         if ( aExp < 0x3FF ) {
             if ( aExp | aSig0 | aSig1 ) {
-                float_exception_flags |= float_flag_inexact;
+                set_float_exception_inexact_flag();
             }
             return 0;
         }
@@ -1517,7 +1523,7 @@ int32 float64_to_int32_round_to_zero( fl
         float_raise( float_flag_invalid );
         return aSign ? (sbits32) 0x80000000 : 0x7FFFFFFF;
     }
-    if ( aSigExtra ) float_exception_flags |= float_flag_inexact;
+    if ( aSigExtra ) set_float_exception_inexact_flag();
     return z;
 
 }
@@ -1607,7 +1613,7 @@ float64 float64_round_to_int( float64 a 
     else {
         if ( aExp <= 0x3FE ) {
             if ( ( ( (bits32) ( a.high<<1 ) ) | a.low ) == 0 ) return a;
-            float_exception_flags |= float_flag_inexact;
+            set_float_exception_inexact_flag();
             aSign = extractFloat64Sign( a );
             switch ( float_rounding_mode ) {
              case float_round_nearest_even:
@@ -1650,7 +1656,7 @@ float64 float64_round_to_int( float64 a 
         z.high &= ~ roundBitsMask;
     }
     if ( ( z.low != a.low ) || ( z.high != a.high ) ) {
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
     }
     return z;
 

Index: src/lib/libc/softfloat/bits64/softfloat.c
diff -u src/lib/libc/softfloat/bits64/softfloat.c:1.11 src/lib/libc/softfloat/bits64/softfloat.c:1.12
--- src/lib/libc/softfloat/bits64/softfloat.c:1.11	Sat Mar 24 00:06:20 2012
+++ src/lib/libc/softfloat/bits64/softfloat.c	Thu Jan 10 08:16:11 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat.c,v 1.11 2012/03/24 00:06:20 matt Exp $ */
+/* $NetBSD: softfloat.c,v 1.12 2013/01/10 08:16:11 matt Exp $ */
 
 /*
  * This version hacked for use with gcc -msoft-float by bjh21.
@@ -46,7 +46,7 @@ this code that are retained.
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: softfloat.c,v 1.11 2012/03/24 00:06:20 matt Exp $");
+__RCSID("$NetBSD: softfloat.c,v 1.12 2013/01/10 08:16:11 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef SOFTFLOAT_FOR_GCC
@@ -73,8 +73,14 @@ Floating-point rounding mode, extended d
 and exception flags.
 -------------------------------------------------------------------------------
 */
+#ifndef set_float_rounding_mode
 fp_rnd float_rounding_mode = float_round_nearest_even;
 fp_except float_exception_flags = 0;
+#endif
+#ifndef set_float_exception_inexact_flag
+#define	set_float_exception_inexact_flag() \
+	((void)(float_exception_flags |= float_flag_inexact))
+#endif
 #ifdef FLOATX80
 int8 floatx80_rounding_precision = 80;
 #endif
@@ -146,7 +152,7 @@ static int32 roundAndPackInt32( flag zSi
         float_raise( float_flag_invalid );
         return zSign ? (sbits32) 0x80000000 : 0x7FFFFFFF;
     }
-    if ( roundBits ) float_exception_flags |= float_flag_inexact;
+    if ( roundBits ) set_float_exception_inexact_flag();
     return z;
 
 }
@@ -200,7 +206,7 @@ static int64 roundAndPackInt64( flag zSi
               zSign ? (sbits64) LIT64( 0x8000000000000000 )
             : LIT64( 0x7FFFFFFFFFFFFFFF );
     }
-    if ( absZ1 ) float_exception_flags |= float_flag_inexact;
+    if ( absZ1 ) set_float_exception_inexact_flag();
     return z;
 
 }
@@ -347,7 +353,7 @@ static float32 roundAndPackFloat32( flag
             if ( isTiny && roundBits ) float_raise( float_flag_underflow );
         }
     }
-    if ( roundBits ) float_exception_flags |= float_flag_inexact;
+    if ( roundBits ) set_float_exception_inexact_flag();
     zSig = ( zSig + roundIncrement )>>7;
     zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
     if ( zSig == 0 ) zExp = 0;
@@ -519,7 +525,7 @@ static float64 roundAndPackFloat64( flag
             if ( isTiny && roundBits ) float_raise( float_flag_underflow );
         }
     }
-    if ( roundBits ) float_exception_flags |= float_flag_inexact;
+    if ( roundBits ) set_float_exception_inexact_flag();
     zSig = ( zSig + roundIncrement )>>10;
     zSig &= ~ ( ( ( roundBits ^ 0x200 ) == 0 ) & roundNearestEven );
     if ( zSig == 0 ) zExp = 0;
@@ -702,7 +708,7 @@ static floatx80
             zExp = 0;
             roundBits = zSig0 & roundMask;
             if ( isTiny && roundBits ) float_raise( float_flag_underflow );
-            if ( roundBits ) float_exception_flags |= float_flag_inexact;
+            if ( roundBits ) set_float_exception_inexact_flag();
             zSig0 += roundIncrement;
             if ( (sbits64) zSig0 < 0 ) zExp = 1;
             roundIncrement = roundMask + 1;
@@ -713,7 +719,7 @@ static floatx80
             return packFloatx80( zSign, zExp, zSig0 );
         }
     }
-    if ( roundBits ) float_exception_flags |= float_flag_inexact;
+    if ( roundBits ) set_float_exception_inexact_flag();
     zSig0 += roundIncrement;
     if ( zSig0 < roundIncrement ) {
         ++zExp;
@@ -768,7 +774,7 @@ static floatx80
             shift64ExtraRightJamming( zSig0, zSig1, 1 - zExp, &zSig0, &zSig1 );
             zExp = 0;
             if ( isTiny && zSig1 ) float_raise( float_flag_underflow );
-            if ( zSig1 ) float_exception_flags |= float_flag_inexact;
+            if ( zSig1 ) set_float_exception_inexact_flag();
             if ( roundNearestEven ) {
                 increment = ( (sbits64) zSig1 < 0 );
             }
@@ -789,7 +795,7 @@ static floatx80
             return packFloatx80( zSign, zExp, zSig0 );
         }
     }
-    if ( zSig1 ) float_exception_flags |= float_flag_inexact;
+    if ( zSig1 ) set_float_exception_inexact_flag();
     if ( increment ) {
         ++zSig0;
         if ( zSig0 == 0 ) {
@@ -1059,7 +1065,7 @@ static float128
             }
         }
     }
-    if ( zSig2 ) float_exception_flags |= float_flag_inexact;
+    if ( zSig2 ) set_float_exception_inexact_flag();
     if ( increment ) {
         add128( zSig0, zSig1, 0, 1, &zSig0, &zSig1 );
         zSig1 &= ~ ( ( zSig2 + zSig2 == 0 ) & roundNearestEven );
@@ -1431,13 +1437,13 @@ int32 float32_to_int32_round_to_zero( fl
         return (sbits32) 0x80000000;
     }
     else if ( aExp <= 0x7E ) {
-        if ( aExp | aSig ) float_exception_flags |= float_flag_inexact;
+        if ( aExp | aSig ) set_float_exception_inexact_flag();
         return 0;
     }
     aSig = ( aSig | 0x00800000 )<<8;
     z = aSig>>( - shiftCount );
     if ( (bits32) ( aSig<<( shiftCount & 31 ) ) ) {
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
     }
     if ( aSign ) z = - z;
     return z;
@@ -1515,14 +1521,14 @@ int64 float32_to_int64_round_to_zero( fl
         return (sbits64) LIT64( 0x8000000000000000 );
     }
     else if ( aExp <= 0x7E ) {
-        if ( aExp | aSig ) float_exception_flags |= float_flag_inexact;
+        if ( aExp | aSig ) set_float_exception_inexact_flag();
         return 0;
     }
     aSig64 = aSig | 0x00800000;
     aSig64 <<= 40;
     z = aSig64>>( - shiftCount );
     if ( (bits64) ( aSig64<<( shiftCount & 63 ) ) ) {
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
     }
     if ( aSign ) z = - z;
     return z;
@@ -1654,7 +1660,7 @@ float32 float32_round_to_int( float32 a 
     }
     if ( aExp <= 0x7E ) {
         if ( (bits32) ( a<<1 ) == 0 ) return a;
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
         aSign = extractFloat32Sign( a );
         switch ( float_rounding_mode ) {
          case float_round_nearest_even:
@@ -1686,7 +1692,7 @@ float32 float32_round_to_int( float32 a 
         }
     }
     z &= ~ roundBitsMask;
-    if ( z != a ) float_exception_flags |= float_flag_inexact;
+    if ( z != a ) set_float_exception_inexact_flag();
     return z;
 
 }
@@ -2372,7 +2378,7 @@ int32 float64_to_int32_round_to_zero( fl
         goto invalid;
     }
     else if ( aExp < 0x3FF ) {
-        if ( aExp || aSig ) float_exception_flags |= float_flag_inexact;
+        if ( aExp || aSig ) set_float_exception_inexact_flag();
         return 0;
     }
     aSig |= LIT64( 0x0010000000000000 );
@@ -2387,7 +2393,7 @@ int32 float64_to_int32_round_to_zero( fl
         return aSign ? (sbits32) 0x80000000 : 0x7FFFFFFF;
     }
     if ( ( aSig<<shiftCount ) != savedASig ) {
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
     }
     return z;
 
@@ -2477,12 +2483,12 @@ int64 float64_to_int64_round_to_zero( fl
     }
     else {
         if ( aExp < 0x3FE ) {
-            if ( aExp | aSig ) float_exception_flags |= float_flag_inexact;
+            if ( aExp | aSig ) set_float_exception_inexact_flag();
             return 0;
         }
         z = aSig>>( - shiftCount );
         if ( (bits64) ( aSig<<( shiftCount & 63 ) ) ) {
-            float_exception_flags |= float_flag_inexact;
+            set_float_exception_inexact_flag();
         }
     }
     if ( aSign ) z = - z;
@@ -2619,7 +2625,7 @@ float64 float64_round_to_int( float64 a 
     }
     if ( aExp < 0x3FF ) {
         if ( (bits64) ( a<<1 ) == 0 ) return a;
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
         aSign = extractFloat64Sign( a );
         switch ( float_rounding_mode ) {
          case float_round_nearest_even:
@@ -2652,7 +2658,7 @@ float64 float64_round_to_int( float64 a 
         }
     }
     z &= ~ roundBitsMask;
-    if ( z != a ) float_exception_flags |= float_flag_inexact;
+    if ( z != a ) set_float_exception_inexact_flag();
     return z;
 
 }
@@ -3333,7 +3339,7 @@ int32 floatx80_to_int32_round_to_zero( f
         goto invalid;
     }
     else if ( aExp < 0x3FFF ) {
-        if ( aExp || aSig ) float_exception_flags |= float_flag_inexact;
+        if ( aExp || aSig ) set_float_exception_inexact_flag();
         return 0;
     }
     shiftCount = 0x403E - aExp;
@@ -3347,7 +3353,7 @@ int32 floatx80_to_int32_round_to_zero( f
         return aSign ? (sbits32) 0x80000000 : 0x7FFFFFFF;
     }
     if ( ( aSig<<shiftCount ) != savedASig ) {
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
     }
     return z;
 
@@ -3427,12 +3433,12 @@ int64 floatx80_to_int64_round_to_zero( f
         return (sbits64) LIT64( 0x8000000000000000 );
     }
     else if ( aExp < 0x3FFF ) {
-        if ( aExp | aSig ) float_exception_flags |= float_flag_inexact;
+        if ( aExp | aSig ) set_float_exception_inexact_flag();
         return 0;
     }
     z = aSig>>( - shiftCount );
     if ( (bits64) ( aSig<<( shiftCount & 63 ) ) ) {
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
     }
     if ( aSign ) z = - z;
     return z;
@@ -3554,7 +3560,7 @@ floatx80 floatx80_round_to_int( floatx80
              && ( (bits64) ( extractFloatx80Frac( a )<<1 ) == 0 ) ) {
             return a;
         }
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
         aSign = extractFloatx80Sign( a );
         switch ( float_rounding_mode ) {
          case float_round_nearest_even:
@@ -3597,7 +3603,7 @@ floatx80 floatx80_round_to_int( floatx80
         ++z.high;
         z.low = LIT64( 0x8000000000000000 );
     }
-    if ( z.low != a.low ) float_exception_flags |= float_flag_inexact;
+    if ( z.low != a.low ) set_float_exception_inexact_flag();
     return z;
 
 }
@@ -4355,7 +4361,7 @@ int32 float128_to_int32_round_to_zero( f
         goto invalid;
     }
     else if ( aExp < 0x3FFF ) {
-        if ( aExp || aSig0 ) float_exception_flags |= float_flag_inexact;
+        if ( aExp || aSig0 ) set_float_exception_inexact_flag();
         return 0;
     }
     aSig0 |= LIT64( 0x0001000000000000 );
@@ -4370,7 +4376,7 @@ int32 float128_to_int32_round_to_zero( f
         return aSign ? (sbits32) 0x80000000 : 0x7FFFFFFF;
     }
     if ( ( aSig0<<shiftCount ) != savedASig ) {
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
     }
     return z;
 
@@ -4449,7 +4455,7 @@ int64 float128_to_int64_round_to_zero( f
             aSig0 &= LIT64( 0x0000FFFFFFFFFFFF );
             if (    ( a.high == LIT64( 0xC03E000000000000 ) )
                  && ( aSig1 < LIT64( 0x0002000000000000 ) ) ) {
-                if ( aSig1 ) float_exception_flags |= float_flag_inexact;
+                if ( aSig1 ) set_float_exception_inexact_flag();
             }
             else {
                 float_raise( float_flag_invalid );
@@ -4461,20 +4467,20 @@ int64 float128_to_int64_round_to_zero( f
         }
         z = ( aSig0<<shiftCount ) | ( aSig1>>( ( - shiftCount ) & 63 ) );
         if ( (bits64) ( aSig1<<shiftCount ) ) {
-            float_exception_flags |= float_flag_inexact;
+            set_float_exception_inexact_flag();
         }
     }
     else {
         if ( aExp < 0x3FFF ) {
             if ( aExp | aSig0 | aSig1 ) {
-                float_exception_flags |= float_flag_inexact;
+                set_float_exception_inexact_flag();
             }
             return 0;
         }
         z = aSig0>>( - shiftCount );
         if (    aSig1
              || ( shiftCount && (bits64) ( aSig0<<( shiftCount & 63 ) ) ) ) {
-            float_exception_flags |= float_flag_inexact;
+            set_float_exception_inexact_flag();
         }
     }
     if ( aSign ) z = - z;
@@ -4505,7 +4511,7 @@ uint64 float128_to_uint64_round_to_zero(
             aSig0 &= LIT64( 0x0000FFFFFFFFFFFF );
             if (    ( a.high == LIT64( 0xC03E000000000000 ) )
                  && ( aSig1 < LIT64( 0x0002000000000000 ) ) ) {
-                if ( aSig1 ) float_exception_flags |= float_flag_inexact;
+                if ( aSig1 ) set_float_exception_inexact_flag();
             }
             else {
                 float_raise( float_flag_invalid );
@@ -4514,19 +4520,19 @@ uint64 float128_to_uint64_round_to_zero(
         }
         z = ( aSig0<<shiftCount ) | ( aSig1>>( ( - shiftCount ) & 63 ) );
         if ( (bits64) ( aSig1<<shiftCount ) ) {
-            float_exception_flags |= float_flag_inexact;
+            set_float_exception_inexact_flag();
         }
     }
     else {
         if ( aExp < 0x3FFF ) {
             if ( aExp | aSig0 | aSig1 ) {
-                float_exception_flags |= float_flag_inexact;
+                set_float_exception_inexact_flag();
             }
             return 0;
         }
         z = aSig0>>( - shiftCount );
         if (aSig1 || ( shiftCount && (bits64) ( aSig0<<( shiftCount & 63 ) ) ) ) {
-            float_exception_flags |= float_flag_inexact;
+            set_float_exception_inexact_flag();
         }
     }
     if ( aSign ) z = - z;
@@ -4699,7 +4705,7 @@ float128 float128_round_to_int( float128
     else {
         if ( aExp < 0x3FFF ) {
             if ( ( ( (bits64) ( a.high<<1 ) ) | a.low ) == 0 ) return a;
-            float_exception_flags |= float_flag_inexact;
+            set_float_exception_inexact_flag();
             aSign = extractFloat128Sign( a );
             switch ( float_rounding_mode ) {
              case float_round_nearest_even:
@@ -4745,7 +4751,7 @@ float128 float128_round_to_int( float128
         z.high &= ~ roundBitsMask;
     }
     if ( ( z.low != a.low ) || ( z.high != a.high ) ) {
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
     }
     return z;
 
@@ -5535,7 +5541,7 @@ uint32 float64_to_uint32_round_to_zero( 
         return 0xffffffff;
     }
     else if ( aExp < 0x3FF ) {
-        if ( aExp || aSig ) float_exception_flags |= float_flag_inexact;
+        if ( aExp || aSig ) set_float_exception_inexact_flag();
         return 0;
     }
     aSig |= LIT64( 0x0010000000000000 );
@@ -5544,7 +5550,7 @@ uint32 float64_to_uint32_round_to_zero( 
     aSig >>= shiftCount;
     z = (uint32)aSig;
     if ( ( aSig<<shiftCount ) != savedASig ) {
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
     }
     return z;
 
@@ -5581,13 +5587,13 @@ uint32 float32_to_uint32_round_to_zero( 
         return 0xFFFFFFFF;
     }
     else if ( aExp <= 0x7E ) {
-        if ( aExp | aSig ) float_exception_flags |= float_flag_inexact;
+        if ( aExp | aSig ) set_float_exception_inexact_flag();
         return 0;
     }
     aSig = ( aSig | 0x800000 )<<8;
     z = aSig>>( - shiftCount );
     if ( aSig<<( shiftCount & 31 ) ) {
-        float_exception_flags |= float_flag_inexact;
+        set_float_exception_inexact_flag();
     }
     return z;
 

Reply via email to