From 043f9c564cae173b8ba85f7f55a3b1c4a152e2c7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 25 Jun 2018 19:13:04 +0200 Subject: [PATCH] backport: re PR target/83930 (ICE: RTL check: expected code 'const_int', have 'mem' in simplify_binary_operation_1, at simplify-rtx.c:3302) Backported from mainline 2018-01-20 Jakub Jelinek PR target/83930 * simplify-rtx.c (simplify_binary_operation_1) : Use UINTVAL (trueop1) instead of INTVAL (op1). * gcc.dg/pr83930.c: New test. From-SVN: r262055 --- gcc/ChangeLog | 6 ++++++ gcc/simplify-rtx.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr83930.c | 17 +++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr83930.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 80fcd2997a38..f26e3407723a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2018-06-25 Jakub Jelinek Backported from mainline + 2018-01-20 Jakub Jelinek + + PR target/83930 + * simplify-rtx.c (simplify_binary_operation_1) : Use + UINTVAL (trueop1) instead of INTVAL (op1). + 2018-01-09 Jakub Jelinek PR preprocessor/83722 diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index c3d594a1a430..5acc7eae29c1 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -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: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8033c0e9caee..e727fe28b0e4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2018-06-25 Jakub Jelinek Backported from mainline + 2018-01-20 Jakub Jelinek + + PR target/83930 + * gcc.dg/pr83930.c: New test. + 2018-01-18 Jakub Jelinek PR c++/83824 diff --git a/gcc/testsuite/gcc.dg/pr83930.c b/gcc/testsuite/gcc.dg/pr83930.c new file mode 100644 index 000000000000..8a079af3fb43 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr83930.c @@ -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); +} -- 2.47.2