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]

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


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.

Attachment: symref-offset.txt
Description: Text document


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