https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118984
--- Comment #16 from Maxim Egorushkin <maxim.yegorushkin at gmail dot com> --- (In reply to Maxim Egorushkin from comment #14) > (In reply to Andrew Pinski from comment #6) > > > It happens more often with vector instructions/registers due to the > > different "modes" of the registers that it can hold (subregs). > > ... Or, worse, allocating one constant variable to multiple registers, which > gets never modified, for no apparent reason. That happens most frequently with xmm registers storing one zero double value versus a register storing two double zero values. An xmm register storing one 0 double value is zeroed with a vxorpd instruction, setting all its elements to 0. Yet, that fully zeroed xmm register isn't reused in places where an xmm register with 2 double elements set to 0 is required. gcc actually spill a register to stack in order to create another xmm register with all its bits set to zero, because that existing xmm register with all its bits set to 0 and never modified after that, has, apparently, an incompatible type, and hence, cannot be reused where a wider xmm/ymm register filled with 0s is required. Fixing that xmm register spill to stack involved explicitly passing a double{0} value into "v" asm parameter, instead of passing zero literal into it. I wonder why gcc emits unnecessary register move instructions to treat ymm/xmm registers as shorter vectors, unlike for GP registers being treated as 64/32/16/8-bit values without any register moves, please?