This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Using gen_int_mode instead of GEN_INT minot testsuite fallout on MIPS
- From: Graham Stott <graham dot stott at btinternet dot com>
- To: Richard Sandiford <rdsandiford at googlemail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 12 Sep 2013 12:48:39 +0100 (BST)
- Subject: Re: Using gen_int_mode instead of GEN_INT minot testsuite fallout on MIPS
- Authentication-results: sourceware.org; auth=none
- References: <CAFiYyc3o+GLpPnNb=E1ru9rOJxuVkxBMsMEeE99wRm8SRWrmCg at mail dot gmail dot com> <1378833157-11511-1-git-send-email-james dot greenhalgh at arm dot com> <87y574mr2h dot fsf at talisman dot default> <1378900963 dot 71148 dot YahooMailNeo at web87402 dot mail dot ir2 dot yahoo dot com> <87y573kxse dot fsf at talisman dot default>
- Reply-to: Graham Stott <graham dot stott at btinternet dot com>
Hi Richard,
After applying just the cse.c part of the patch the two testcases no longer ICE and pass
with regressions in C or C++ testsuites.
Not sure if we really need the other part of the patch to gen_int_mode ().
Graham
----- Original Message -----
From: Richard Sandiford <rdsandiford@googlemail.com>
To: Graham Stott <graham.stott@btinternet.com>
Cc: James Greenhalgh <james.greenhalgh@arm.com>; "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Sent: Wednesday, 11 September 2013, 19:39
Subject: Re: Using gen_int_mode instead of GEN_INT minot testsuite fallout on MIPS
Graham Stott <graham.stott@btinternet.com> writes:
> Hi Richard,
>
> There is some minor testsuite fallout with these patches on MIPS a
> couple of tests (see below)ICE ingen_int_mode () in both these ICE the
> mode is CCmode.
Hmm, interesting. I suppose gen_int_mode should handle CC modes,
since there's no other constant rtx that can be used instead. OTOH,
like you say, it doesn't really make sense to apply try_const_anchor
to CCmode.
How does the following patch look?
Thanks,
Richard
gcc/
* emit-rtl.c (gen_int_mode): Handle CC modes.
* cse.c (try_const_anchors): ...but punt on them here.
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c 2013-09-08 11:52:15.000000000 +0100
+++ gcc/emit-rtl.c 2013-09-11 19:32:35.702377902 +0100
@@ -417,6 +417,11 @@ gen_rtx_CONST_INT (enum machine_mode mod
rtx
gen_int_mode (HOST_WIDE_INT c, enum machine_mode mode)
{
+ /* CONST_INT is used for CC modes too. We can't make any assumptions
+ about the precision or bitsize in that case, so just pass the value
+ through unchanged. */
+ if (GET_MODE_CLASS (mode) == MODE_CC)
+ return GEN_INT (c);
return GEN_INT (trunc_int_for_mode (c, mode));
}
Index: gcc/cse.c
===================================================================
--- gcc/cse.c 2013-09-08 11:52:15.000000000 +0100
+++ gcc/cse.c 2013-09-11 19:38:17.664399826 +0100
@@ -1354,6 +1354,11 @@ try_const_anchors (rtx src_const, enum m
rtx lower_exp = NULL_RTX, upper_exp = NULL_RTX;
unsigned lower_old, upper_old;
+ /* CONST_INT is used for CC modes, but we should leave those alone. */
+ if (GET_MODE_CLASS (mode) == MODE_CC)
+ return NULL_RTX;
+
+ gcc_assert (SCALAR_INT_MODE_P (mode));
if (!compute_const_anchors (src_const, &lower_base, &lower_offs,
&upper_base, &upper_offs))
return NULL_RTX;