On 10/10/14 11:04, Jakub Jelinek wrote:
On Fri, Oct 10, 2014 at 11:00:54AM -0600, Jeff Law wrote:
  But it's really a lot more like a
kind of PLUS.  If instead we had a LOW to match HIGH it would have been
Right.  In fact, I believe at the hardware level it's typically implemented
as addition.

Can be addition or bitwise or, as high should have some low bits zero, both
usually work the same.
It can be bitwise-or on some architectures, but I believe it's typically implemented as addition. There's also typically an overlap between the high and low parts when building up addresses. GCC actually takes advantage of that overlap to reduce unnecessary HIGH expressions.


And you can always have an oddball architecture like the PA where the LO_SUM does something utterly braindead. It looks like this

addil %r27,<symbolic nonsense>

You might think %r27 holds the high bits of the address... Umm, no it doesn't. There's an implicit %r1 source/destination operand (which holds the high bits). So what this really does is add %r27, %r1 and the symbolic constant. %r27 is a data pointer. Obviously the implicit operand is used get more bits holding the symbolic constant in the instruction.

If that's not bad enough, if the object is in readonly memory, then the linker will modify the instruction to change %r27 to %r0 (hardwired 0 constant). But I'm getting offtopic here :-)

jeff

Reply via email to