* [PATCH AARCH64]Make ldp/stp case less vulnerable
@ 2014-12-11 10:06 Bin Cheng
2014-12-11 15:16 ` Marcus Shawcroft
0 siblings, 1 reply; 2+ messages in thread
From: Bin Cheng @ 2014-12-11 10:06 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1291 bytes --]
Hi,
Case gcc.target/aarch64/ldp_stp_3.c test fails on aarch64-none-elf.
Instead of merging the loads into ldp it generates:
foo:
adrp x1, .LANCHOR0
add x1, x1, :lo12:.LANCHOR0
ldr w0, [x1, 4]
ldr w3, [x1, 20]
ldr w2, [x1, 32]
ldr w1, [x1, 16]
add x2, x3, x2
add x0, x0, x1
add x0, x2, x0
ret
Once register allocation decides to load [x1, 16] into x1(w1) like below:
14: x0:DI = zero_extend([x1:DI+0x4])
7: x3:DI = zero_extend([x1:DI+0x14])
10: x2:DI = zero_extend([x1:DI+0x20])
17: x1:DI = zero_extend([x1:DI+0x10])
Instructions 14/7/10 are anti-dependent on insn 17, bug sched_fusion orders
ready list (14/7/10) in ascending order of address. As a result insn 10
intervenes between 7 and 17.
This patch fixes this by making cases less vulnerable. One possible fix is
to move sched_fusion after regrename, it does help a lot. I didn't do that
because regrenamre is currently disabled.
Tested on aarch64-elf. Is it OK?
Thanks,
bin
gcc/testsuite/ChangeLog
2014-12-11 Bin Cheng <bin.cheng@arm.com>
* gcc.target/aarch64/ldp_stp_2.c: Make test less vulnerable.
* gcc.target/aarch64/ldp_stp_3.c: Ditto.
[-- Attachment #2: ldp-stp-tests.txt --]
[-- Type: text/plain, Size: 866 bytes --]
Index: gcc/testsuite/gcc.target/aarch64/ldp_stp_2.c
===================================================================
--- gcc/testsuite/gcc.target/aarch64/ldp_stp_2.c (revision 218558)
+++ gcc/testsuite/gcc.target/aarch64/ldp_stp_2.c (working copy)
@@ -7,10 +7,8 @@ long long
foo ()
{
long long ll = 0;
- ll += arr[0][1];
ll += arr[1][0];
ll += arr[1][1];
- ll += arr[2][0];
return ll;
}
Index: gcc/testsuite/gcc.target/aarch64/ldp_stp_3.c
===================================================================
--- gcc/testsuite/gcc.target/aarch64/ldp_stp_3.c (revision 218558)
+++ gcc/testsuite/gcc.target/aarch64/ldp_stp_3.c (working copy)
@@ -7,10 +7,8 @@ unsigned long long
foo ()
{
unsigned long long ll = 0;
- ll += arr[0][1];
ll += arr[1][0];
ll += arr[1][1];
- ll += arr[2][0];
return ll;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH AARCH64]Make ldp/stp case less vulnerable
2014-12-11 10:06 [PATCH AARCH64]Make ldp/stp case less vulnerable Bin Cheng
@ 2014-12-11 15:16 ` Marcus Shawcroft
0 siblings, 0 replies; 2+ messages in thread
From: Marcus Shawcroft @ 2014-12-11 15:16 UTC (permalink / raw)
To: Bin Cheng; +Cc: gcc-patches
On 11 December 2014 at 10:06, Bin Cheng <bin.cheng@arm.com> wrote:
> gcc/testsuite/ChangeLog
> 2014-12-11 Bin Cheng <bin.cheng@arm.com>
>
> * gcc.target/aarch64/ldp_stp_2.c: Make test less vulnerable.
> * gcc.target/aarch64/ldp_stp_3.c: Ditto.
OK /Marcus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-11 15:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-11 10:06 [PATCH AARCH64]Make ldp/stp case less vulnerable Bin Cheng
2014-12-11 15:16 ` Marcus Shawcroft
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).