re PR target/83930 (ICE: RTL check: expected code 'const_int', have 'mem' in simplify...
authorJakub Jelinek <jakub@redhat.com>
Sat, 20 Jan 2018 09:54:06 +0000 (10:54 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 20 Jan 2018 09:54:06 +0000 (10:54 +0100)
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: r256915

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

index bd3c00361f1adcc445fd65908aded5752cea5a8c..983675622ae0e4b1a5c37e3aee421d5e8cd71266 100644 (file)
@@ -1,3 +1,9 @@
+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-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/81570
index b0a0178310141eb67ca431e67cc914eae2d12893..2e7aa5c12952ab1a9b49b5adaf23710327e577d3 100644 (file)
@@ -3411,7 +3411,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 0f7baad75a68d1cc60e2996dcd636cd1f6d19826..e58ae1e28173fd823f9a6c3e0539c98e6c406881 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/83930
+       * gcc.dg/pr83930.c: New test.
+
 2018-01-19  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/83900
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);
+}