On 4/17/20 3:59 PM, Joseph Myers wrote: > On Wed, 8 Apr 2020, Vineet Gupta via Libc-alpha wrote: > >> +# define _FPU_SETS(cw) __asm__ volatile ("bset %0, %0, 31 \r\n" \ >> + "sr %0, [0x301] \r\n" \ >> + : : "r" (cw)) > > This asm doesn't look safe; it's modifying an input operand. I think the > compiler will assume the register it puts %0 in is unmodified by the asm, > because it's listed as an input. Indeed this is a bug, as wiggling bit 31 was not present in inotial code. I changed it to "+r" > As an architecture-specific interface, it's not very clear if the > interface for _FPU_SETS should be that it modifies the variable passed as > an argument, but I'd guess not. But does it not depend on whether the value is used after the fact. And with +r we enable the compiler to DTRT. > My suggestion would be to define the > macro (using do { ... } while (0)) to copy the argument to a temporary > variable, and do the bit-set operation in C code on that temporary > variable rather than as part of the asm. I can certainly do that if you think so. _______________________________________________ linux-snps-arc mailing list linux-snps-arc@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/linux-snps-arc