1 ============================
2 AMDGPU Instructions Notation
3 ============================
8 .. _amdgpu_syn_instruction_notation:
13 This is an overview of notation used to describe the syntax of AMDGPU assembler instructions.
15 This notation looks a lot like the :ref:`syntax of assembler instructions<amdgpu_syn_instructions>`,
16 except that instead of real operands and modifiers, it uses references to their descriptions.
24 This is the notation used to describe AMDGPU instructions:
26 | ``<``\ :ref:`opcode description<amdgpu_syn_opcode_notation>`\ ``>
27 <``\ :ref:`operands description<amdgpu_syn_instruction_operands_notation>`\ ``>
28 <``\ :ref:`modifiers description<amdgpu_syn_instruction_modifiers_notation>`\ ``>``
30 .. _amdgpu_syn_opcode_notation:
40 .. _amdgpu_syn_instruction_operands_notation:
45 An instruction may have zero or more *operands*. They are comma-separated in the description:
47 | ``<``\ :ref:`description of operand 0<amdgpu_syn_instruction_operand_notation>`\ ``>,
48 <``\ :ref:`description of operand 1<amdgpu_syn_instruction_operand_notation>`\ ``>, ...``
50 The order of *operands* is fixed. *Operands* cannot be omitted
51 except for special cases described below.
53 .. _amdgpu_syn_instruction_operand_notation:
58 An operand is described using the following notation:
60 *<kind><name><tag0><tag1>...*
64 * *kind* is an optional prefix describing operand :ref:`kind<amdgpu_syn_instruction_operand_kinds>`.
65 * *name* is a link to a description of the operand.
66 * *tags* are optional. They are used to indicate
67 :ref:`special operand properties<amdgpu_syn_instruction_operand_tags>`.
69 .. _amdgpu_syn_instruction_operand_kinds:
74 Operand kind indicates which values are accepted by the operand.
76 * Operands which only accept *vector* registers are labelled with 'v' prefix.
77 * Operands which only accept *scalar* registers and values are labelled with 's' prefix.
78 * Operands which accept any registers and values have no prefix.
84 vdata // operand only accepts vector registers
85 sdst // operand only accepts scalar registers
86 src1 // operand accepts vector registers, scalar registers, and scalar values
88 .. _amdgpu_syn_instruction_operand_tags:
93 Operand tags indicate special operand properties.
95 ============== =================================================================================
97 ============== =================================================================================
98 :opt An optional operand.
99 :m An operand which may be used with operand modifiers
100 :ref:`abs<amdgpu_synid_abs>`, :ref:`neg<amdgpu_synid_neg>` or
101 :ref:`sext<amdgpu_synid_sext>`.
102 :dst An input operand which is also used as a destination
103 if :ref:`glc<amdgpu_synid_glc>` modifier is specified.
104 :fx This is a *f32* or *f16* operand, depending on
105 :ref:`m_op_sel_hi<amdgpu_synid_mad_mix_op_sel_hi>` modifier.
106 :<type> The operand *type* differs from the *type*
107 :ref:`implied by the opcode name<amdgpu_syn_instruction_type>`.
108 This tag specifies the actual operand *type*.
109 ============== =================================================================================
115 src1:m // src1 operand may be used with operand modifiers
116 vdata:dst // vdata operand may be used as both source and destination
117 vdst:u32 // vdst operand has u32 type
119 .. _amdgpu_syn_instruction_modifiers_notation:
124 An instruction may have zero or more optional *modifiers*. They are space-separated in the description:
126 | ``<``\ :ref:`description of modifier 0<amdgpu_syn_instruction_modifier_notation>`\ ``>
127 <``\ :ref:`description of modifier 1<amdgpu_syn_instruction_modifier_notation>`\ ``> ...``
129 The order of *modifiers* is fixed.
131 .. _amdgpu_syn_instruction_modifier_notation:
136 A *modifier* is described using the following notation:
140 Where the *name* is a link to a description of the *modifier*.