Skip to content

Commit d9daee5

Browse files
committed
[AMDGPU][DOC][NFC] Update assembler syntax description
Summary of changes: - Enable register tuples with 9, 10, 11 and 12 registers (https://reviews.llvm.org/D138205). - Small improvements and clarifications. - Correct typos.
1 parent ff302f8 commit d9daee5

4 files changed

+298
-345
lines changed

llvm/docs/AMDGPUInstructionNotation.rst

+23-18
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ AMDGPU Instructions Notation
1010
Introduction
1111
============
1212

13-
This is an overview of notation used to describe syntax of AMDGPU assembler instructions.
13+
This is an overview of notation used to describe the syntax of AMDGPU assembler instructions.
1414

15-
This notation mimics the :ref:`syntax of assembler instructions<amdgpu_syn_instructions>`
16-
except that instead of real operands and modifiers it provides references to their description.
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.
1717

1818
Instructions
1919
============
@@ -23,7 +23,9 @@ Notation
2323

2424
This is the notation used to describe AMDGPU instructions:
2525

26-
``<``\ :ref:`opcode description<amdgpu_syn_opcode_notation>`\ ``> <``\ :ref:`operands description<amdgpu_syn_instruction_operands_notation>`\ ``> <``\ :ref:`modifiers description<amdgpu_syn_instruction_modifiers_notation>`\ ``>``
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>`\ ``>``
2729
2830
.. _amdgpu_syn_opcode_notation:
2931

@@ -42,7 +44,8 @@ Operands
4244

4345
An instruction may have zero or more *operands*. They are comma-separated in the description:
4446

45-
``<``\ :ref:`description of operand 0<amdgpu_syn_instruction_operand_notation>`\ ``>, <``\ :ref:`description of operand 1<amdgpu_syn_instruction_operand_notation>`\ ``>, ...``
47+
| ``<``\ :ref:`description of operand 0<amdgpu_syn_instruction_operand_notation>`\ ``>,
48+
<``\ :ref:`description of operand 1<amdgpu_syn_instruction_operand_notation>`\ ``>, ...``
4649
4750
The order of *operands* is fixed. *Operands* cannot be omitted
4851
except for special cases described below.
@@ -60,7 +63,8 @@ Where:
6063

6164
* *kind* is an optional prefix describing operand :ref:`kind<amdgpu_syn_instruction_operand_kinds>`.
6265
* *name* is a link to a description of the operand.
63-
* *tags* are optional. They are used to indicate :ref:`special operand properties<amdgpu_syn_instruction_operand_tags>`.
66+
* *tags* are optional. They are used to indicate
67+
:ref:`special operand properties<amdgpu_syn_instruction_operand_tags>`.
6468

6569
.. _amdgpu_syn_instruction_operand_kinds:
6670

@@ -70,16 +74,16 @@ Operand Kinds
7074
Operand kind indicates which values are accepted by the operand.
7175

7276
* Operands which only accept *vector* registers are labelled with 'v' prefix.
73-
* Operands which only accept *scalar* values are labelled with 's' prefix.
74-
* Operands which accept both *vector* registers and *scalar* values have no 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.
7579

7680
Examples:
7781

7882
.. parsed-literal::
7983
8084
vdata // operand only accepts vector registers
8185
sdst // operand only accepts scalar registers
82-
src1 // operand accepts both scalar and vector registers
86+
src1 // operand accepts vector registers, scalar registers, and scalar values
8387
8488
.. _amdgpu_syn_instruction_operand_tags:
8589

@@ -92,16 +96,16 @@ Operand tags indicate special operand properties.
9296
Operand tag Meaning
9397
============== =================================================================================
9498
:opt An optional operand.
95-
:m An operand which may be used with
96-
:ref:`VOP3 operand modifiers<amdgpu_synid_vop3_operand_modifiers>` or
97-
:ref:`SDWA operand modifiers<amdgpu_synid_sdwa_operand_modifiers>`.
98-
:dst An input operand which may also serve as a destination
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
99103
if :ref:`glc<amdgpu_synid_glc>` modifier is specified.
100-
:fx This is an *f32* or *f16* operand depending on
104+
:fx This is a *f32* or *f16* operand, depending on
101105
:ref:`m_op_sel_hi<amdgpu_synid_mad_mix_op_sel_hi>` modifier.
102-
:<type> Operand *type* differs from *type*
106+
:<type> The operand *type* differs from the *type*
103107
:ref:`implied by the opcode name<amdgpu_syn_instruction_type>`.
104-
This tag specifies actual operand *type*.
108+
This tag specifies the actual operand *type*.
105109
============== =================================================================================
106110

107111
Examples:
@@ -119,7 +123,8 @@ Modifiers
119123

120124
An instruction may have zero or more optional *modifiers*. They are space-separated in the description:
121125

122-
``<``\ :ref:`description of modifier 0<amdgpu_syn_instruction_modifier_notation>`\ ``> <``\ :ref:`description of modifier 1<amdgpu_syn_instruction_modifier_notation>`\ ``> ...``
126+
| ``<``\ :ref:`description of modifier 0<amdgpu_syn_instruction_modifier_notation>`\ ``>
127+
<``\ :ref:`description of modifier 1<amdgpu_syn_instruction_modifier_notation>`\ ``> ...``
123128
124129
The order of *modifiers* is fixed.
125130

@@ -132,4 +137,4 @@ A *modifier* is described using the following notation:
132137

133138
*<name>*
134139

135-
Where *name* is a link to a description of the *modifier*.
140+
Where the *name* is a link to a description of the *modifier*.

llvm/docs/AMDGPUInstructionSyntax.rst

+18-13
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ Syntax
1515

1616
An instruction has the following syntax:
1717

18-
``<``\ *opcode mnemonic*\ ``> <``\ *operand0*\ ``>, <``\ *operand1*\ ``>,... <``\ *modifier0*\ ``> <``\ *modifier1*\ ``>...``
18+
| ``<``\ *opcode mnemonic*\ ``> <``\ *operand0*\ ``>,
19+
<``\ *operand1*\ ``>,... <``\ *modifier0*\ ``> <``\ *modifier1*\ ``>...``
1920
20-
:doc:`Operands<AMDGPUOperandSyntax>` are normally comma-separated while
21+
:doc:`Operands<AMDGPUOperandSyntax>` are normally comma-separated, while
2122
:doc:`modifiers<AMDGPUModifierSyntax>` are space-separated.
2223

2324
The order of *operands* and *modifiers* is fixed.
@@ -28,7 +29,8 @@ Most *modifiers* are optional and may be omitted.
2829
Opcode Mnemonic
2930
~~~~~~~~~~~~~~~
3031

31-
Opcode mnemonic describes opcode semantics and may include one or more suffices in this order:
32+
Opcode mnemonic describes opcode semantics
33+
and may include one or more suffices in this order:
3234

3335
* :ref:`Packing suffix<amdgpu_syn_instruction_pk>`.
3436
* :ref:`Destination operand type suffix<amdgpu_syn_instruction_type>`.
@@ -81,7 +83,7 @@ The following table enumerates the most frequently used type suffices.
8183
============================================ ======================= ============================
8284

8385
Instructions which have no type suffices are assumed to operate with typeless data.
84-
The size of data is specified by size suffices:
86+
The size of typeless data is specified by size suffices:
8587

8688
================= =================== =====================================
8789
Size Suffix Implied data type Required register size in dwords
@@ -103,8 +105,8 @@ The size of data is specified by size suffices:
103105
================= =================== =====================================
104106

105107
.. WARNING::
106-
There are exceptions from rules described above.
107-
Operands which have type different from type specified by the opcode are
108+
There are exceptions to the rules described above.
109+
Operands which have a type different from the type specified by the opcode are
108110
:ref:`tagged<amdgpu_syn_instruction_operand_tags>` in the description.
109111

110112
Examples of instructions with different types of source and destination operands:
@@ -144,7 +146,9 @@ Encoding Suffices
144146
Most *VOP1*, *VOP2* and *VOPC* instructions have several variants:
145147
they may also be encoded in *VOP3*, *DPP* and *SDWA* formats.
146148

147-
The assembler will automatically use optimal encoding based on instruction operands.
149+
The assembler selects an optimal encoding automatically
150+
based on instruction operands and modifiers,
151+
unless a specific encoding is explicitly requested.
148152
To force specific encoding, one can add a suffix to the opcode of the instruction:
149153

150154
=================================================== =================
@@ -156,25 +160,26 @@ To force specific encoding, one can add a suffix to the opcode of the instructio
156160
*SDWA* encoding _sdwa
157161
=================================================== =================
158162

159-
These suffices are used in this reference to indicate the assumed encoding.
160-
When no suffix is specified, native instruction encoding is implied.
163+
This reference uses encoding suffices to specify which encoding is implied.
164+
When no suffix is specified, native instruction encoding is assumed.
161165

162166
Operands
163167
========
164168

165169
Syntax
166170
~~~~~~
167171

168-
Syntax of generic operands is described :doc:`in this document<AMDGPUOperandSyntax>`.
172+
The syntax of generic operands is described :doc:`in this document<AMDGPUOperandSyntax>`.
169173

170-
For detailed information about operands follow *operand links* in GPU-specific documents.
174+
For detailed information about operands, follow *operand links* in GPU-specific documents.
171175

172176
Modifiers
173177
=========
174178

175179
Syntax
176180
~~~~~~
177181

178-
Syntax of modifiers is described :doc:`in this document<AMDGPUModifierSyntax>`.
182+
The syntax of modifiers is described :doc:`in this document<AMDGPUModifierSyntax>`.
179183

180-
Information about modifiers supported for individual instructions may be found in GPU-specific documents.
184+
Information about modifiers supported for individual instructions
185+
may be found in GPU-specific documents.

0 commit comments

Comments
 (0)