clobber

Florent Defay spira.inhabitant@gmail.com
Fri Jul 24 12:24:00 GMT 2009


Hello,

I am working on a new port. I have a problem with "clobber".

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?

Regards.

Florent



More information about the Gcc-help mailing list