On Tue, Feb 14, 2023 at 2:14 PM Owen Cook via Gcc-bugs <gcc-bugs@gcc.gnu.org> wrote: > > Adding white space/newlines outside the function also affect the length of > assembly.
Note -march=native is dependent on the machine which is being used. IIRC godbolt uses a few different machines and that means the answer which -march=native will change based on which machine it is run on. So don't trust godbolt with -march=native at all. Thanks, Andrew > > 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 > >