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]

[PING] [PATCH, ARM] Improve code-gen for multiple shifted accumulations in array indexing


Ping~

Original posted here:

https://gcc.gnu.org/ml/gcc-patches/2014-06/msg01492.html

Thanks,
Yufeng

On 06/18/14 17:35, Yufeng Zhang wrote:
This time with patch... Apologize.

Yufeng

On 06/18/14 17:31, Yufeng Zhang wrote:
Hi,

This patch improves the code-gen of -marm in the case of two-dimensional
array access.

Given the following code:

typedef struct { int x,y,a,b; } X;

int
f7a(X p[][4], int x, int y)
{
     return p[x][y].a;
}

The code-gen on -O2 -marm -mcpu=cortex-a15 is currently

           mov     r2, r2, asl #4
           add     r1, r2, r1, asl #6
           add     r0, r0, r1
           ldr     r0, [r0, #8]
           bx      lr

With the patch, we'll get:

           add     r1, r0, r1, lsl #6
           add     r2, r1, r2, lsl #4
           ldr     r0, [r2, #8]
           bx      lr

The -mthumb code-gen had been OK.

The patch has passed the bootstrapping on cortex-a15 and the
arm-none-eabi regtest, with no code-gen difference in spec2k
(unfortunately).

OK for the trunk?

Thanks,
Yufeng

gcc/

	* config/arm/arm.c (arm_reassoc_shifts_in_address): New declaration
	and new function.
	(arm_legitimize_address): Call the new functions.
	(thumb_legitimize_address): Prefix the declaration with static.

gcc/testsuite/

	* gcc.target/arm/shifted-add-1.c: New test.
	* gcc.target/arm/shifted-add-2.c: Ditto.




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