This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, RFC] Handling non-trivial comparisons with cond-exec


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]