Movatterモバイル変換


[0]ホーム

URL:


Next:, Previous:, Up:Machine Descriptions   [Contents][Index]


16.3 Example ofdefine_insn

Here is an example of an instruction pattern, taken from the machinedescription for the 68000/68020.

(define_insn "tstsi"  [(set (cc0)        (match_operand:SI 0 "general_operand" "rm"))]  ""  "*{  if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))    return \"tstl %0\";  return \"cmpl #0,%0\";}")

This can also be written using braced strings:

(define_insn "tstsi"  [(set (cc0)        (match_operand:SI 0 "general_operand" "rm"))]  ""{  if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))    return "tstl %0";  return "cmpl #0,%0";})

This describes an instruction which sets the condition codes based on thevalue of a general operand. It has no condition, so any insn with an RTLdescription of the form shown may be matched to this pattern. The name‘tstsi’ means “test aSImode value” and tells the RTLgeneration pass that, when it is necessary to test such a value, an insnto do so can be constructed using this pattern.

The output control string is a piece of C code which chooses whichoutput template to return based on the kind of operand and the specifictype of CPU for which code is being generated.

"rm"’ is an operand constraint. Its meaning is explained below.


[8]ページ先頭

©2009-2026 Movatter.jp