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]
Other format: [Raw text]

[RFC PATCH, i386]: Allow SUBREG_PROMOTED_UNSIGNED_P subregs in address


Hello!

Attached RFC patch buids on recent x86 improvements in
ix86_legitimate_address_p/ix86_decompose_address functions. With this
patch, we allow SUBREGs with register_no_elim_operand registers in
base, index and PLUS chains. As the consequence, we can relax the
condition that rejects SUBREGs, wider than word mode due to possible
spill failures with double-word SUBREGs. register_no_elim_operand
together with REG_OK_FOR_BASE/REG_OK_FOR_INDEX predicates guarantee,
that there will be no spills since multi-word registers that satisfy
these predicates can easily be decomposed to satisfy SUBREGs.

Another improvement is introduction of SUBREG_PROMOTED_UNSIGNED_P
predicate in the same area to handle paradoxical SUBREGs. When SUBREG
satisfies this predicate, the compiler guarantees, that excess bits
are zero (see the documentation). This is exaclty what we want in
registers that form the address. In theory, we can allow registers of
any integer mode here, but in practice only DImode subreg of SImode
register is important.

IMO, the first optimization is important on i686, while the second is
important on x32 (lots of paradoxical subregs in addresses due to
Pmode != ptr_mode), but they are also nice to have on x86_64.

Any thoughts?

2011-07-20  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.c (ix86_decompose_address): Also allow promoted
	paradoxical subregs in base and PLUS chains.  Allow only paradoxical
	subregs and subregs of DImode hard registers in subregs of index.
	(ix86_legitimate_address_p): Allow subregs of base and index to span
	more than a word.  Assert that subregs of base and index satisfy
	SUBREG_PROMOTED_UNSIGNED_P or register_no_elim_operand predicates.

Patch was bootstrapped and is currently regression testing on
x86_64-pc-linux-gnu {,-m32}.

Uros.

Attachment: p.diff.txt
Description: Text document


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