]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/83930 (ICE: RTL check: expected code 'const_int', have 'mem...
authorJakub Jelinek <jakub@redhat.com>
Mon, 25 Jun 2018 17:13:04 +0000 (19:13 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 25 Jun 2018 17:13:04 +0000 (19:13 +0200)
Backported from mainline
2018-01-20  Jakub Jelinek  <jakub@redhat.com>

PR target/83930
* simplify-rtx.c (simplify_binary_operation_1) <case UMOD>: Use
UINTVAL (trueop1) instead of INTVAL (op1).

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

From-SVN: r262055

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

index 80fcd2997a3806f5281d29917199ed7eebdc8e49..f26e3407723af9d20592fb8ff6897b1b0974bb67 100644 (file)
@@ -1,6 +1,12 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-01-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/83930
+       * simplify-rtx.c (simplify_binary_operation_1) <case UMOD>: Use
+       UINTVAL (trueop1) instead of INTVAL (op1).
+
        2018-01-09  Jakub Jelinek  <jakub@redhat.com>
 
        PR preprocessor/83722
index c3d594a1a4303711545e759c0d0da40dc0bbcdbf..5acc7eae29c16873e12fcaae6394ecabd94e1114 100644 (file)
@@ -3233,7 +3233,8 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
       if (CONST_INT_P (trueop1)
          && exact_log2 (UINTVAL (trueop1)) > 0)
        return simplify_gen_binary (AND, mode, op0,
-                                   gen_int_mode (INTVAL (op1) - 1, mode));
+                                   gen_int_mode (UINTVAL (trueop1) - 1,
+                                                 mode));
       break;
 
     case MOD:
index 8033c0e9caee5c06e6f33098102e8ba58ea40c18..e727fe28b0e454f087de692ca0db3880cb5b1dea 100644 (file)
@@ -1,6 +1,11 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-01-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/83930
+       * gcc.dg/pr83930.c: New test.
+
        2018-01-18  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/83824
diff --git a/gcc/testsuite/gcc.dg/pr83930.c b/gcc/testsuite/gcc.dg/pr83930.c
new file mode 100644 (file)
index 0000000..8a079af
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR target/83930 */
+/* { dg-do compile } */
+/* { dg-options "-Og -fno-tree-ccp -w" } */
+
+unsigned __attribute__ ((__vector_size__ (16))) v;
+
+static inline void
+bar (unsigned char d)
+{
+  v /= d;
+}
+
+__attribute__ ((always_inline)) void
+foo (void)
+{
+  bar (4);
+}