https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91814
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #3)
> (In reply to Richard Biener from comment #2)
> > ISTR discussing this but holding back a fix at the time we weren't sure if
> > we'd preserve the non-subreg sets. So sth like
> >
> > Index: gcc/config/i386/i386-features.c
> > ===================================================================
> > --- gcc/config/i386/i386-features.c (revision 275698)
> > +++ gcc/config/i386/i386-features.c (working copy)
> > @@ -668,6 +668,8 @@ scalar_chain::emit_conversion_insns (rtx
> > static rtx
> > gen_gpr_to_xmm_move_src (enum machine_mode vmode, rtx gpr)
> > {
> > + if (!x86_64_general_operand (gpr, GET_MODE_INNER (vmode)))
> > + gpr = force_reg (GET_MODE_INNER (vmode), gpr);
> > switch (GET_MODE_NUNITS (vmode))
> > {
> > case 1:
> >
> > fixes it with the question whether the use of x86_64_general_operand
> > is correct and whether it's necessary for the NUNITS == 1 case
> > (which IIRC isn't exercised anyway).
Tested the above successfully.
> We should use nonimmediate_operand for NUNITS != 1. Perhaps also add
> gcc_unreachable () for NUNITS == 1 case.
OK, will test the following which works on the testcase as well
Index: gcc/config/i386/i386-features.c
===================================================================
--- gcc/config/i386/i386-features.c (revision 275959)
+++ gcc/config/i386/i386-features.c (working copy)
@@ -668,10 +668,13 @@ scalar_chain::emit_conversion_insns (rtx
static rtx
gen_gpr_to_xmm_move_src (enum machine_mode vmode, rtx gpr)
{
+ if (!nonimmediate_operand (gpr, GET_MODE_INNER (vmode)))
+ gpr = force_reg (GET_MODE_INNER (vmode), gpr);
switch (GET_MODE_NUNITS (vmode))
{
case 1:
- return gen_rtx_SUBREG (vmode, gpr, 0);
+ /* We are not using this case currently. */
+ gcc_unreachable ();
case 2:
return gen_rtx_VEC_CONCAT (vmode, gpr,
CONST0_RTX (GET_MODE_INNER (vmode)));