On Thu, Oct 07, 2021 at 08:04:23PM -0500, Paul A. Clarke wrote: > On Thu, Oct 07, 2021 at 06:39:06PM -0500, Segher Boessenkool wrote: > > > + __asm__ __volatile__ ("mffsce %0" : "=f" (__fpscr_save.__fr)); > > > > The __volatile__ does likely not do what you want. As far as I can see > > you do not want one here anyway? > > > > "volatile" does not order asm wrt fp insns, which you likely *do* want. > > Reading the GCC docs, it looks like the "volatile" qualifier for "asm" > has no effect at all (6.47.1): > > | The optional volatile qualifier has no effect. All basic asm blocks are > | implicitly volatile. > > So, it could be removed without concern.
This is not a basic asm (it contains a ":"; that is not just an easy way to see it, it is the *definition* of basic vs. extended asm). The manual explains: """ Note that the compiler can move even 'volatile asm' instructions relative to other code, including across jump instructions. For example, on many targets there is a system register that controls the rounding mode of floating-point operations. Setting it with a 'volatile asm' statement, as in the following PowerPC example, does not work reliably. asm volatile("mtfsf 255, %0" : : "f" (fpenv)); sum = x + y; The compiler may move the addition back before the 'volatile asm' statement. To make it work as expected, add an artificial dependency to the 'asm' by referencing a variable in the subsequent code, for example: asm volatile ("mtfsf 255,%1" : "=X" (sum) : "f" (fpenv)); sum = x + y; """ > > You do not need any of that __ either. > > I'm surprised that I don't. A .h file needs to be concerned about the > namespace it inherits, no? These are local variables in a function though. You get such complexities in macros, but never in functions, where everything is scoped. Local variables are a great thing. And macros are a bad thing! Segher