This is the mail archive of the
mailing list for the GCC project.
Will backend ever see an memory operand with address wrap around?
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: GCC Development <gcc at gcc dot gnu dot org>
- Date: Sun, 13 May 2012 09:32:47 -0700
- Subject: Will backend ever see an memory operand with address wrap around?
I am trying to optimize memory address for x32. X32 runs in 64-bit mode.
64-bit address is base + index * scale + offset:
1. Base is 64bit.
2. Index is 64bit.
3. Offset is 8bit or 32bit
0x67 address size prefix is used to zero-extend 32bit address to 64bit:
1. Upper 32bits of base or index can be none-zero.
2. Index can be negative.
We can avoid 0x67 prefix if
1. There is no index
2. Upper 32bits of base is zero:
a. When base is set via 32bit load op, the upper 32bits are
atomically zero-extended from the lower 32bits
3. Base + offset is a valid 32-bit address.
Will x86 backend ever see a memory address with wrap around.
That is to use 0xffffffff + 0x30 to represent 0x2f.