https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103252
--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> --- > For the original example, though, it doesn't seem to even be saving a spill. > The non-k0 code is clearly better than the k0 code. I don't know much about > how the allocator works and interacts with various passes of the optimizer, > but I wonder if spilling to a mask register should have a higher weight than > spilling to a gpr? In GCC internal cost table, spill to a mask register is 2.5 times expensive than gpr, a little bit cheaper than spill to memory. And yes sometimes spill to memory could be cheaper if there is an opportunity for store forward optimisation, but it depends on the workroads and capacity of store buffer.