This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, RFC] Handling non-trivial comparisons with cond-exec
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: Richard Henderson <rth at redhat dot com>, Richard dot Earnshaw at arm dot com, gcc-patches at gcc dot gnu dot org
- Date: Wed, 15 Oct 2003 10:21:17 +0100
- Subject: Re: [PATCH, RFC] Handling non-trivial comparisons with cond-exec
- Organization: ARM Ltd.
- References: <orvfteehd7.fsf@livre.redhat.lsd.ic.unicamp.br><ork777b94e.fsf@livre.redhat.lsd.ic.unicamp.br>
- Reply-to: Richard dot Earnshaw at arm dot com
> On Oct 14, 2003, Richard Henderson <rth@redhat.com> wrote:
>
> > On Tue, Oct 14, 2003 at 12:15:16PM +0100, Richard Earnshaw wrote:
> >> * jump.c (any_simple_condjump_p): New function.
> >> * rtl.h: Declare it.
> >> * flow.c (init_propagate_block_info): Only do conditional-execution
> >> processing if the condjump is simple.
>
> > Sounds reasonable.
>
> How about this instead? It fixes the same problem, but for more ports
> than just arm.
>
> http://gcc.gnu.org/ml/gcc-patches/2003-08/msg00206.html
Presumably, the only reason you are canonicalizing the condition is
because cc0 has no associated REGNO, which makes it difficult to track
without reworking this code. Otherwise, it would probably be better to
leave things in the previous form (since the code really wants a
comparison of the form (cond (reg) (0)). Maybe we should investigate
giving cc0 a virtual regno so that we could put it in some bitmaps... (it
would only be manifested in rare cases, like here).
If we are going to go with your patch, we should fix the test for a reg to
also validate that the other operand was zero. That is, instead of
if (GET_CODE (reg) != REG)
abort ();
We should have
if (GET_CODE (reg) != REG || XEXP (cond_true, 1) != const0_rtx)
goto cond_is_not_a_reg;
Otherwise the conditional life information is inaccurate and could lead to
cases where comparisons against different values are incorrectly folded.
R.