Re: PR37363: PR36090 and PR36182 all over again

2008-09-07 Thread Richard Sandiford
"David Edelsohn" <[EMAIL PROTECTED]> writes: > On Sun, Sep 7, 2008 at 1:58 PM, Richard Sandiford > <[EMAIL PROTECTED]> wrote: >>> I agree. So your plan would be to change rs6000 to an unspec, and drop >>> the problematic hunk in simplify-rtx.c? That would be okay with me, but >>> it's not a small

Re: PR37363: PR36090 and PR36182 all over again

2008-09-07 Thread David Edelsohn
On Sun, Sep 7, 2008 at 1:58 PM, Richard Sandiford <[EMAIL PROTECTED]> wrote: >> I agree. So your plan would be to change rs6000 to an unspec, and drop >> the problematic hunk in simplify-rtx.c? That would be okay with me, but >> it's not a small change for rs6000. > > Yeah, this is very much my p

Re: PR37363: PR36090 and PR36182 all over again

2008-09-07 Thread Richard Sandiford
Paolo Bonzini <[EMAIL PROTECTED]> writes: >> would in some cases be accurate.) I think using an unspec in rs6000 >> would solve some of the port-specific issues. In particular, I don't >> think 36090 would have happened with an unspec representation. > > I agree. So your plan would be to change

Re: PR37363: PR36090 and PR36182 all over again

2008-09-07 Thread Hans-Peter Nilsson
> Date: Sun, 07 Sep 2008 17:48:17 +0200 > From: Paolo Bonzini <[EMAIL PROTECTED]> > > 3. Change the default of LEGITIMATE_CONSTANT_P to a helper > >function, maybe trivial_constant_expression_p above. > > Agreed, but I don't see t_c_e_p in GCC sources Of course not, as it's a *proposed* new

Re: PR37363: PR36090 and PR36182 all over again

2008-09-07 Thread Paolo Bonzini
> Only with a LEGITIMATE_CONSTANT_P catching it... Of course. > So, can we agree on some or all of: > > 1. This (PR37363/PR36182) and PR36090 (in both ports) and >whatever other port will be affected should be solved by a >stricter LEGITIMATE_CONSTANT_P check, and where >canonicaliz

Re: PR37363: PR36090 and PR36182 all over again

2008-09-07 Thread Hans-Peter Nilsson
> Date: Sat, 06 Sep 2008 15:14:46 +0200 > From: Paolo Bonzini <[EMAIL PROTECTED]> > >> H-P can check for the problematic case inside his LEGITIMATE_CONSTANT_P > >> (*), or add a move expander for it. > > > > I think you're mixing up CRIS and rs6000, the latter which > > generated something it had

Re: PR37363: PR36090 and PR36182 all over again

2008-09-07 Thread Paolo Bonzini
> As H-P says, the predicates on move expanders are generally ignored. > emit_move_insn & subroutines deliberately don't check them. It's even worse; force_reg is effectively hardcoding movXX's operand 1 to be a general_operand. (But my point was that force_reg does use LEGITIMATE_CONSTANT_P thr

Re: PR37363: PR36090 and PR36182 all over again

2008-09-07 Thread Richard Sandiford
Paolo Bonzini <[EMAIL PROTECTED]> writes: >>> In case of cris, the predicate goes into general_operand, which does >>> >>> if (CONSTANT_P (op)) >>> return ((GET_MODE (op) == VOIDmode || GET_MODE (op) == mode >>> || mode == VOIDmode) >>> && (! flag_pic || LEGITIMATE_PI

Re: PR37363: PR36090 and PR36182 all over again

2008-09-06 Thread Paolo Bonzini
>> In case of cris, the predicate goes into general_operand, which does >> >> if (CONSTANT_P (op)) >> return ((GET_MODE (op) == VOIDmode || GET_MODE (op) == mode >> || mode == VOIDmode) >> && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op)) >> && LEGITIMATE_

Re: PR37363: PR36090 and PR36182 all over again

2008-09-06 Thread Hans-Peter Nilsson
> Date: Sat, 06 Sep 2008 12:50:18 +0200 > From: Paolo Bonzini <[EMAIL PROTECTED]> > Still, having a new target hook for this seems overkill. But it's better than abusing an old macro with a slightly different use. > For example, > since ports do have to deal with complicated constants when they

Re: PR37363: PR36090 and PR36182 all over again

2008-09-06 Thread Paolo Bonzini
> if plus_constant _knows_ that something can be wrapped in a CONST, > simplify_binary_operation should have given us the CONST to begin with. > Also, the only cases that plus_constant can handle are CONST, > SYMBOL_REF and LABEL_REF, all of which satisfy CONSTANT_P. > So the new form ought to be

Re: PR37363: PR36090 and PR36182 all over again

2008-09-06 Thread Richard Sandiford
Paolo Bonzini <[EMAIL PROTECTED]> writes: >> I'm not sure about this bit. Couldn't [snip cse.c code] >> simply be replaced by: >> >> /* We can't simplify extension ops unless we know the >> original mode. */ >> if ((code == ZERO_EXTEND || code == SIGN_EXTEND) >>&& mode_a

Re: PR37363: PR36090 and PR36182 all over again

2008-09-06 Thread Paolo Bonzini
> I'm not sure about this bit. Couldn't [snip cse.c code] > simply be replaced by: > > /* We can't simplify extension ops unless we know the >original mode. */ > if ((code == ZERO_EXTEND || code == SIGN_EXTEND) > && mode_arg0 == VOIDmode) > break; > > new

Re: PR37363: PR36090 and PR36182 all over again

2008-09-06 Thread Richard Sandiford
Paolo Bonzini <[EMAIL PROTECTED]> writes: > Index: cse.c > === > --- cse.c (revision 134435) > +++ cse.c (working copy) > @@ -3161,10 +3161,8 @@ fold_rtx (rtx x, rtx insn) > FIXME: those ports should be fixed. */ >

Re: PR37363: PR36090 and PR36182 all over again

2008-09-06 Thread Paolo Bonzini
Paolo Bonzini wrote: > Hans-Peter Nilsson wrote: >>> Date: Fri, 5 Sep 2008 14:57:00 +0200 >>> From: Hans-Peter Nilsson <[EMAIL PROTECTED]> >>> Maybe as part of a change from target macro to target hook, with >>> LEGITIMATE_CONSTANT_P as a default would fit, even at this >>> stage? >> Sorry, I mean

Re: PR37363: PR36090 and PR36182 all over again

2008-09-06 Thread Paolo Bonzini
Hans-Peter Nilsson wrote: >> Date: Fri, 5 Sep 2008 14:57:00 +0200 >> From: Hans-Peter Nilsson <[EMAIL PROTECTED]> > >> Maybe as part of a change from target macro to target hook, with >> LEGITIMATE_CONSTANT_P as a default would fit, even at this >> stage? > > Sorry, I mean CONSTANT_P, not LEGITIM

Re: PR37363: PR36090 and PR36182 all over again

2008-09-05 Thread Hans-Peter Nilsson
> Date: Fri, 5 Sep 2008 14:57:00 +0200 > From: Hans-Peter Nilsson <[EMAIL PROTECTED]> > Maybe as part of a change from target macro to target hook, with > LEGITIMATE_CONSTANT_P as a default would fit, even at this > stage? Sorry, I mean CONSTANT_P, not LEGITIMATE_CONSTANT_P. Or maybe a new macro

Re: PR37363: PR36090 and PR36182 all over again

2008-09-05 Thread Hans-Peter Nilsson
> Date: Fri, 05 Sep 2008 14:42:11 +0200 > From: Paolo Bonzini <[EMAIL PROTECTED]> > We can do it incrementally. For now, only redefine > LEGITIMATE_CONSTANT_P on CRIS and in the documentation, and use it in > simplify_plus_minus. For 4.5, we can look at other places using > gen_rtx_CONST and str

Re: PR37363: PR36090 and PR36182 all over again

2008-09-05 Thread Paolo Bonzini
>> 3) adding a check that the MINUS is a legitimate address, and only wrap >> it in CONST if it is. > > s/address/constant/; it's not clear that it's used as an address > at that point; it's just two expressions that gcc tries to > reduce. Right. > But I get the point; I'm leaning towards somet

Re: PR37363: PR36090 and PR36182 all over again (was: Re: Call for testers, ppc64-linux)

2008-09-05 Thread David Edelsohn
On Fri, Sep 5, 2008 at 7:25 AM, Hans-Peter Nilsson <[EMAIL PROTECTED]> wrote: >> Date: Fri, 05 Sep 2008 12:55:17 +0200 >> From: Paolo Bonzini <[EMAIL PROTECTED]> > Nope, not if it's a (MINUS (symbol_ref sym2) (symbol_ref sym1)). > *If* valid, that's a constant expression and *should* be wrapped >

Re: PR37363: PR36090 and PR36182 all over again (was: Re: Call for testers, ppc64-linux)

2008-09-05 Thread Hans-Peter Nilsson
> Date: Fri, 05 Sep 2008 12:55:17 +0200 > From: Paolo Bonzini <[EMAIL PROTECTED]> > > I got negative feedback on that patch (no, not regression > > results :) on IRC from David Edelsohn and understandably you > > held off your testing because of this, as for one the patch > > affects the rs6000 ba

Re: PR37363: PR36090 and PR36182 all over again (was: Re: Call for testers, ppc64-linux)

2008-09-05 Thread Paolo Bonzini
> I got negative feedback on that patch (no, not regression > results :) on IRC from David Edelsohn and understandably you > held off your testing because of this, as for one the patch > affects the rs6000 backend. What kind of negative feedback? > For CRIS (as well as other targets IIUC) the ca