https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108401
Alexander Monakov <amonakov at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amonakov at gcc dot gnu.org --- Comment #4 from Alexander Monakov <amonakov at gcc dot gnu.org> --- (In reply to Hongtao.liu from comment #3) > > and gcc 12 generates a worse code: > > > > movabs rax, 71777214294589695 > > vmovq xmm1, rax > > vpbroadcastq ymm0, xmm1 > > ret > > > > It's on purpose by edafb35bdadf309ebb9d1eddc5549f9e1ad49c09 since > microbenchmark shows moving from imm is faster than memory. But the bug is not asking you to reinstate loading from memory. The bug is asking you to notice that the result can be constructed via cmpeq+psrlw, which is even better than a broadcast (cmpeq with dst same as src is usually a dependency-breaking instruction that does not occupy an execution port).