[PATCH, AArch64] Allow symbol+offset as symbolic constant expression

Ian Bolton ian.bolton@arm.com
Fri Jul 6 15:30:00 GMT 2012


Hi,

This patch reduces codesize for cases such as this one:

 int arr[100];
 int foo () { return arr[10]; }

Before the patch, the code looked like this:

 adrp x0, arr
 add x0, x0, :lo12:arr
 ldr w0, [x0,40]

Now, it looks like this:
 
 adrp x0, arr+40
 ldr w0, [x0,#:lo12:arr+40]

Some workloads have seen up to 1K reduction in code size.

OK to commit?

Cheers,
Ian



2012-07-06  Ian Bolton  <ian.bolton@arm.com>

	* gcc/config/aarch64/aarch64.c (aarch64_print_operand): Use
	aarch64_classify_symbolic_expression for classifying operands.

	* gcc/config/aarch64/aarch64.c
	(aarch64_classify_symbolic_expression): New function.

	* gcc/config/aarch64/aarch64.c (aarch64_symbolic_constant_p):
	New function.

	* gcc/config/aarch64/predicates.md (aarch64_valid_symref):
	Symbol with constant offset is a valid symbol reference.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: symref-offset.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120706/adca01b5/attachment.txt>


More information about the Gcc-patches mailing list