From deeedbada1aaf79f0e223f492ecaffdc05e91af7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 3 Sep 2019 18:46:06 +0200 Subject: [PATCH] re PR target/91604 (ICE in extract_insn at recog.c:2310 since r272323) PR target/91604 * config/i386/i386-expand.c (split_double_mode): If there is more than one MEM operand and they are rtx_equal_p, reuse lo_half/hi_half from already split matching MEM operand instead of calling adjust_address again. * gcc.target/i386/pr91604.c: New test. From-SVN: r275344 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/i386-expand.c | 16 ++++++++++++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr91604.c | 11 +++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr91604.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4996f8cecec..6ac810fca55 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-09-03 Jakub Jelinek + + PR target/91604 + * config/i386/i386-expand.c (split_double_mode): If there is more than + one MEM operand and they are rtx_equal_p, reuse lo_half/hi_half from + already split matching MEM operand instead of calling adjust_address + again. + 2019-09-03 Ulrich Weigand * config.gcc: Obsolete spu target. Remove references to spu. diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index ec50de297ee..862cd81da4d 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -106,6 +106,8 @@ split_double_mode (machine_mode mode, rtx operands[], { machine_mode half_mode; unsigned int byte; + rtx mem_op = NULL_RTX; + int mem_num = 0; switch (mode) { @@ -129,8 +131,18 @@ split_double_mode (machine_mode mode, rtx operands[], but we still have to handle it. */ if (MEM_P (op)) { - lo_half[num] = adjust_address (op, half_mode, 0); - hi_half[num] = adjust_address (op, half_mode, byte); + if (mem_op && rtx_equal_p (op, mem_op)) + { + lo_half[num] = lo_half[mem_num]; + hi_half[num] = hi_half[mem_num]; + } + else + { + mem_op = op; + mem_num = num; + lo_half[num] = adjust_address (op, half_mode, 0); + hi_half[num] = adjust_address (op, half_mode, byte); + } } else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1a17b066401..44c43d26b93 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-03 Jakub Jelinek + + PR target/91604 + * gcc.target/i386/pr91604.c: New test. + 2019-09-03 Ulrich Weigand * lib/compat.exp: Remove references to spu. diff --git a/gcc/testsuite/gcc.target/i386/pr91604.c b/gcc/testsuite/gcc.target/i386/pr91604.c new file mode 100644 index 00000000000..329f17f806d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr91604.c @@ -0,0 +1,11 @@ +/* PR target/91604 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -msse2 --param max-gcse-memory=0 -fno-rerun-cse-after-loop" } */ + +long long v; + +void +foo (void) +{ + v = ~v; +} -- 2.30.2