https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100645

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |linkw at gcc dot gnu.org

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
Confirmed.

type v2di (vector(2) long long int) goes with TImode with altivec support,
which isn't a vector mode, so it fails with:

  gcc_assert (VECTOR_MODE_P (vector_mode));

The reason why veclower doesn't lower it is that: it can go with vec_shr_optab
against TImode.

       /* Also detect vec_shr pattern - VEC_PERM_EXPR with zero
         vector as VEC1 and a right element shift MASK.  */
      if (optab_handler (vec_shr_optab, TYPE_MODE (vect_type))
          != CODE_FOR_nothing
         ...

One alternative is to guard this check with VECTOR_MODE_P(TYPE_MODE
(vect_type)), but someone can argue that target shouldn't support this kind of
optab for one non vector mode. So it's more reasonable to fix it in target
code:

diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md
index b87a742cca8..ed3feee2041 100644
--- a/gcc/config/rs6000/vector.md
+++ b/gcc/config/rs6000/vector.md
@@ -1532,7 +1532,7 @@ (define_expand "vec_shr_<mode>"
   [(match_operand:VEC_L 0 "vlogical_operand")
    (match_operand:VEC_L 1 "vlogical_operand")
    (match_operand:QI 2 "reg_or_short_operand")]
-  "TARGET_ALTIVEC"
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
 {
   rtx bitshift = operands[2];
   rtx shift;

TImode is excluded by VECTOR_UNIT_ALTIVEC_OR_VSX_P check.

Reply via email to