This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, aarch64] Add prefetch support
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Marcus Shawcroft <marcus dot shawcroft at gmail dot com>
- Cc: "Gopalasubramanian, Ganesh" <Ganesh dot Gopalasubramanian at amd dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 10 Jan 2015 18:37:32 -0800
- Subject: Re: [PATCH, aarch64] Add prefetch support
- Authentication-results: sourceware.org; auth=none
- References: <EB4625145972F94C9680D8CADD65161578E9323A at satlexdag04 dot amd dot com> <CAFqB+PzmnX6K203rpMmPJb6kY9aggX9-kkLgBUhkJoPTgWj5zg at mail dot gmail dot com>
On Tue, Nov 11, 2014 at 6:47 AM, Marcus Shawcroft
<marcus.shawcroft@gmail.com> wrote:
> On 30 October 2014 08:54, Gopalasubramanian, Ganesh
> <Ganesh.Gopalasubramanian@amd.com> wrote:
>
>> 2014-10-30 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com>
>
> Check the whitespace in your ChangeLog line.
>
>> * config/arm/types.md (define_attr "type"): Add prefetch.
>
> The existing schedulers use 'load1'. We can of course split that into
> two introducing "prefetch" and update all of the existing schedulers
> to reflect the change. However I suggest we do that as a separate
> activity when someone actually needs the distinction, note this change
> will require updating the schedulers for both ARM and AArch64 backends
> not just those relevant to AArch64. For this prefetch patch I suggest
> we go with the existing "load1".
I will need this change for ThunderX schedule. The Pref instruction
is single issued while load1 can be dual issued.
Thanks,
Andrew
>
> The inline patch has been munged by your mailer, I tried applying the
> patch to my tree but it is full of escape sequences. Can you either
> fix your mailer or submit patches as attachments?
>
>> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
>> index 74b554e..12a3f170 100644
>> --- a/gcc/config/aarch64/aarch64.md
>> +++ b/gcc/config/aarch64/aarch64.md
>> @@ -320,6 +320,38 @@
>> [(set_attr "type" "no_insn")]
>> )
>>
>> +
>> +(define_insn "prefetch"
>> + [(prefetch (match_operand:DI 0 "address_operand" "r")
>> + (match_operand:QI 1 "const_int_operand" "")
>> + (match_operand:QI 2 "const_int_operand" ""))]
>> + ""
>
>> + "*
>> +{
>
> Use {} instead of "*{, then all of the extra quoting in the C below goes away.
>
>> + const char * pftype[2][10]
>> + = { {\"PLDL1STRM\", \"PLDL3KEEP\", \"PLDL2KEEP\", \"PLDL1KEEP\"},
>> + {\"PSTL1STRM\", \"PSTL3KEEP\", \"PSTL2KEEP\", \"PSTL1KEEP\"},
>> + };
>> +
>> + int locality = INTVAL (operands[2]);
>> + char pattern[100];
>> +
>> + gcc_assert (IN_RANGE (locality, 0, 3));
>> +
>> + strcpy (pattern, \"prfm\\t\");
>> + strcat (pattern, (const char*)pftype[INTVAL(operands[1])][locality]);
>> + strcat (pattern, \", %a0\");
>
> Use sprintf() rather that multiple calls to cpy and cat. I suspect
> the cast in front of pftype is superflous?
>
>> +
>> + output_asm_insn (pattern,
>> + operands);
>
> Unnecessary line break.
>
> Cheers
> /Marcus