This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: fix alpha gcc.dg/20040123-1.c
- From: Richard Henderson <rth at redhat dot com>
- To: Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Nick Clifton <nickc at redhat dot com>
- Date: Thu, 16 Jun 2005 10:07:43 -0700
- Subject: Re: fix alpha gcc.dg/20040123-1.c
- References: <20040226020733.GA13202@redhat.com> <42B15588.6040706@renesas.com>
On Thu, Jun 16, 2005 at 07:33:44PM +0900, Kazuhiro Inaoka wrote:
> I'm using m32r-elf-gcc (3.4, 4.0, mainline).
> It has a same problem (FAIL: gcc.dg/20040123-1.c).
> Would you give me some idea to fix the problem?
The problematic transformation is here, gen_compare:
815 /* Reg/smallconst equal comparison. */
816 if (compare_code == EQ
817 && GET_CODE (y) == CONST_INT
818 && CMP_INT16_P (INTVAL (y)))
819 {
820 rtx tmp = gen_reg_rtx (SImode);
821
822 emit_insn (gen_addsi3 (tmp, x, GEN_INT (-INTVAL (y))));
And another at line 694. (It seems like this code could be reorganized
such that you don't need two copies of this code.)
As in the alpha patch, you can check REG_POINTER and suppress this particular
transformation. Which looks as if it will fall through to the setcc insn.
You could add a second transformation using XOR here. First, because XOR
has a different range of constants than PLUS, and so could be useful in
other cases. But second because XOR will not suffer the same strong symbol
problem that the PLUS transformation does.
r~