[PATCH v6 06/13] ARC: hardware floating point support

Joseph Myers joseph@codesourcery.com
Tue Jun 2 17:51:23 GMT 2020

On Fri, 29 May 2020, Vineet Gupta via Libc-alpha wrote:

> Something like below ?
> +# define _FPU_FPSR_FWE		0x80000000
> +
> -#  define _FPU_GETCW(cw) __asm__ volatile ("lr %0, [0x300]" : "=r" (cw))
> -#  define _FPU_SETCW(cw) __asm__ volatile ("sr %0, [0x300]" : : "r" (cw))
> +static inline unsigned int arc_fpu_getcw(void)
> +{
> +  unsigned int cw;

Even for a header that's not defined in any standard, as an installed 
header you should avoid names in the user's namespace that are not 
explicitly part of the API for the user to use.  That is, unless you 
actually intend the name arc_fpu_getcw to be a supported interface for 
users including <fpu_control.h>, you should name it __arc_fpu_getcw, and 
you should use __cw to avoid conflicting with any user macro called sw.  
(Function definitions also need to be in GNU style - function name at the 
start of a line, space before '('.)

Joseph S. Myers

More information about the Libc-alpha mailing list