On Sun, May 13, 2012 at 12:01 PM, Richard Guenther <richard.guent...@gmail.com> wrote: > On Sun, May 13, 2012 at 6:32 PM, H.J. Lu <hjl.to...@gmail.com> wrote: >> Hi, >> >> 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. > > Why not? Easily from code like > > long foo (long a, long b) > { > return *((long *)(a + b)); > } >
What is the expect run-time behavior when a + b has overflow/underflow? -- H.J.