diff mbox

[PATCH/AARCH64] Correctly handle stores of zero in fusion_load_store

Message ID CA+=Sn1kKLh+a+XeX18non9Ymk_L1C85O-bOFCDyRZP80fhW6WA@mail.gmail.com
State New
Headers show

Commit Message

Andrew Pinski Jan. 13, 2015, 4:48 a.m. UTC
Hi,
  With stores, we can get (const_int 0) as the src which has a mode of
VOIDmode but this can be a valid store for optimizing into a store
pair.  This patch changes checking for the src mode to checking dest
mode instead which does not have this issue.  I added a testcase which
shows the issue where store pair was not being created before but is
after.

OK?  Build and tested for aarch64-elf with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
* config/aarch64/aarch64.c (fusion_load_store): Check dest mode
instead of src mode.


* gcc.target/aarch64/store-pair-1.c: New testcase.

Comments

Marcus Shawcroft Jan. 13, 2015, 12:29 p.m. UTC | #1
On 13 January 2015 at 04:48, Andrew Pinski <pinskia@gmail.com> wrote:

> ChangeLog:
> * config/aarch64/aarch64.c (fusion_load_store): Check dest mode
> instead of src mode.
>
>
> * gcc.target/aarch64/store-pair-1.c: New testcase.

OK, thanks /Marcus
Christophe Lyon Jan. 14, 2015, 12:08 p.m. UTC | #2
On 13 January 2015 at 13:29, Marcus Shawcroft
<marcus.shawcroft@gmail.com> wrote:
> On 13 January 2015 at 04:48, Andrew Pinski <pinskia@gmail.com> wrote:
>
>> ChangeLog:
>> * config/aarch64/aarch64.c (fusion_load_store): Check dest mode
>> instead of src mode.
>>
>>
>> * gcc.target/aarch64/store-pair-1.c: New testcase.
>
> OK, thanks /Marcus

I fixed the missing /* */ around the dg-final directive, as obvious.

Christophe.
diff mbox

Patch

Index: testsuite/gcc.target/aarch64/store-pair-1.c
===================================================================
--- testsuite/gcc.target/aarch64/store-pair-1.c	(revision 0)
+++ testsuite/gcc.target/aarch64/store-pair-1.c	(revision 0)
@@ -0,0 +1,12 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int f(int *a, int b)
+{
+  a[28] = 0;
+  a[29] = b;
+  a[31] = 0;
+}
+
+/* We should be able to produce store pair for the store of 28/29 store. */
+{ dg-final { scan-assembler "stp\tw\[0-9\]+, w\[0-9\]+" } }
Index: config/aarch64/aarch64.c
===================================================================
--- config/aarch64/aarch64.c	(revision 219508)
+++ config/aarch64/aarch64.c	(working copy)
@@ -10520,8 +10520,8 @@  fusion_load_store (rtx_insn *insn, rtx *
   src = SET_SRC (x);
   dest = SET_DEST (x);
 
-  if (GET_MODE (src) != SImode && GET_MODE (src) != DImode
-      && GET_MODE (src) != SFmode && GET_MODE (src) != DFmode)
+  if (GET_MODE (dest) != SImode && GET_MODE (dest) != DImode
+      && GET_MODE (dest) != SFmode && GET_MODE (dest) != DFmode)
     return SCHED_FUSION_NONE;
 
   if (GET_CODE (src) == SIGN_EXTEND)