re PR debug/86194 (ICE: SIGSEGV in avoid_constant_pool_reference (simplify-rtx.c...
authorJakub Jelinek <jakub@redhat.com>
Wed, 20 Jun 2018 14:51:04 +0000 (16:51 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 20 Jun 2018 14:51:04 +0000 (16:51 +0200)
PR debug/86194
* var-tracking.c (use_narrower_mode_test): Check if shift amount can
be narrowed.

* gcc.target/i386/pr86194.c: New test.

From-SVN: r261807

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr86194.c [new file with mode: 0644]
gcc/var-tracking.c

index 5d267eb1fac74b762043c6a919ce01af64028740..7b399f1a3b9bb8b3a68f3639a5001f4f720b00ad 100644 (file)
@@ -1,5 +1,9 @@
 2018-06-20  Jakub Jelinek  <jakub@redhat.com>
 
+       PR debug/86194
+       * var-tracking.c (use_narrower_mode_test): Check if shift amount can
+       be narrowed.
+
        PR tree-optimization/86231
        * tree-vrp.c (union_ranges): For (  [  )  ] or (   )[   ] range and
        anti-range don't overwrite *vr0min before using it to compute *vr0max.
index 5b3de8da4d251460b57f0eb6e25a2066ba0f3ecd..ce89b3348f66f941fe92d09af751835261a55034 100644 (file)
@@ -1,5 +1,8 @@
 2018-06-20  Jakub Jelinek  <jakub@redhat.com>
 
+       PR debug/86194
+       * gcc.target/i386/pr86194.c: New test.
+
        PR tree-optimization/86231
        * gcc.dg/tree-ssa/vrp119.c: New test.
        * gcc.c-torture/execute/pr86231.c: New test.
diff --git a/gcc/testsuite/gcc.target/i386/pr86194.c b/gcc/testsuite/gcc.target/i386/pr86194.c
new file mode 100644 (file)
index 0000000..0993155
--- /dev/null
@@ -0,0 +1,24 @@
+/* PR debug/86194 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O -g -mavx512bw" } */
+
+typedef unsigned U __attribute__ ((vector_size (64)));
+typedef unsigned long V __attribute__ ((vector_size (64)));
+typedef unsigned __int128 W __attribute__ ((vector_size (64)));
+
+U u;
+
+W
+bar (W w)
+{
+  U k = u;
+  w <<= (W)(U) { 5, 3, 3, 0, 7, 3, 1, 3, k[7] };
+  k += (U) { -(char)w[3] } != k;
+  return (W)k + w;
+}
+
+void
+foo (void)
+{
+  u = (U){ bar ((W)(V) { 0, ~0, 0, 0, 0, 0, ~0 })[0] };
+}
index 2bbde92086fe8de195f2acdce37b5d5409cbd96b..8e800960b6d0faab28197b68823200a480206f28 100644 (file)
@@ -964,6 +964,24 @@ use_narrower_mode_test (rtx x, const_rtx subreg)
          case MULT:
            break;
          case ASHIFT:
+           if (GET_MODE (XEXP (x, 1)) != VOIDmode)
+             {
+               enum machine_mode mode = GET_MODE (subreg);
+               rtx op1 = XEXP (x, 1);
+               enum machine_mode op1_mode = GET_MODE (op1);
+               if (GET_MODE_PRECISION (as_a <scalar_int_mode> (mode))
+                   < GET_MODE_PRECISION (as_a <scalar_int_mode> (op1_mode)))
+                 {
+                   poly_uint64 byte = subreg_lowpart_offset (mode, op1_mode);
+                   if (GET_CODE (op1) == SUBREG || GET_CODE (op1) == CONCAT)
+                     {
+                       if (!simplify_subreg (mode, op1, op1_mode, byte))
+                         return false;
+                     }
+                   else if (!validate_subreg (mode, op1_mode, op1, byte))
+                     return false;
+                 }
+             }
            iter.substitute (XEXP (x, 0));
            break;
          default: