[fpc-devel] vmul commutative optimization?

Florian Klämpfl florian at freepascal.org
Sun Nov 17 15:49:21 CET 2019


Am 12.11.19 um 13:22 schrieb Marco van de Voort:
> I compiled some bits with avx, and noticed that when you do
> 
> asingle:=someconstant*othersingle;
> 
> then that generates something like
> 
>      vmovss    TC_$FFTS_$$_C31(%rip),%xmm2
>      vmulss    %xmm0,%xmm2,%xmm0
> 
> while if you do
> 
> asingle:=othersingle*someconstant;
> 
> it generates
> 
>      vmulss    TC_$FFTS_$$_C32(%rip),%xmm2,%xmm2
> 
> 
> I assume the reason is that only the first param can be an address, and 
> the second a register. But the compiler isn't smart enough to exchange 
> them.

This was an easy one :) Fixed in r43509


More information about the fpc-devel mailing list