diff options
author | Paul E. Murphy <murphyp@linux.vnet.ibm.com> | 2016-02-26 19:20:54 +0000 |
---|---|---|
committer | William Schmidt <wschmidt@gcc.gnu.org> | 2016-02-26 19:20:54 +0000 |
commit | 47dfdc53cd48e4b8dee671785a08ee664ffa1f41 (patch) | |
tree | b520e9e8378645bb1a8b1ca2aae14a40d523241c /libgcc | |
parent | d1f2bea53f8990253f655cfa22815046efb2ed87 (diff) | |
download | gcc-47dfdc53cd48e4b8dee671785a08ee664ffa1f41.zip gcc-47dfdc53cd48e4b8dee671785a08ee664ffa1f41.tar.gz gcc-47dfdc53cd48e4b8dee671785a08ee664ffa1f41.tar.bz2 |
sfp-machine.h (_FP_DECL_EX): Declare _fpsr as a union of u64 and double.
2016-02-26 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* config/rs6000/sfp-machine.h (_FP_DECL_EX): Declare _fpsr as a
union of u64 and double.
(FP_TRAPPING_EXCEPTIONS): Return a bitmask of trapping exceptions.
(FP_INIT_ROUNDMODE): Read the fpscr instead of writing a mystery
value.
(FP_ROUNDMODE): Update the usage of _fpscr.
Co-Authored-By: Bill Schmidt <wschmidt@linux.vnet.ibm.com>
From-SVN: r233756
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/ChangeLog | 10 | ||||
-rw-r--r-- | libgcc/config/rs6000/sfp-machine.h | 22 |
2 files changed, 23 insertions, 9 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 36d10b0..7587434 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,13 @@ +2016-02-26 Paul E. Murphy <murphyp@linux.vnet.ibm.com> + Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * config/rs6000/sfp-machine.h (_FP_DECL_EX): Declare _fpsr as a + union of u64 and double. + (FP_TRAPPING_EXCEPTIONS): Return a bitmask of trapping exceptions. + (FP_INIT_ROUNDMODE): Read the fpscr instead of writing a mystery + value. + (FP_ROUNDMODE): Update the usage of _fpscr. + 2016-02-25 Ilya Verbin <ilya.verbin@intel.com> PR driver/68463 diff --git a/libgcc/config/rs6000/sfp-machine.h b/libgcc/config/rs6000/sfp-machine.h index 75d5e1a..ab028fe 100644 --- a/libgcc/config/rs6000/sfp-machine.h +++ b/libgcc/config/rs6000/sfp-machine.h @@ -130,10 +130,14 @@ void __sfp_handle_exceptions (int); if (__builtin_expect (_fex, 0)) \ __sfp_handle_exceptions (_fex); \ } while (0); -/* A set bit indicates an exception is masked and a clear bit indicates it is - trapping. */ -# define FP_TRAPPING_EXCEPTIONS (~_fpscr & (FP_EX_ALL >> 22)) +/* The FP_EX_* bits track whether the exception has occurred. This macro + must set the FP_EX_* bits of those exceptions which are configured to + trap. The FPSCR bit which indicates this is 22 ISA bits above the + respective FP_EX_* bit. Note, the ISA labels bits from msb to lsb, + so 22 ISA bits above is 22 bits below when counted from the lsb. */ +# define FP_TRAPPING_EXCEPTIONS ((_fpscr.i << 22) & FP_EX_ALL) + # define FP_RND_NEAREST 0x0 # define FP_RND_ZERO 0x1 # define FP_RND_PINF 0x2 @@ -141,16 +145,16 @@ void __sfp_handle_exceptions (int); # define FP_RND_MASK 0x3 # define _FP_DECL_EX \ - unsigned long long _fpscr __attribute__ ((unused)) = FP_RND_NEAREST - + union { unsigned long long i; double d; } _fpscr __attribute__ ((unused)) = \ + { .i = FP_RND_NEAREST } + #define FP_INIT_ROUNDMODE \ do { \ - __asm__ __volatile__ ("mtfsf 255, %0" \ - : \ - : "f" (_fpscr)); \ + __asm__ __volatile__ ("mffs %0" \ + : "=f" (_fpscr.d)); \ } while (0) -# define FP_ROUNDMODE (_fpscr & FP_RND_MASK) +# define FP_ROUNDMODE (_fpscr.i & FP_RND_MASK) #endif /* !__FLOAT128__ */ /* Define ALIASNAME as a strong alias for NAME. */ |