Re: clobber

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

 



Florent Defay <spira.inhabitant@xxxxxxxxx> writes:

> Here is a pattern used for shifting left. The function
> target_emit_shift directly outputs asm instructions.
> In this insn, operand 2 is used as a counter down to 0. Then after
> this insn operand 2's value is zero. So operand 2 is clobbered.
> That's why I use "clobber".
>
> (define_insn "*ashlsi3_2"
>   [(parallel [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m")
>                    (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0,0")
>                               (match_operand:HI 2 "register_operand" "r,r")))
>               (clobber (match_dup 2))])]
>   ""
>   {
>     return target_emit_shift(ASHLSI, operands);
>   })
>
> But it has no effect on GCC and operand 2 is used later just as if it
> was not clobbered. I think I do not use "clobber" properly.
> I did not find another way to do this. Please, could you tell me how
> to use "clobber" properly in this situation?

You shouldn't use clobber with match_dup because, as you have
discovered, it doesn't work.  Use clobber with other operands.

For this, I think it should work to use the + constraint to tell gcc
that the operand is both read and written.

Ian

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

  Powered by Linux