Re: pb expanding insn with "use"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


> Aurelien Buhrig <aurelien.buhrig.gcc@xxxxxxxxx> writes:
> 
>> I defined this insn which uses a "temporary" register whose value is
>> used for next rotation by 1:
>>
>> (define_insn "rotrhi3_cst1"
>>   [(set (match_operand:HI 0 "d_operand" "=d")
>>         (rotatert:HI (match_operand:HI 1 "d_operand" "0")
>>                    (const_int 1)))
>>    (use (match_operand:HI 2 "d_operand" "+&d"))]
>>   ""
>>   "rrc.w\t%2\t| \trrc.w\t%0 ; rotr1")
> 
> I don't know what these instructions do, but if the temporary register
> is only used by this insn you should use match_scratch.  If the register
> is used by other subsequent instructions then you need to set it, not
> just use it.
> 
>> So it uses the same register for the use operand %2 and for the operands
>> %0/%1 despite the +& modifers...
> 
> It's a bit confusing, but the +& modifiers are only for register
> allocation.  The CSE pass is before register allocation, and it is only
> looking at what the RTL says.  The RTL says that the register is used
> but not set, so the compiler feels free to feed in the same register.
> 
>> The doc says about use:
>> "use can only be used to describe that the register is live. You
>> should think twice before adding use statements, more often you will
>> want to use unspec instead."
>>
>> Does it mean that it's not possible using "use" and the only way to do
>> this is to create an unspec insn ?
> 
> You can use a "use" statement as long as you know what it means.  The
> comment in the doc is there because what it means is not what most
> people actually want.
> 
> Ian

Ok, it's very clear.

In my case, the %2 reg is used by other subsequent insn, but some bits
in this reg clobber (the MSB for a rotatert in fact), or set wrt the
cc0. I think I need to set it with an unspec.

Thanks for your help !

Aurélien


[Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

Add to Google