pb expanding insn with "use"

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


Hi all,
And happy new year!


I'm trying to optimize rotations for my target by expanding it into
several smaller rotates (let's say by rotate 1).

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")

My problem is that such an expand:

(insn 14 13 15 2 (set (reg:HI 25 [ globHI.1 ])
        (reg:HI 22 [ globHI.1 ])) rotate.c:77 22 {movhi}
     (nil))
(insn 15 14 16 2 (parallel [
            (set (reg:HI 22 [ globHI.1 ])
                (rotatert:HI (reg:HI 22 [ globHI.1 ])
                    (const_int 1 [0x1])))
            (use (reg:HI 25 [ globHI.1 ]))
        ]) rotate.c:77 105 {rotrhi3_cst1}
     (nil))

is transformed during CSE pass into:
(insn 14 13 15 2 (set (reg:HI 25 [ globHI.1 ])
        (reg:HI 22 [ globHI.1 ])) rotate.c:77 22 {movhi}
     (nil))
(insn 15 14 16 2 (parallel [
            (set (reg:HI 22 [ globHI.1 ])
                (rotatert:HI (reg:HI 22 [ globHI.1 ])
                    (const_int 1 [0x1])))
            (use (reg:HI 22 [ globHI.1 ]))
        ]) rotate.c:77 105 {rotrhi3_cst1}
     (nil))

So it uses the same register for the use operand %2 and for the operands
%0/%1 despite the +& modifers...

How can I tell gcc not to use the same register for operands 2 and
operand 0?

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 ?

Thank you by advance,
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