Re: [PATCH v5 06/14] ARC: hardware floating point support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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.  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.

-- 
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx

_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/linux-snps-arc



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux