https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126959
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
The bug is in ix86_preferred_reload_class:
/* All classes can load zeros. */
if (x == CONST0_RTX (mode))
return regclass;
/* Force constants into memory if we are loading a (nonzero) constant into
an MMX, SSE or MASK register. This is because there are no MMX/SSE/MASK
instructions to load from a constant. */
if (CONSTANT_P (x)
&& (MAYBE_MMX_CLASS_P (regclass)
|| MAYBE_SSE_CLASS_P (regclass)
|| MAYBE_MASK_CLASS_P (regclass)))
return NO_REGS;
-1 should be allowed for SSE and MASK registers.