re PR rtl-optimization/78526 (ICE: in decompose, at rtl.h:2117 with -g -mavx512bw)
authorJakub Jelinek <jakub@redhat.com>
Fri, 25 Nov 2016 18:56:50 +0000 (19:56 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 25 Nov 2016 18:56:50 +0000 (19:56 +0100)
PR rtl-optimization/78526
* simplify-rtx.c (simplify_immed_subreg): Don't use wi::extract_uhwi
beyond val's precision.

* gcc.dg/pr78526.c: New test.

From-SVN: r242882

gcc/ChangeLog
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr78526.c [new file with mode: 0644]

index 947f8f6d1ddbdb1aef3d2e42a8b7adef95812cd0..bd9929b802c9b1c4743619571934ee4572f3fd0f 100644 (file)
@@ -1,5 +1,9 @@
 2016-11-25  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/78526
+       * simplify-rtx.c (simplify_immed_subreg): Don't use wi::extract_uhwi
+       beyond val's precision.
+
        PR rtl-optimization/78527
        * combine.c (make_compound_operation_int): Ignore LSHIFTRT with
        out of bounds shift count.
index fde244302481ce2b71211d12717383f1ecfbf8d0..f6131d48130c7d5ed35f43d206ad794b5207aad9 100644 (file)
@@ -5740,8 +5740,9 @@ simplify_immed_subreg (machine_mode outermode, rtx op,
          {
            rtx_mode_t val = rtx_mode_t (el, innermode);
            unsigned char extend = wi::sign_mask (val);
+           int prec = wi::get_precision (val);
 
-           for (i = 0; i < elem_bitsize; i += value_bit)
+           for (i = 0; i < prec && i < elem_bitsize; i += value_bit)
              *vp++ = wi::extract_uhwi (val, i, value_bit);
            for (; i < elem_bitsize; i += value_bit)
              *vp++ = extend;
index 2b5830509c78f08f35f76b006d50b55d1ad13c6d..1dd7380d883393a214d686d369fb7da226d836cb 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-25  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/78526
+       * gcc.dg/pr78526.c: New test.
+
 2016-11-25  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR rtl-optimization/77541
diff --git a/gcc/testsuite/gcc.dg/pr78526.c b/gcc/testsuite/gcc.dg/pr78526.c
new file mode 100644 (file)
index 0000000..560e146
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR rtl-optimization/78526 */
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O -fno-tree-ccp -fno-tree-sra -g -w" } */
+/* { dg-additional-options "-mavx512bw" { target i?86-*-* x86_64-*-* } } */
+
+typedef unsigned U __attribute__ ((vector_size (64)));
+typedef unsigned __int128 V __attribute__ ((vector_size (64)));
+
+static inline V
+bar (U u, U x, V v)
+{
+  v = (V)(U) { 0, ~0 };
+  v[x[0]] <<= u[-63];
+  return v;
+}
+
+V
+foo (U u)
+{
+  return bar (u, (U) {}, (V) {});
+}