[PATCH] LoongArch: Optimize math barriers
Xi Ruoyao
xry111@xry111.site
Fri May 8 09:29:10 GMT 2026
On Thu, 2026-05-07 at 17:30 +0800, dengjianbo wrote:
> Yes, unnecessary moves can occur if the value is already in a general
> reg. For example, when invoking math_opt_barrier with fixed-point
> parameters. However, in glibc, these two macros are invoked with
> floating-point parameters, and I didn’t find the unnecessary moves
> being generated. For other architectures, aarch64 and s390 also do
> not include the 'r' constraint.
>
> For gcc part, to my understanding, when 'fr' is present, GCC selects the
> union of FP_REGS and GR_REGS as the destination register class, which is
> initialized to GR_REGS. Then compute the cost of choosing different
> register classes, choosing GR_REGS incurs no extra cost, while choosing
> FP_REGS adds an extra move cost. I am not sure if it's a strategy here.
Where does this issue manifest (i.e. in which glibc source file)? I'll
try to reduce a test case from that. To me this seems a compiler bug
too.
>
--
Xi Ruoyao <xry111@xry111.site>
More information about the Libc-alpha
mailing list