> On Apr 18, 2015, at 8:21 PM, Richard Earnshaw <richard.earns...@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

Reply via email to