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] for PR 17531


Hi,

On Mon, 27 Sep 2004, Richard Henderson wrote:
> On Tue, Sep 28, 2004 at 02:44:33AM +0200, Zdenek Dvorak wrote:
> > is it really necessary to use this tone?  I spent a second thinking and
> > observed that if you were right, the optimization would either not work
> > at all or consistently cause misscompilations on LP64 platforms.  Which
> > it does not.
> 
> My guess is that the extra conversions increase the cost a bit,
> which presumably arranges for us to not choose this variant.
> 
> Which is extra work that might be avoided, as well as actively
> rather than accidentally avoiding generating incorrect code.
> 
> > for (p = &a; p < &a + 200B; p += 2B)
> >   *p = (short) (p - &a);
> > 
> > is perfectly valid.
> 
> Sure, but 
> 
>    *p = (short)((short)p - (short) &a)
> 
> isn't.

Hmm, I do think that "*p = (short) p" is valid.  If it's sensible
to extract just the lower bits of a pointer is another question, but it's 
not forbidden.  Apart from that we are talking about our intermediate 
represenation for which it should not matter that much what is and what 
is not valid in the source language.

So expressing a short use with a wide candidate is necessary IMHO (the 
other way around would no work).

On another point, both of your patches fix a problem I had when
bootstraping head on powerpc64-linux (same problem in callers of
emit_move, in that the tmode was SImode and both arguments were DImode). I
don't know which patch is more correct, either making expand_binop really
deal with mismatching modes, or ensuring that matching modes are used in 
expand_expr_addr_expr, or both.  But one of them is needed ;)


Ciao,
Michael.


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