match_dup as internal operands

Ian Lance Taylor iant@google.com
Wed Dec 21 00:02:00 GMT 2011


srimeruva@cse.iitb.ac.in writes:

> what is the advantage of using match_dup for internal operands as
>
> (define_expand "zero_extendhisi2"
>  [(set (match_operand:SI 0 "register_operand" "")
>  (and:SI (subreg:SI
>  (match_operand:HI 1 "register_operand" "")
>  0)
>  (match_dup 2)))]
>  ""
>  "operands[2]
>     = force_reg (SImode, GEN_INT (65535)); ")

This would normally be used for a named pattern which does not expect
operand[2] to be filled in.  Since there is no operand[2], using a
match_operand does not make sense.  But since operand[2] needs to be
referenced in the generated pattern, it has to appear somehow.
match_dup is a reasonable compromise, because match_dup always matches.

Ian



More information about the Gcc-help mailing list