The <target>.md file has a Lisp-like syntax. To get a feel of the syntax, we take a quick look at a concrete RTL statement in $GCCHOME/gcc/config/mips/mips.md file.
(define_insn "addsi3_internal"
[(set (match_operand:SI 0 "register_operand" "=d,d")
(plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")
(match_operand:SI 2 "arith_operand" "d,Q")))]
"!TARGET_MIPS16"
"@
addu\t%0,%z1,%2
addiu\t%0,%z1,%2"
[(set_attr "type" "arith")
(set_attr "mode" "SI")])
The basic structure of a define_insn in MD is:
(define_insn
KEY (also called NAME)
RTL TEMPLATE
C CONDITION
ASM
OPTIONAL ATTRIBUTES SPECIFICATION
)
Table (1) details the
correspondence between the general structure and the concrete example
above.
There are constructs other than define_insn in the <target>.md file, for instance define_attributes lists target attributes that are used in a define_insn.