[fpc-devel] vmul commutative optimization?

Marco van de Voort core at pascalprogramming.org
Tue Nov 12 13:22:51 CET 2019


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.



More information about the fpc-devel mailing list