Hi!

The following testcase ICEs because DECL_RTL/DECL_INCOMING_RTL are adjusted
by the stv pass through the PUT_MODE modifications, which means that for
var-tracking.c they contain a bogus mode.

Fixed by wrapping those into TImode subreg or adjusting the MEMs to have the
correct mode.

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

2016-11-29  Jakub Jelinek  <ja...@redhat.com>

        PR rtl-optimization/78547
        * config/i386/i386.c (convert_scalars_to_vectors): If any
        insns have been converted, adjust all parameter's DEC_RTL and
        DECL_INCOMING_RTL back from V1TImode to TImode if the parameters have
        TImode.

--- gcc/config/i386/i386.c.jj   2016-11-29 08:31:58.000000000 +0100
+++ gcc/config/i386/i386.c      2016-11-29 12:21:36.867323776 +0100
@@ -4075,6 +4075,39 @@ convert_scalars_to_vector ()
        crtl->stack_alignment_needed = 128;
       if (crtl->stack_alignment_estimated < 128)
        crtl->stack_alignment_estimated = 128;
+      /* Fix up DECL_RTL/DECL_INCOMING_RTL of arguments.  */
+      if (TARGET_64BIT)
+       for (tree parm = DECL_ARGUMENTS (current_function_decl);
+            parm; parm = DECL_CHAIN (parm))
+         {
+           if (TYPE_MODE (TREE_TYPE (parm)) != TImode)
+             continue;
+           if (DECL_RTL_SET_P (parm)
+               && GET_MODE (DECL_RTL (parm)) == V1TImode)
+             {
+               rtx r = DECL_RTL (parm);
+               if (REG_P (r))
+                 SET_DECL_RTL (parm, gen_rtx_SUBREG (TImode, r, 0));
+               else
+                 {
+                   gcc_assert (MEM_P (r));
+                   SET_DECL_RTL (parm, adjust_address_nv (r, TImode, 0));
+                 }
+             }
+           if (DECL_INCOMING_RTL (parm)
+               && GET_MODE (DECL_INCOMING_RTL (parm)) == V1TImode)
+             {
+               rtx r = DECL_INCOMING_RTL (parm);
+               if (REG_P (r))
+                 DECL_INCOMING_RTL (parm) = gen_rtx_SUBREG (TImode, r, 0);
+               else
+                 {
+                   gcc_assert (MEM_P (r));
+                   DECL_INCOMING_RTL (parm)
+                     = change_address (r, TImode, NULL_RTX);
+                 }
+             }
+         }
     }
 
   return 0;
--- gcc/testsuite/gcc.dg/pr78547.c.jj   2016-11-29 12:26:26.544662630 +0100
+++ gcc/testsuite/gcc.dg/pr78547.c      2016-11-29 12:26:09.000000000 +0100
@@ -0,0 +1,18 @@
+/* PR rtl-optimization/78547 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-Os -g -freorder-blocks-algorithm=simple -Wno-psabi" } */
+/* { dg-additional-options "-mstringop-strategy=libcall" { target i?86-*-* 
x86_64-*-* } } */
+
+typedef unsigned __int128 u128;
+typedef unsigned __int128 V __attribute__ ((vector_size (64)));
+
+V
+foo (u128 a, u128 b, u128 c, V d)
+{
+  V e = (V) {a};
+  V f = e & 1;
+  e = 0 != e;
+  c = c;
+  f = f << ((V) {c} & 7);
+  return f + e;
+}

        Jakub

Reply via email to