From d9cb427712544eac737ace9cce2a1b607d9b4f9b Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 21 May 2019 19:57:11 +0200 Subject: [PATCH] re PR target/90547 (ICE in gen_lowpart_general, at rtlhooks.c:63) PR target/90547 * config/i386/i386.md (anddi_1 to andsi_1_zext splitter): Avoid calling gen_lowpart with CONST operand. testsuite/ChangeLog: PR target/90547 * gcc.target/i386/pr90547.c: New test. From-SVN: r271479 --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/i386.md | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr90547.c | 21 +++++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr90547.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 52178fefa7c..8a89dc8b943 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-05-21 Uroš Bizjak + + PR target/90547 + * config/i386/i386.md (anddi_1 to andsi_1_zext splitter): + Avoid calling gen_lowpart with CONST operand. + 2019-05-21 Alexandre Oliva * tree-ssa-threadupdate.c (struct ssa_local_info_t): Add diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 2e6329a3890..da5163de80e 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -8525,6 +8525,14 @@ operands[2] = shallow_copy_rtx (operands[2]); PUT_MODE (operands[2], SImode); } + else if (GET_CODE (operands[2]) == CONST) + { + /* (const:DI (plus:DI (symbol_ref:DI ("...")) (const_int N))) */ + operands[2] = copy_rtx (operands[2]); + PUT_MODE (operands[2], SImode); + PUT_MODE (XEXP (operands[2], 0), SImode); + PUT_MODE (XEXP (XEXP (operands[2], 0), 0), SImode); + } else operands[2] = gen_lowpart (SImode, operands[2]); }) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4e8e73cb52f..b2781fa0f0b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-05-21 Uroš Bizjak + + PR target/90547 + * gcc.target/i386/pr90547.c: New test. + 2019-05-21 Rainer Orth * gcc.dg/Wattribute-alias.c: Pass emtpy arg to dg-require-ifunc. diff --git a/gcc/testsuite/gcc.target/i386/pr90547.c b/gcc/testsuite/gcc.target/i386/pr90547.c new file mode 100644 index 00000000000..fcfe66953b0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr90547.c @@ -0,0 +1,21 @@ +/* PR target/90547 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void +foo () +{ + void *g[] = {&&a, &&b}; + + for (unsigned c = 0x1F;; c >>= 1) + { + unsigned d = (long)("a"+1); + long e = 8; + + while (e) + { + a: goto *g[c&d]; + b: e--; + } + } +} -- 2.30.2