- To: gcc-help@xxxxxxxxxxx
- Subject: Re: pb expanding insn with "use"
- From: Aurelien Buhrig <aurelien.buhrig.gcc@xxxxxxxxx>
- Date: Wed, 04 Jan 2012 10:02:03 +0100
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1326272534; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=OXbv36+mdCGl408T84N6 MVa8LJY=; b=TYfqu6FPhf7VudT4JaMRWSCgHV2R5MVV1t52afvgG2Ybf+4dXjpl kGXLnztuFApOvSlDCnDL0aDOWnsCJxZXgN5g+DM7tssBgklpgV9MDF2DLBmpvlEc 0MDY5NS34jSk0Ls0r9SWc+PYh6yecSLzZ0zvMpv8u1OVcb976DDlMUQ=
- In-reply-to: <mcr39bw1s92.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
- User-agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0
> 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]