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]

Re: Adding constants to LO_SUM


kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:

>     the patch http://gcc.gnu.org/ml/gcc-patches/2001-07/msg00166.html
>     essentially make plus_constant_wide transform expressions of the form
>     lo_sum(a,b)+c to lo_sum(a,b+c). I think this is incorrect 
> 
> Yes, that is indeed incorrect, but plus_constant_for_output was added to do
> precisely that in 1990 by Michael Tiemann.
> 
> Does anybody understand what's going on here?  How was this ever correct?

plus_constant_for_output is used in the rs6000 backend to do accesses
of 64-bit values in 32-bit mode (to get to the second word).  I think
it just happens to work here, because on rs6000 64-bit values are
usually 64-bit aligned, so the problematic case won't occur.  All the
other places it is used in generic code, the result is not output.

I would propose putting a big warning message above it, explaining
that using it requires machine-specific information about how LO_SUM
works and about alignment.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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