From 8a27cf73aa5ce0a0d0c426862e01b4ede6ac9b3f Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 5 Sep 2016 16:44:19 +0200 Subject: [PATCH] re PR target/77452 (ICE: in plus_constant, at explow.c:87 with -fno-split-wide-types -mavx512f --param=max-combine-insns=2) PR rtl-optimization/77452 * explow.c (plus_constant) : Extract scalar constant from inner-mode reference to a CONST_VECTOR constant in the constant pool. testsuite/ChangeLog: PR rtl-optimization/77452 * gcc.target/i386/pr77452.c: New test. From-SVN: r239989 --- gcc/ChangeLog | 6 ++++++ gcc/explow.c | 10 +++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr77452.c | 13 +++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr77452.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 00a552dcc95..897bfbbea8a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-09-05 Uros Bizjak + + PR rtl-optimization/77452 + * explow.c (plus_constant) : Extract scalar constant from + inner-mode reference to a CONST_VECTOR constant in the constant pool. + 2016-09-05 Marek Polacek PR c/77423 diff --git a/gcc/explow.c b/gcc/explow.c index b14291d8653..e935c307bcb 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -106,7 +106,15 @@ plus_constant (machine_mode mode, rtx x, HOST_WIDE_INT c, if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (XEXP (x, 0))) { - tem = plus_constant (mode, get_pool_constant (XEXP (x, 0)), c); + rtx cst = get_pool_constant (XEXP (x, 0)); + + if (GET_CODE (cst) == CONST_VECTOR + && GET_MODE_INNER (GET_MODE (cst)) == mode) + { + cst = gen_lowpart (mode, cst); + gcc_assert (cst); + } + tem = plus_constant (mode, cst, c); tem = force_const_mem (GET_MODE (x), tem); /* Targets may disallow some constants in the constant pool, thus force_const_mem may return NULL_RTX. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e54fc2ff7fe..ad6b6809523 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-05 Uros Bizjak + + PR rtl-optimization/77452 + * gcc.target/i386/pr77452.c: New test. + 2016-09-05 Marek Polacek PR c/77423 diff --git a/gcc/testsuite/gcc.target/i386/pr77452.c b/gcc/testsuite/gcc.target/i386/pr77452.c new file mode 100644 index 00000000000..89c5329ff89 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr77452.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O -mavx512f -fno-split-wide-types --param max-combine-insns=2" } */ + +typedef unsigned int U __attribute__((vector_size(64))); +typedef unsigned __int128 V __attribute__((vector_size(64))); + +V +foo(V v) +{ + v[0] = 1u << (( ((V)(U){1, 1, v[0]})[0]) & 0xf) + >> ((-~((V)(U){1, 1, v[0]})[0]) & 0xf); + return v; +} -- 2.30.2