This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [AArch64][PR65139] use clobber with match_scratch for aarch64_lshr_sisd_or_int_<mode>3
- From: Maxim Kuvyrkov <maxim dot kuvyrkov at linaro dot org>
- To: Richard Earnshaw <Richard dot Earnshaw at foss dot arm dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Kugan <kugan dot vivekanandarajah at linaro dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, James Greenhalgh <James dot Greenhalgh at arm dot com>
- Date: Sat, 18 Apr 2015 21:17:19 +0300
- Subject: Re: [AArch64][PR65139] use clobber with match_scratch for aarch64_lshr_sisd_or_int_<mode>3
- Authentication-results: sourceware.org; auth=none
- References: <552D897C dot 2040207 at linaro dot org> <552E571C dot 3000306 at foss dot arm dot com> <20150415123202 dot GW1725 at tucnak dot redhat dot com> <552EE5CC dot 9040703 at linaro dot org> <20150415223248 dot GZ1725 at tucnak dot redhat dot com> <552EED9F dot 3060901 at linaro dot org> <55326514 dot 8080008 at foss dot arm dot com> <20150418151309 dot GY1725 at tucnak dot redhat dot com> <553292B4 dot 6070403 at foss dot arm dot com>
> On Apr 18, 2015, at 8:21 PM, Richard Earnshaw <Richard.Earnshaw@foss.arm.com> wrote:
>
> On 18/04/15 16:13, Jakub Jelinek wrote:
>> On Sat, Apr 18, 2015 at 03:07:16PM +0100, Richard Earnshaw wrote:
>>> You need to ensure that your scratch register cannot overlap op1, since
>>> the scratch is written before op1 is read.
>>
>> - (clobber (match_scratch:QI 3 "=X,w,X"))]
>> + (clobber (match_scratch:QI 3 "=X,&w,X"))]
>>
>> incremental diff should ensure that, right?
>>
>> Jakub
>>
>
>
> Sorry, where in the patch is that hunk?
>
> I see just:
>
> + (clobber (match_scratch:QI 3 "=X,w,X"))]
Jakub's suggestion is an incremental patch on top of Kugan's.
>
> And why would early clobbering the scratch be notably better than the
> original?
>
It will still be better. With this patch we want to allow RA freedom to optimally handle both of the following cases:
1. operand[1] dies after the instruction. In this case we want operand[0] and operand[1] to be assigned to the same reg, and operand[3] to be assigned to a different register to provide a temporary. In this case we don't care whether operand[3] is early-clobber or not. This case is not optimally handled with current insn patterns.
2. operand[1] lives on after the instruction. In this case we want operand[0] and operand[3] to be assigned to the same reg, and not clobber operand[1]. By marking operand[3] early-clobber we ensure that operand[1] is in a different register from what operand[0] and operand[3] were assigned to. This case should be handled equally well before and after the patch.
My understanding is that Kugan's patch with Jakub's fix on top satisfy both of these cases.
--
Maxim Kuvyrkov
www.linaro.org