Hi!

ix86_expand_vector_init_duplicate doesn't handle TImode -> V2TImode
or TImode -> V4TImode broadcasts, so I think we should punt on TImode
inner mode in ix86_broadcast_from_integer_constant, otherwise we ICE
in ix86_expand_vector_move when ix86_broadcast_from_integer_constant
returns non-NULL and ix86_expand_vector_init_duplicate returns false.

In theory TImode element broadcasts could be handled by some permutations,
but I'm not sure it is worth it.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2021-07-02  Jakub Jelinek  <ja...@redhat.com>

        PR target/101286
        * config/i386/i386-expand.c (ix86_broadcast_from_integer_constant):
        Return nullptr for TImode inner mode.

        * gcc.target/i386/avx2-pr101286.c: New test.

--- gcc/config/i386/i386-expand.c.jj    2021-07-01 22:29:24.991375023 +0200
+++ gcc/config/i386/i386-expand.c       2021-07-01 22:45:29.373773262 +0200
@@ -478,6 +478,9 @@ ix86_broadcast_from_integer_constant (ma
   if (GET_MODE_INNER (mode) == DImode && !TARGET_64BIT)
     return nullptr;
 
+  if (GET_MODE_INNER (mode) == TImode)
+    return nullptr;
+
   rtx constant = get_pool_constant (XEXP (op, 0));
   if (GET_CODE (constant) != CONST_VECTOR)
     return nullptr;
--- gcc/testsuite/gcc.target/i386/avx2-pr101286.c.jj    2021-07-01 
22:44:31.388594997 +0200
+++ gcc/testsuite/gcc.target/i386/avx2-pr101286.c       2021-07-01 
22:45:12.688009721 +0200
@@ -0,0 +1,11 @@
+/* PR target/101286 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-mavx2" } */
+
+typedef __attribute__((__vector_size__ (2 * sizeof (__int128)))) __int128 V;
+
+V
+foo (void)
+{
+  return (V){(__int128) 1 << 64 | 1, (__int128) 1 << 64 | 1};
+}

        Jakub

Reply via email to