as of rev 137639: cc1 -fpreprocessed k_rem_pio2.i -quiet -dumpbase k_rem_pio2.c -auxbase-strip lib_a-k_rem_pio2.o -Os -fno-builtin -o k_rem_pio2.s src/newlib/libm/math/k_rem_pio2.c: In function '__kernel_rem_pio2': newlib/libm/math/k_rem_pio2.c:318: error: unable to find a register to spill in class 'A_REGS' newlib/libm/math/k_rem_pio2.c:318: error: this is the insn: (jump_insn 1098 1096 2868 9 newlib/libm/math/k_rem_pio2.c:186 (set (pc) (if_then_else (gt (subreg:HI (reg/v:SI 1108 [ i ]) 2) (subreg:HI (reg/v:SI 1105 [ m ]) 2)) (label_ref:HI 3007) (pc))) 48 {cbranchhi4} (expr_list:REG_BR_PROB (const_int 5000 [0x1388]) (nil))) newlib/libm/math/k_rem_pio2.c:318: internal compiler error: in spill_failure, at reload1.c:1995
Created attachment 15908 [details] preprocessed file for description
Note that the problematic patch has been installed on the 4.3 branch as well.
You mean http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137640 or something else?
Yes, 137639 and 137640 are the same patch, to trunk and 4.3, respectively.
Subject: Re: New: newlib:libm/math/k_rem_pio2.c fails in reload Please try this patch. The m32c target seems to be generating its own invalid addresses and reloads for them, for reasons I don't quite understand, so something like this looks like it's needed to avoid reload generating further reloads in those cases. Index: config/m32c/m32c.c =================================================================== --- config/m32c/m32c.c (revision 137836) +++ config/m32c/m32c.c (working copy) @@ -1778,6 +1778,8 @@ /* Addressing Modes */ +#define BIG_FB_ADJ 0 + /* Used by GO_IF_LEGITIMATE_ADDRESS. The r8c/m32c family supports a wide range of non-orthogonal addressing modes, including the ability to double-indirect on *some* of them. Not all insns @@ -1895,6 +1897,17 @@ return 0; } } + if (RTX_IS ("++rii")) + { + rtx reg = patternr[2]; + HOST_WIDE_INT offs = INTVAL (patternr[3]); + + /* Avoid reloads for addresses generated by + m32c_legitimize_reload_address being generated by + find_reloads_subreg_address. */ + if (REGNO (reg) == FB_REGNO && offs == -BIG_FB_ADJ) + return 1; + } return 0; } @@ -1942,8 +1955,6 @@ frame, so the third case seems best. Note that we subtract the zero, but detect that in the addhi3 pattern. */ -#define BIG_FB_ADJ 0 - /* Implements LEGITIMIZE_ADDRESS. The only address we really have to worry about is frame base offsets, as $fb has a limited displacement range. We deal with this by attempting to reload $fb
m32c-elf is neither primary nor secondary target.
Subject: Re: [4.3/4.4 Regression] newlib:libm/math/k_rem_pio2.c fails in reload It fixes the newlib compile failure, but there are regressions since it last built. I'll have to check each of them to see if they're caused by this patch or something else that's happened since then. Meanwhile, please apply your m32c patch. "newlib doesn't build" is certainly a bigger problem than "some regressions" :-) Thanks!
Subject: Re: [4.3/4.4 Regression] newlib:libm/math/k_rem_pio2.c fails in reload The regressions all show up in v850 and iq2000 too, except one that I can't reproduce, so I'm not going to worry about them.
Subject: Bug 36827 Author: jsm28 Date: Wed Jul 16 10:45:57 2008 New Revision: 137875 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137875 Log: PR target/36827 * config/m32c/m32c.c (BIG_FB_ADJ): Move definition earlier. (m32c_legitimate_address_p): Handle "++rii" addresses created by m32c_legitimize_reload_address. Modified: trunk/gcc/ChangeLog trunk/gcc/config/m32c/m32c.c
Subject: Bug 36827 Author: jsm28 Date: Wed Jul 16 10:46:32 2008 New Revision: 137876 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137876 Log: PR target/36827 * config/m32c/m32c.c (BIG_FB_ADJ): Move definition earlier. (m32c_legitimate_address_p): Handle "++rii" addresses created by m32c_legitimize_reload_address. Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/config/m32c/m32c.c
Subject: Re: [4.3/4.4 Regression] newlib:libm/math/k_rem_pio2.c fails in reload Last night's builds showed a flaw in the patch. The "++rii" address created by m32c_legitimize_reload_address is *not* legitimate, it's used as a marker for addresses that need to be reloaded into an address register. If I fix m32c_print_operand() to print those, it ends up printing an address that exceeds the displacement range of the FB register: regex.s:11903: Error: unrecognized keyword/register name `mov.w mem0,-198[fb]' The original idea was to reload $fb of $sp itself into an address register, and use a displacement off that, so that only one address register is needed for all frame address reloads. I never quite got gcc to do it right.
Subject: Re: [4.3/4.4 Regression] newlib:libm/math/k_rem_pio2.c fails in reload On Wed, 16 Jul 2008, dj at redhat dot com wrote: > Last night's builds showed a flaw in the patch. The "++rii" address > created by m32c_legitimize_reload_address is *not* legitimate, it's > used as a marker for addresses that need to be reloaded into an > address register. If I fix m32c_print_operand() to print those, it > ends up printing an address that exceeds the displacement range of the > FB register: Try changing the "reloaded != 1" condition in find_reloads_subreg_address to "reloaded == 0" (as a replacement for my m32c patch, and probably for the SH patch as well). I hope that should avoid these problems in the cases where LEGITIMIZE_RELOAD_ADDRESS does something like this, and I've verified the original ARM testcase that motivated my reload change still works with that change.
> Try changing the "reloaded != 1" condition in find_reloads_subreg_address > to "reloaded == 0" (as a replacement for my m32c patch, and probably for > the SH patch as well). I hope that should avoid these problems in the > cases where LEGITIMIZE_RELOAD_ADDRESS does something like this, and I've > verified the original ARM testcase that motivated my reload change still > works with that change. This works fine on SH. With this and backing out the workaround in GO_IF_LEGITIMATE_ADDRESS, sh4-unknown-linux-gnu cross x86 is built successfully and the result of regtest looks very clean.
Subject: Re: [4.3/4.4 Regression] newlib:libm/math/k_rem_pio2.c fails in reload Seems to work for m32c too.
Subject: Bug 36827 Author: jsm28 Date: Sat Jul 19 11:14:13 2008 New Revision: 137976 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137976 Log: PR target/36780 PR target/36827 * reload.c (find_reloads_subreg_address): Only reload address if reloaded == 0, not for reloaded != 1. Revert: 2008-07-16 Joseph Myers <joseph@codesourcery.com> * config/m32c/m32c.c (BIG_FB_ADJ): Move definition earlier. (m32c_legitimate_address_p): Handle "++rii" addresses created by m32c_legitimize_reload_address. 2008-07-15 Kaz Kojima <kkojima@gcc.gnu.org> * config/sh/sh.h (GO_IF_LEGITIMATE_ADDRESS): Allow (plus (plus (reg) (const_int)) (const_int)) when reload_in_progress. Modified: trunk/gcc/ChangeLog trunk/gcc/config/m32c/m32c.c trunk/gcc/config/sh/sh.h trunk/gcc/reload.c
Subject: Bug 36827 Author: jsm28 Date: Sat Jul 19 11:15:29 2008 New Revision: 137977 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=137977 Log: PR target/36780 PR target/36827 * reload.c (find_reloads_subreg_address): Only reload address if reloaded == 0, not for reloaded != 1. Revert: 2008-07-16 Joseph Myers <joseph@codesourcery.com> * config/m32c/m32c.c (BIG_FB_ADJ): Move definition earlier. (m32c_legitimate_address_p): Handle "++rii" addresses created by m32c_legitimize_reload_address. 2008-07-15 Kaz Kojima <kkojima@gcc.gnu.org> * config/sh/sh.h (GO_IF_LEGITIMATE_ADDRESS): Allow (plus (plus (reg) (const_int)) (const_int)) when reload_in_progress. Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/config/m32c/m32c.c branches/gcc-4_3-branch/gcc/config/sh/sh.h branches/gcc-4_3-branch/gcc/reload.c
Isn't this fixed now?
4.3.2 is released, changing milestones to 4.3.3.
GCC 4.3.3 is being released, adjusting target milestone.
GCC 4.3.4 is being released, adjusting target milestone.
Fixed long ago. m32c is building newlib without difficulties now.