Adding white space/newlines outside the function also affect the length of
assembly.

On Tue, Feb 14, 2023 at 5:09 PM Owen Cook <owenthegame...@gmail.com> wrote:

> Within "unrollOptimizations.c" compiled on a Ryzen 5 2600 using x86-64 gcc
> 12.2 "-O2 -march=native" gives vastly different assembler results given
> some scope things I have found. If the for loop iterator name is both int i
> in each loop, gcc seemingly spreads arrayA and arrayB into one single XMM
> register, name them differently and you get usages over XMM and YMM.
> Additionally, white space seems to be a variable to this as well. you can
> have the for loops one newline away from each other and this results in XMM
> YMM, but put them together and you get XMM. Changing float* a to float*
> const a (same goes for float* b) also changes these values.
>
> Godbolt equivalent for simplicity
> https://godbolt.org/z/4xWrGoPaE
>

Reply via email to