This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [powerpc] Use faster means to access FPSCR when possible in some cases


"Paul A. Clarke" <pc@us.ibm.com> writes:

> diff --git a/sysdeps/powerpc/fpu_control.h b/sysdeps/powerpc/fpu_control.h
> index fa04a67..240eae7 100644
> --- a/sysdeps/powerpc/fpu_control.h
> +++ b/sysdeps/powerpc/fpu_control.h
> @@ -65,35 +65,34 @@ extern fpu_control_t __fpu_control;
>...
> -#ifdef _ARCH_PWR9
> -# define __FPU_MFFSL()						\
> -  ({register double __fr;					\
> -    __asm__ __volatile__("mffsl %0" : "=f" (__fr));		\
> -    __fr;							\
> +# define _FPU_GET_RC_ISA300()						\
> +  ({union { double __d; unsigned long long __ll; } __u;			\
> +    __asm__ __volatile__(						\
> +      ".machine push; .machine \"power9\"; mffsl %0; .machine pop" 	\
> +      : "=f" (__u.__d));						\
> +    (fpu_control_t) (__u.__ll & _FPU_MASK_RC);				\
>    })
> +
> +#ifdef _ARCH_PWR9
> +# define _FPU_GET_RC() _FPU_GET_RC_ISA300()
> +#elif defined __BUILTIN_CPU_SUPPORTS__
> +# define _FPU_GET_RC()							\
> +    ({fpu_control_t __rc;						\
> +      __rc = __glibc_likely (__builtin_cpu_supports ("arch_3_00"))	\
> +             ? _FPU_GET_RC_ISA300 ()					\
> +             : _FPU_GETCW (__rc);					\

Missing the mask _FPU_MASK_RC.
Fixed.

> +      __rc;								\
> +    })
>  #else
> -# define __FPU_MFFSL() __FPU_MFFS()
> +# define _FPU_GET_RC() ({ fpu_control_t __rc = _FPU_GETCW (__rc); __rc; })

Likewise.  Fixed.

>  #endif
> -    
> -# define _FPU_GET_RC()						\
> -  ({union { double __d; unsigned long long __ll; } __u;		\
> -    __u.__d = __FPU_MFFSL();					\
> -    __u.__ll &= _FPU_MASK_RC;					\
> -    (fpu_control_t) __u.__ll;					\
> -  })

I'm merging the patch with those fixes.

Thanks!

-- 
Tulio Magno


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]