From 857e57535196dbb690cf80afadbfda9756417a4b Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Mon, 8 May 2006 21:09:49 +0000 Subject: [PATCH] re PR target/27158 (ICE in extract_insn with -maltivec) PR target/27158 * reload.c (find_reloads_toplev): Only return the simplified SUBREG of a reg_equiv_constant if the result is a legitimate constant. * gcc.target/powerpc/pr27158.c: New test case. From-SVN: r113632 --- gcc/ChangeLog | 6 ++++++ gcc/reload.c | 14 +++++++++----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/powerpc/pr27158.c | 22 ++++++++++++++++++++++ 4 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr27158.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 631921b45a6..f660c99ec6b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-05-08 Roger Sayle + + PR target/27158 + * reload.c (find_reloads_toplev): Only return the simplified SUBREG + of a reg_equiv_constant if the result is a legitimate constant. + 2006-05-08 Uros Bizjak PR target/27277 diff --git a/gcc/reload.c b/gcc/reload.c index e7798b9c41a..03b5ba6beef 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -4559,20 +4559,24 @@ find_reloads_toplev (rtx x, int opnum, enum reload_type type, rtx tem; if (subreg_lowpart_p (x) - && regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0 + && regno >= FIRST_PSEUDO_REGISTER + && reg_renumber[regno] < 0 && reg_equiv_constant[regno] != 0 && (tem = gen_lowpart_common (GET_MODE (x), - reg_equiv_constant[regno])) != 0) + reg_equiv_constant[regno])) != 0 + && LEGITIMATE_CONSTANT_P (tem)) return tem; - if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0 + if (regno >= FIRST_PSEUDO_REGISTER + && reg_renumber[regno] < 0 && reg_equiv_constant[regno] != 0) { tem = simplify_gen_subreg (GET_MODE (x), reg_equiv_constant[regno], GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x)); gcc_assert (tem); - return tem; + if (LEGITIMATE_CONSTANT_P (tem)) + return tem; } /* If the subreg contains a reg that will be converted to a mem, @@ -4588,7 +4592,7 @@ find_reloads_toplev (rtx x, int opnum, enum reload_type type, a wider mode if we have a paradoxical SUBREG. find_reloads will force a reload in that case. So we should not do anything here. */ - else if (regno >= FIRST_PSEUDO_REGISTER + if (regno >= FIRST_PSEUDO_REGISTER #ifdef LOAD_EXTEND_OP && (GET_MODE_SIZE (GET_MODE (x)) <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c490218c53f..0911cd99898 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-05-08 Roger Sayle + + PR target/27158 + * gcc.target/powerpc/pr27158.c: New test case. + 2006-05-08 Laurent GUERBY PR testsuite/27476 diff --git a/gcc/testsuite/gcc.target/powerpc/pr27158.c b/gcc/testsuite/gcc.target/powerpc/pr27158.c new file mode 100644 index 00000000000..4228e9a3584 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr27158.c @@ -0,0 +1,22 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-xfail-if "" { "powerpc-*-eabispe*" "powerpc-ibm-aix*" } { "*" } { "" } } */ +/* { dg-options "-O2 -maltivec" } */ +#define REGLIST \ + "77", "78", "79", "80", "81", "82", "83", "84", "85", "86",\ + "87", "88", "89", "90", "91", "92", "93", "94", "95", "96",\ + "97", "98", "99", "100", "101", "102", "103", "104", "105", "106",\ + "107", "108" + +typedef __attribute__ ((vector_size (16))) float v4sf; + +void +foo (int H) +{ + volatile v4sf tmp; + while (H-- > 0) + { + asm ("" : : : REGLIST); + tmp = (v4sf) __builtin_altivec_vspltisw (1); + } +} + -- 2.30.2