a2cf7d
commit 0b3c9e57a41d9f7c26fb6aa45b99f671bef9c7e0
a2cf7d
Author: Paul A. Clarke <pc@us.ibm.com>
a2cf7d
Date:   Tue Aug 20 15:57:35 2019 -0500
a2cf7d
a2cf7d
    [powerpc] fegetenv_status: simplify instruction generation
a2cf7d
    
a2cf7d
    fegetenv_status() wants to use the lighter weight instruction 'mffsl'
a2cf7d
    for reading the Floating-Point Status and Control Register (FPSCR).
a2cf7d
    It currently will use it directly if compiled '-mcpu=power9', and will
a2cf7d
    perform a runtime check (cpu_supports("arch_3_00")) otherwise.
a2cf7d
    
a2cf7d
    Nicely, it turns out that the 'mffsl' instruction will decode to
a2cf7d
    'mffs' on architectures older than "arch_3_00" because the additional
a2cf7d
    bits set for 'mffsl' are "don't care" for 'mffs'.  'mffs' is a superset
a2cf7d
    of 'mffsl'.
a2cf7d
    
a2cf7d
    So, just generate 'mffsl'.
a2cf7d
a2cf7d
diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h
a2cf7d
index b244770d115ea7bb..e8d40ea256b6c5bc 100644
a2cf7d
--- a/sysdeps/powerpc/fpu/fenv_libc.h
a2cf7d
+++ b/sysdeps/powerpc/fpu/fenv_libc.h
a2cf7d
@@ -36,9 +36,12 @@ extern const fenv_t *__fe_mask_env (void) attribute_hidden;
a2cf7d
         ({ fenv_t env; asm volatile ("mffs %0" : "=f" (env)); env; })
a2cf7d
 
a2cf7d
 /* Equivalent to fegetenv_register, but only returns bits for
a2cf7d
-   status, exception enables, and mode.  */
a2cf7d
-
a2cf7d
-#define fegetenv_status_ISA300()					\
a2cf7d
+   status, exception enables, and mode.
a2cf7d
+   Nicely, it turns out that the 'mffsl' instruction will decode to
a2cf7d
+   'mffs' on architectures older than "power9" because the additional
a2cf7d
+   bits set for 'mffsl' are "don't care" for 'mffs'.  'mffs' is a superset
a2cf7d
+   of 'mffsl'.  */
a2cf7d
+#define fegetenv_status()					\
a2cf7d
   ({register double __fr;						\
a2cf7d
     __asm__ __volatile__ (						\
a2cf7d
       ".machine push; .machine \"power9\"; mffsl %0; .machine pop"	\
a2cf7d
@@ -46,18 +49,6 @@ extern const fenv_t *__fe_mask_env (void) attribute_hidden;
a2cf7d
     __fr;								\
a2cf7d
   })
a2cf7d
 
a2cf7d
-#ifdef _ARCH_PWR9
a2cf7d
-# define fegetenv_status() fegetenv_status_ISA300()
a2cf7d
-#elif defined __BUILTIN_CPU_SUPPORTS__
a2cf7d
-# define fegetenv_status()						\
a2cf7d
-  (__glibc_likely (__builtin_cpu_supports ("arch_3_00"))		\
a2cf7d
-   ? fegetenv_status_ISA300()						\
a2cf7d
-   : fegetenv_register()						\
a2cf7d
-  )
a2cf7d
-#else
a2cf7d
-# define fegetenv_status() fegetenv_register ()
a2cf7d
-#endif
a2cf7d
-
a2cf7d
 /* Equivalent to fesetenv, but takes a fenv_t instead of a pointer.  */
a2cf7d
 #define fesetenv_register(env) \
a2cf7d
 	do { \