[Patch docs 4/5] Update "Output Template/Statement" from md.texi

Richard Sandiford rdsandiford@googlemail.com
Mon Jan 12 22:19:00 GMT 2015


James Greenhalgh <james.greenhalgh@arm.com> writes:
>  If the output control string starts with a @samp{@@}, then it is actually
>  a series of templates, each on a separate line.  (Blank lines and
>  leading spaces and tabs are ignored.)  The templates correspond to the
> -pattern's constraint alternatives (@pxref{Multi-Alternative}).  For example,
> -if a target machine has a two-address add instruction @samp{addr} to add
> -into a register and another @samp{addm} to add a register to memory, you
> -might write this pattern:
> +pattern's constraint alternatives (@pxref{Multi-Alternative}).
> +
> +For example, if a target machine has a two-address add instruction
> +@samp{addreg} to add into a register and another @samp{addmem} to add
> +a register to memory, this pattern could be used to describe the
> +instructions.
>  
>  @smallexample
>  (define_insn "addsi3"
>    [(set (match_operand:SI 0 "general_operand" "=r,m")
>          (plus:SI (match_operand:SI 1 "general_operand" "0,0")
> -                 (match_operand:SI 2 "general_operand" "g,r")))]
> +                 (match_operand:SI 2 "general_operand" "r,r")))]
>    ""
>    "@@
> -   addr %2,%0
> -   addm %2,%0")
> +   addreg %2,%0
> +   addmem %2,%0")
>  @end smallexample

While there, I think we should tighten the predicates to
nonimmediate_operand for operands 0 and 1 and -- given the
new constraints -- register_operand for operand 2.

Thanks,
Richard



More information about the Gcc-patches mailing list