This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: What does this character mean in DLX's md file?


ZengNan wrote:

> (define_insn ""
>   [(set (match_operand:CCFP 0 "register_operand" "=z")
>         (match_operator:SF 1 "signed_comparison_operator"
>          [(match_operand:SF 2 "register_operand" "f")
>           (match_operand:SF 3 "register_operand" "f")]))]
>   ""
>   "%C1f\\t%2,%3"
>   [(set_attr "type" "fp")
>    (set_attr "mode" "SF")])
> 
> This pattern outputs float compare instruction. "%C" in the output
> template is defined in dlx.c to be one of eq, ne, gt, lt, le and neq.
> DLX's assembly code for float compare has the format of "*f op1, op2",
> where * is to be substituted by eq, ne, gt, ....  I don't know the
> meaning of the numeric character "1" between "%C" and "f" in the output
> template.  

  This is just standard RTL.  Read the gcc internals manual by "info gccint",
and see the chapter "Machine Desc", particularly the bit about the "Output
Template".  The digit selects which one of the rtl operands is used in that
part of the generated assembly, so the 1 means it uses operand 1, which is the
(match_operator:SF 1 ...) rtl.

  Inside gcc's code generation, the operands are stored in the operands[]
array which you will see referred to in the C code of expanders and splitters;
the matched operands of the actual RTL insn that is being matched are loaded
into the corresponding slots in the operands[] array according to the index
numbers (the number after the :SF mode specifier), and then the array is used
in outputting the assembly code, either in C printf statements if a function
is used, or in the %-specifiers if an output template is used.

  So, the output template there wants to use operands[1] to pass to the %C
character which interprets it as a comparison operator and generates the
correct fp compare instruction.  The %2 and %3 are substituted with the
contents of operands[2] and operands[3], which are the registers matched by
the match_operand statements.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]