2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. index:: define_insn example
10 Example of define_insn
11 **********************
13 Here is an example of an instruction pattern, taken from the machine
14 description for the 68000/68020.
20 (match_operand:SI 0 "general_operand" "rm"))]
24 if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
26 return \"cmpl #0,%0\";
29 This can also be written using braced strings:
35 (match_operand:SI 0 "general_operand" "rm"))]
38 if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
43 This describes an instruction which sets the condition codes based on the
44 value of a general operand. It has no condition, so any insn with an RTL
45 description of the form shown may be matched to this pattern. The name
46 :samp:`tstsi` means 'test a ``SImode`` value' and tells the RTL
47 generation pass that, when it is necessary to test such a value, an insn
48 to do so can be constructed using this pattern.
50 The output control string is a piece of C code which chooses which
51 output template to return based on the kind of operand and the specific
52 type of CPU for which code is being generated.
54 :samp:`"rm"` is an operand constraint. Its meaning is explained below.