http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50797
Bug #: 50797 Summary: [x32] Use 32bit Pmode Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: hjl.to...@gmail.com CC: sergos....@gmail.com Since x86-64 supports 0x67 address-size prefix, we can use 32bit Pmode. It will avoid unnecessary LEA instructions in memory operand. 1. For memory operand (base, index, scale), we can generate 32bit base/index registers directly. 2. For memory operand (base), we can generate 64bit base register to avoid 0x67 prefix since x32 is limited to 32bit address space and the upper 32bits are always zero. However, since call/pop/push instructions only work on 64bit stack pointer, they have to be handled properly.