Re:Optimizing compilers reload vector constants needlessly
by jeffreyrogers on Tuesday December 06, 2022 @04:51PM
(#33887593)
He sets it once like this before the loops.
And then the disassembly has
before each loop.
[ Parent
| on HN ]
Re:Optimizing compilers reload vector constants needlessly
by pclmulqdq on Tuesday December 06, 2022 @07:31PM
(#33889134)
Yeah, if the compiler runs out of registers it will do this - it's better than spilling the constant to memory. Register allocation is one thing that compilers are still much worse at than humans, and you see it in SIMD code a lot.
Re:Optimizing compilers reload vector constants needlessly
by DannyBee on Tuesday December 06, 2022 @10:17PM
(#33890252)
Eh.
Compilers are only worse because we don't care.
Optimal register allocation + spilling is easily doable now on today's machines/algorithms.
We just don't bother because it's not truly worth it in most cases (IE we get most of the performance for a very low cost)