[i386] Fix PR91454, unrecognized insn
diff mbox series

Message ID alpine.LSU.2.20.1908151308010.32458@zhemvz.fhfr.qr
State New
Headers show
Series
  • [i386] Fix PR91454, unrecognized insn
Related show

Commit Message

Richard Biener Aug. 15, 2019, 11:09 a.m. UTC
The following fixes non-recognized RTL gegerated since my STV
changes.  I've added a helper instead of enlarging the code
even more.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

OK?

Thanks,
Richard.

2019-08-15  Richard Biener  <rguenther@suse.de>

	PR target/91454
	* config/i386/i386-features.c (gen_gpr_to_xmm_move_src): New
	helper.
	(general_scalar_chain::make_vector_copies): Use it.

Comments

Uros Bizjak Aug. 15, 2019, 11:11 a.m. UTC | #1
On Thu, Aug 15, 2019 at 1:09 PM Richard Biener <rguenther@suse.de> wrote:
>
>
> The following fixes non-recognized RTL gegerated since my STV
> changes.  I've added a helper instead of enlarging the code
> even more.
>
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
>
> OK?
>
> Thanks,
> Richard.
>
> 2019-08-15  Richard Biener  <rguenther@suse.de>
>
>         PR target/91454
>         * config/i386/i386-features.c (gen_gpr_to_xmm_move_src): New
>         helper.
>         (general_scalar_chain::make_vector_copies): Use it.

OK.

Thanks,
Uros.

> Index: gcc/config/i386/i386-features.c
> ===================================================================
> --- gcc/config/i386/i386-features.c     (revision 274504)
> +++ gcc/config/i386/i386-features.c     (working copy)
> @@ -658,6 +658,25 @@ scalar_chain::emit_conversion_insns (rtx
>    emit_insn_after (insns, BB_HEAD (new_bb));
>  }
>
> +/* Generate the canonical SET_SRC to move GPR to a VMODE vector register,
> +   zeroing the upper parts.  */
> +
> +static rtx
> +gen_gpr_to_xmm_move_src (enum machine_mode vmode, rtx gpr)
> +{
> +  switch (GET_MODE_NUNITS (vmode))
> +    {
> +    case 1:
> +      return gen_rtx_SUBREG (vmode, gpr, 0);
> +    case 2:
> +      return gen_rtx_VEC_CONCAT (vmode, gpr,
> +                                CONST0_RTX (GET_MODE_INNER (vmode)));
> +    default:
> +      return gen_rtx_VEC_MERGE (vmode, gen_rtx_VEC_DUPLICATE (vmode, gpr),
> +                               CONST0_RTX (vmode), GEN_INT (HOST_WIDE_INT_1U));
> +    }
> +}
> +
>  /* Make vector copies for all register REGNO definitions
>     and replace its uses in a chain.  */
>
> @@ -684,13 +703,8 @@ general_scalar_chain::make_vector_copies
>               }
>             else
>               emit_move_insn (tmp, reg);
> -           emit_insn (gen_rtx_SET
> -                       (gen_rtx_SUBREG (vmode, vreg, 0),
> -                        gen_rtx_VEC_MERGE (vmode,
> -                                           gen_rtx_VEC_DUPLICATE (vmode,
> -                                                                  tmp),
> -                                           CONST0_RTX (vmode),
> -                                           GEN_INT (HOST_WIDE_INT_1U))));
> +           emit_insn (gen_rtx_SET (gen_rtx_SUBREG (vmode, vreg, 0),
> +                                   gen_gpr_to_xmm_move_src (vmode, tmp)));
>           }
>         else if (!TARGET_64BIT && smode == DImode)
>           {
> @@ -720,13 +734,8 @@ general_scalar_chain::make_vector_copies
>               }
>           }
>         else
> -         emit_insn (gen_rtx_SET
> -                      (gen_rtx_SUBREG (vmode, vreg, 0),
> -                       gen_rtx_VEC_MERGE (vmode,
> -                                          gen_rtx_VEC_DUPLICATE (vmode,
> -                                                                 reg),
> -                                          CONST0_RTX (vmode),
> -                                          GEN_INT (HOST_WIDE_INT_1U))));
> +         emit_insn (gen_rtx_SET (gen_rtx_SUBREG (vmode, vreg, 0),
> +                                 gen_gpr_to_xmm_move_src (vmode, reg)));
>         rtx_insn *seq = get_insns ();
>         end_sequence ();
>         rtx_insn *insn = DF_REF_INSN (ref);

Patch
diff mbox series

Index: gcc/config/i386/i386-features.c
===================================================================
--- gcc/config/i386/i386-features.c	(revision 274504)
+++ gcc/config/i386/i386-features.c	(working copy)
@@ -658,6 +658,25 @@  scalar_chain::emit_conversion_insns (rtx
   emit_insn_after (insns, BB_HEAD (new_bb));
 }
 
+/* Generate the canonical SET_SRC to move GPR to a VMODE vector register,
+   zeroing the upper parts.  */
+
+static rtx
+gen_gpr_to_xmm_move_src (enum machine_mode vmode, rtx gpr)
+{
+  switch (GET_MODE_NUNITS (vmode))
+    {
+    case 1:
+      return gen_rtx_SUBREG (vmode, gpr, 0);
+    case 2:
+      return gen_rtx_VEC_CONCAT (vmode, gpr,
+				 CONST0_RTX (GET_MODE_INNER (vmode)));
+    default:
+      return gen_rtx_VEC_MERGE (vmode, gen_rtx_VEC_DUPLICATE (vmode, gpr),
+				CONST0_RTX (vmode), GEN_INT (HOST_WIDE_INT_1U));
+    }
+}
+
 /* Make vector copies for all register REGNO definitions
    and replace its uses in a chain.  */
 
@@ -684,13 +703,8 @@  general_scalar_chain::make_vector_copies
 	      }
 	    else
 	      emit_move_insn (tmp, reg);
-	    emit_insn (gen_rtx_SET
-		        (gen_rtx_SUBREG (vmode, vreg, 0),
-			 gen_rtx_VEC_MERGE (vmode,
-					    gen_rtx_VEC_DUPLICATE (vmode,
-								   tmp),
-					    CONST0_RTX (vmode),
-					    GEN_INT (HOST_WIDE_INT_1U))));
+	    emit_insn (gen_rtx_SET (gen_rtx_SUBREG (vmode, vreg, 0),
+				    gen_gpr_to_xmm_move_src (vmode, tmp)));
 	  }
 	else if (!TARGET_64BIT && smode == DImode)
 	  {
@@ -720,13 +734,8 @@  general_scalar_chain::make_vector_copies
 	      }
 	  }
 	else
-	  emit_insn (gen_rtx_SET
-		       (gen_rtx_SUBREG (vmode, vreg, 0),
-			gen_rtx_VEC_MERGE (vmode,
-					   gen_rtx_VEC_DUPLICATE (vmode,
-								  reg),
-					   CONST0_RTX (vmode),
-					   GEN_INT (HOST_WIDE_INT_1U))));
+	  emit_insn (gen_rtx_SET (gen_rtx_SUBREG (vmode, vreg, 0),
+				  gen_gpr_to_xmm_move_src (vmode, reg)));
 	rtx_insn *seq = get_insns ();
 	end_sequence ();
 	rtx_insn *insn = DF_REF_INSN (ref);