2018-12-18 01:38:11 +08:00
|
|
|
=====================================
|
|
|
|
Syntax of AMDGPU Instruction Operands
|
|
|
|
=====================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
|
|
|
.. contents::
|
|
|
|
:local:
|
|
|
|
|
|
|
|
Conventions
|
|
|
|
===========
|
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
The following notation is used throughout this document:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
=================== =============================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
Notation Description
|
2018-12-18 01:38:11 +08:00
|
|
|
=================== =============================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
{0..N} Any integer value in the range from 0 to N (inclusive).
|
2018-12-18 01:38:11 +08:00
|
|
|
<x> Syntax and meaning of *x* is explained elsewhere.
|
|
|
|
=================== =============================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
|
|
|
.. _amdgpu_syn_operands:
|
|
|
|
|
|
|
|
Operands
|
|
|
|
========
|
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_v:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
v
|
|
|
|
-
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Vector registers. There are 256 32-bit vector registers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A sequence of *vector* registers may be used to operate with more than 32 bits of data.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Assembler currently supports sequences of 1, 2, 3, 4, 8 and 16 *vector* registers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
=================================================== ====================================================================
|
|
|
|
Syntax Description
|
|
|
|
=================================================== ====================================================================
|
|
|
|
**v**\<N> A single 32-bit *vector* register.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
*N* must be a decimal integer number.
|
|
|
|
**v[**\ <N>\ **]** A single 32-bit *vector* register.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
*N* may be specified as an
|
|
|
|
:ref:`integer number<amdgpu_synid_integer_number>`
|
|
|
|
or an :ref:`absolute expression<amdgpu_synid_absolute_expression>`.
|
|
|
|
**v[**\ <N>:<K>\ **]** A sequence of (\ *K-N+1*\ ) *vector* registers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
*N* and *K* may be specified as
|
|
|
|
:ref:`integer numbers<amdgpu_synid_integer_number>`
|
|
|
|
or :ref:`absolute expressions<amdgpu_synid_absolute_expression>`.
|
|
|
|
**[v**\ <N>, \ **v**\ <N+1>, ... **v**\ <K>\ **]** A sequence of (\ *K-N+1*\ ) *vector* registers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Register indices must be specified as decimal integer numbers.
|
|
|
|
=================================================== ====================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Note. *N* and *K* must satisfy the following conditions:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
* *N* <= *K*.
|
|
|
|
* 0 <= *N* <= 255.
|
|
|
|
* 0 <= *K* <= 255.
|
|
|
|
* *K-N+1* must be equal to 1, 2, 3, 4, 8 or 16.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
v255
|
|
|
|
v[0]
|
|
|
|
v[0:1]
|
|
|
|
v[1:1]
|
|
|
|
v[0:3]
|
|
|
|
v[2*2]
|
|
|
|
v[1-1:2-1]
|
|
|
|
[v252]
|
|
|
|
[v252,v253,v254,v255]
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
.. _amdgpu_synid_nsa:
|
|
|
|
|
|
|
|
*Image* instructions may use special *NSA* (Non-Sequential Address) syntax for *image addresses*:
|
|
|
|
|
|
|
|
=================================================== ====================================================================
|
|
|
|
Syntax Description
|
|
|
|
=================================================== ====================================================================
|
|
|
|
**[v**\ <A>, \ **v**\ <B>, ... **v**\ <X>\ **]** A sequence of *vector* registers. At least one register
|
|
|
|
must be specified.
|
|
|
|
|
|
|
|
In contrast with standard syntax described above, registers in
|
|
|
|
this sequence are not required to have consecutive indices.
|
|
|
|
Moreover, the same register may appear in the list more than once.
|
|
|
|
=================================================== ====================================================================
|
|
|
|
|
|
|
|
Note. Reqister indices must be in the range 0..255. They must be specified as decimal integer numbers.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
.. parsed-literal::
|
|
|
|
|
|
|
|
[v32,v1,v2]
|
|
|
|
[v4,v4,v4,v4]
|
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_s:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
s
|
|
|
|
-
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Scalar 32-bit registers. The number of available *scalar* registers depends on GPU:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
======= ============================
|
|
|
|
GPU Number of *scalar* registers
|
|
|
|
======= ============================
|
|
|
|
GFX7 104
|
|
|
|
GFX8 102
|
|
|
|
GFX9 102
|
2019-07-09 00:50:11 +08:00
|
|
|
GFX10 106
|
2018-12-18 01:38:11 +08:00
|
|
|
======= ============================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A sequence of *scalar* registers may be used to operate with more than 32 bits of data.
|
|
|
|
Assembler currently supports sequences of 1, 2, 4, 8 and 16 *scalar* registers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Pairs of *scalar* registers must be even-aligned (the first register must be even).
|
|
|
|
Sequences of 4 and more *scalar* registers must be quad-aligned.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
======================================================== ====================================================================
|
|
|
|
Syntax Description
|
|
|
|
======================================================== ====================================================================
|
|
|
|
**s**\ <N> A single 32-bit *scalar* register.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
*N* must be a decimal integer number.
|
|
|
|
**s[**\ <N>\ **]** A single 32-bit *scalar* register.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
*N* may be specified as an
|
|
|
|
:ref:`integer number<amdgpu_synid_integer_number>`
|
|
|
|
or an :ref:`absolute expression<amdgpu_synid_absolute_expression>`.
|
|
|
|
**s[**\ <N>:<K>\ **]** A sequence of (\ *K-N+1*\ ) *scalar* registers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
*N* and *K* may be specified as
|
|
|
|
:ref:`integer numbers<amdgpu_synid_integer_number>`
|
|
|
|
or :ref:`absolute expressions<amdgpu_synid_absolute_expression>`.
|
|
|
|
**[s**\ <N>, \ **s**\ <N+1>, ... **s**\ <K>\ **]** A sequence of (\ *K-N+1*\ ) *scalar* registers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Register indices must be specified as decimal integer numbers.
|
|
|
|
======================================================== ====================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Note. *N* and *K* must satisfy the following conditions:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
* *N* must be properly aligned based on sequence size.
|
|
|
|
* *N* <= *K*.
|
|
|
|
* 0 <= *N* < *SMAX*\ , where *SMAX* is the number of available *scalar* registers.
|
|
|
|
* 0 <= *K* < *SMAX*\ , where *SMAX* is the number of available *scalar* registers.
|
|
|
|
* *K-N+1* must be equal to 1, 2, 4, 8 or 16.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
s0
|
|
|
|
s[0]
|
|
|
|
s[0:1]
|
|
|
|
s[1:1]
|
|
|
|
s[0:3]
|
|
|
|
s[2*2]
|
|
|
|
s[1-1:2-1]
|
|
|
|
[s4]
|
|
|
|
[s4,s5,s6,s7]
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples of *scalar* registers with an invalid alignment:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
s[1:2]
|
|
|
|
s[2:5]
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_trap:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
trap
|
|
|
|
----
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A set of trap handler registers:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
* :ref:`ttmp<amdgpu_synid_ttmp>`
|
|
|
|
* :ref:`tba<amdgpu_synid_tba>`
|
|
|
|
* :ref:`tma<amdgpu_synid_tma>`
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_ttmp:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
ttmp
|
|
|
|
----
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Trap handler temporary scalar registers, 32-bits wide.
|
|
|
|
The number of available *ttmp* registers depends on GPU:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
======= ===========================
|
|
|
|
GPU Number of *ttmp* registers
|
|
|
|
======= ===========================
|
|
|
|
GFX7 12
|
|
|
|
GFX8 12
|
|
|
|
GFX9 16
|
2019-07-09 00:50:11 +08:00
|
|
|
GFX10 16
|
2018-12-18 01:38:11 +08:00
|
|
|
======= ===========================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A sequence of *ttmp* registers may be used to operate with more than 32 bits of data.
|
|
|
|
Assembler currently supports sequences of 1, 2, 4, 8 and 16 *ttmp* registers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Pairs of *ttmp* registers must be even-aligned (the first register must be even).
|
|
|
|
Sequences of 4 and more *ttmp* registers must be quad-aligned.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
============================================================= ====================================================================
|
|
|
|
Syntax Description
|
|
|
|
============================================================= ====================================================================
|
|
|
|
**ttmp**\ <N> A single 32-bit *ttmp* register.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
*N* must be a decimal integer number.
|
|
|
|
**ttmp[**\ <N>\ **]** A single 32-bit *ttmp* register.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
*N* may be specified as an
|
|
|
|
:ref:`integer number<amdgpu_synid_integer_number>`
|
|
|
|
or an :ref:`absolute expression<amdgpu_synid_absolute_expression>`.
|
|
|
|
**ttmp[**\ <N>:<K>\ **]** A sequence of (\ *K-N+1*\ ) *ttmp* registers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
*N* and *K* may be specified as
|
|
|
|
:ref:`integer numbers<amdgpu_synid_integer_number>`
|
|
|
|
or :ref:`absolute expressions<amdgpu_synid_absolute_expression>`.
|
|
|
|
**[ttmp**\ <N>, \ **ttmp**\ <N+1>, ... **ttmp**\ <K>\ **]** A sequence of (\ *K-N+1*\ ) *ttmp* registers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Register indices must be specified as decimal integer numbers.
|
|
|
|
============================================================= ====================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Note. *N* and *K* must satisfy the following conditions:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
* *N* must be properly aligned based on sequence size.
|
|
|
|
* *N* <= *K*.
|
|
|
|
* 0 <= *N* < *TMAX*, where *TMAX* is the number of available *ttmp* registers.
|
|
|
|
* 0 <= *K* < *TMAX*, where *TMAX* is the number of available *ttmp* registers.
|
|
|
|
* *K-N+1* must be equal to 1, 2, 4, 8 or 16.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
ttmp0
|
|
|
|
ttmp[0]
|
|
|
|
ttmp[0:1]
|
|
|
|
ttmp[1:1]
|
|
|
|
ttmp[0:3]
|
|
|
|
ttmp[2*2]
|
|
|
|
ttmp[1-1:2-1]
|
|
|
|
[ttmp4]
|
|
|
|
[ttmp4,ttmp5,ttmp6,ttmp7]
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples of *ttmp* registers with an invalid alignment:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
ttmp[1:2]
|
|
|
|
ttmp[2:5]
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_tba:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
tba
|
|
|
|
---
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Trap base address, 64-bits wide. Holds the pointer to the current trap handler program.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
================== ======================================================================= =============
|
|
|
|
Syntax Description Availability
|
|
|
|
================== ======================================================================= =============
|
|
|
|
tba 64-bit *trap base address* register. GFX7, GFX8
|
|
|
|
[tba] 64-bit *trap base address* register (an alternative syntax). GFX7, GFX8
|
|
|
|
[tba_lo,tba_hi] 64-bit *trap base address* register (an alternative syntax). GFX7, GFX8
|
|
|
|
================== ======================================================================= =============
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
High and low 32 bits of *trap base address* may be accessed as separate registers:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
================== ======================================================================= =============
|
|
|
|
Syntax Description Availability
|
|
|
|
================== ======================================================================= =============
|
|
|
|
tba_lo Low 32 bits of *trap base address* register. GFX7, GFX8
|
|
|
|
tba_hi High 32 bits of *trap base address* register. GFX7, GFX8
|
|
|
|
[tba_lo] Low 32 bits of *trap base address* register (an alternative syntax). GFX7, GFX8
|
|
|
|
[tba_hi] High 32 bits of *trap base address* register (an alternative syntax). GFX7, GFX8
|
|
|
|
================== ======================================================================= =============
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
Note that *tba*, *tba_lo* and *tba_hi* are not accessible as assembler registers in GFX9 and GFX10,
|
2018-12-18 01:38:11 +08:00
|
|
|
but *tba* is readable/writable with the help of *s_get_reg* and *s_set_reg* instructions.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_tma:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
tma
|
|
|
|
---
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Trap memory address, 64-bits wide.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
================= ======================================================================= ==================
|
|
|
|
Syntax Description Availability
|
|
|
|
================= ======================================================================= ==================
|
|
|
|
tma 64-bit *trap memory address* register. GFX7, GFX8
|
|
|
|
[tma] 64-bit *trap memory address* register (an alternative syntax). GFX7, GFX8
|
|
|
|
[tma_lo,tma_hi] 64-bit *trap memory address* register (an alternative syntax). GFX7, GFX8
|
|
|
|
================= ======================================================================= ==================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
High and low 32 bits of *trap memory address* may be accessed as separate registers:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
================= ======================================================================= ==================
|
|
|
|
Syntax Description Availability
|
|
|
|
================= ======================================================================= ==================
|
|
|
|
tma_lo Low 32 bits of *trap memory address* register. GFX7, GFX8
|
|
|
|
tma_hi High 32 bits of *trap memory address* register. GFX7, GFX8
|
|
|
|
[tma_lo] Low 32 bits of *trap memory address* register (an alternative syntax). GFX7, GFX8
|
|
|
|
[tma_hi] High 32 bits of *trap memory address* register (an alternative syntax). GFX7, GFX8
|
|
|
|
================= ======================================================================= ==================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
Note that *tma*, *tma_lo* and *tma_hi* are not accessible as assembler registers in GFX9 and GFX10,
|
2018-12-18 01:38:11 +08:00
|
|
|
but *tma* is readable/writable with the help of *s_get_reg* and *s_set_reg* instructions.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_flat_scratch:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
flat_scratch
|
|
|
|
------------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Flat scratch address, 64-bits wide. Holds the base address of scratch memory.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
================================== ================================================================
|
|
|
|
Syntax Description
|
|
|
|
================================== ================================================================
|
|
|
|
flat_scratch 64-bit *flat scratch* address register.
|
|
|
|
[flat_scratch] 64-bit *flat scratch* address register (an alternative syntax).
|
|
|
|
[flat_scratch_lo,flat_scratch_hi] 64-bit *flat scratch* address register (an alternative syntax).
|
|
|
|
================================== ================================================================
|
|
|
|
|
|
|
|
High and low 32 bits of *flat scratch* address may be accessed as separate registers:
|
|
|
|
|
|
|
|
========================= =========================================================================
|
|
|
|
Syntax Description
|
|
|
|
========================= =========================================================================
|
|
|
|
flat_scratch_lo Low 32 bits of *flat scratch* address register.
|
|
|
|
flat_scratch_hi High 32 bits of *flat scratch* address register.
|
|
|
|
[flat_scratch_lo] Low 32 bits of *flat scratch* address register (an alternative syntax).
|
|
|
|
[flat_scratch_hi] High 32 bits of *flat scratch* address register (an alternative syntax).
|
|
|
|
========================= =========================================================================
|
|
|
|
|
|
|
|
.. _amdgpu_synid_xnack:
|
|
|
|
|
|
|
|
xnack
|
|
|
|
-----
|
|
|
|
|
|
|
|
Xnack mask, 64-bits wide. Holds a 64-bit mask of which threads
|
|
|
|
received an *XNACK* due to a vector memory operation.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
.. WARNING:: GFX7 does not support *xnack* feature. For availability of this feature in other GPUs, refer :ref:`this table<amdgpu-processors>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
\
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
============================== =====================================================
|
|
|
|
Syntax Description
|
|
|
|
============================== =====================================================
|
|
|
|
xnack_mask 64-bit *xnack mask* register.
|
|
|
|
[xnack_mask] 64-bit *xnack mask* register (an alternative syntax).
|
|
|
|
[xnack_mask_lo,xnack_mask_hi] 64-bit *xnack mask* register (an alternative syntax).
|
|
|
|
============================== =====================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
High and low 32 bits of *xnack mask* may be accessed as separate registers:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
===================== ==============================================================
|
|
|
|
Syntax Description
|
|
|
|
===================== ==============================================================
|
|
|
|
xnack_mask_lo Low 32 bits of *xnack mask* register.
|
|
|
|
xnack_mask_hi High 32 bits of *xnack mask* register.
|
|
|
|
[xnack_mask_lo] Low 32 bits of *xnack mask* register (an alternative syntax).
|
|
|
|
[xnack_mask_hi] High 32 bits of *xnack mask* register (an alternative syntax).
|
|
|
|
===================== ==============================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_vcc:
|
2019-07-09 00:50:11 +08:00
|
|
|
.. _amdgpu_synid_vcc_lo:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
vcc
|
|
|
|
---
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Vector condition code, 64-bits wide. A bit mask with one bit per thread;
|
|
|
|
it holds the result of a vector compare operation.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
Note that GFX10 H/W does not use high 32 bits of *vcc* in *wave32* mode.
|
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
================ =========================================================================
|
|
|
|
Syntax Description
|
|
|
|
================ =========================================================================
|
|
|
|
vcc 64-bit *vector condition code* register.
|
|
|
|
[vcc] 64-bit *vector condition code* register (an alternative syntax).
|
|
|
|
[vcc_lo,vcc_hi] 64-bit *vector condition code* register (an alternative syntax).
|
|
|
|
================ =========================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
High and low 32 bits of *vector condition code* may be accessed as separate registers:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
================ =========================================================================
|
|
|
|
Syntax Description
|
|
|
|
================ =========================================================================
|
|
|
|
vcc_lo Low 32 bits of *vector condition code* register.
|
|
|
|
vcc_hi High 32 bits of *vector condition code* register.
|
|
|
|
[vcc_lo] Low 32 bits of *vector condition code* register (an alternative syntax).
|
|
|
|
[vcc_hi] High 32 bits of *vector condition code* register (an alternative syntax).
|
|
|
|
================ =========================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_m0:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
m0
|
|
|
|
--
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A 32-bit memory register. It has various uses,
|
|
|
|
including register indexing and bounds checking.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
=========== ===================================================
|
|
|
|
Syntax Description
|
|
|
|
=========== ===================================================
|
|
|
|
m0 A 32-bit *memory* register.
|
|
|
|
[m0] A 32-bit *memory* register (an alternative syntax).
|
|
|
|
=========== ===================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_exec:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
exec
|
|
|
|
----
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Execute mask, 64-bits wide. A bit mask with one bit per thread,
|
|
|
|
which is applied to vector instructions and controls which threads execute
|
|
|
|
and which ignore the instruction.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
Note that GFX10 H/W does not use high 32 bits of *exec* in *wave32* mode.
|
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
===================== =================================================================
|
|
|
|
Syntax Description
|
|
|
|
===================== =================================================================
|
|
|
|
exec 64-bit *execute mask* register.
|
|
|
|
[exec] 64-bit *execute mask* register (an alternative syntax).
|
|
|
|
[exec_lo,exec_hi] 64-bit *execute mask* register (an alternative syntax).
|
|
|
|
===================== =================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
High and low 32 bits of *execute mask* may be accessed as separate registers:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
===================== =================================================================
|
|
|
|
Syntax Description
|
|
|
|
===================== =================================================================
|
|
|
|
exec_lo Low 32 bits of *execute mask* register.
|
|
|
|
exec_hi High 32 bits of *execute mask* register.
|
|
|
|
[exec_lo] Low 32 bits of *execute mask* register (an alternative syntax).
|
|
|
|
[exec_hi] High 32 bits of *execute mask* register (an alternative syntax).
|
|
|
|
===================== =================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_vccz:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
vccz
|
|
|
|
----
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
A single bit flag indicating that the :ref:`vcc<amdgpu_synid_vcc>` is all zeros.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
Note. When GFX10 operates in *wave32* mode, this register reflects state of :ref:`vcc_lo<amdgpu_synid_vcc_lo>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_execz:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
execz
|
|
|
|
-----
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A single bit flag indicating that the :ref:`exec<amdgpu_synid_exec>` is all zeros.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
Note. When GFX10 operates in *wave32* mode, this register reflects state of :ref:`exec_lo<amdgpu_synid_exec>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_scc:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
scc
|
|
|
|
---
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A single bit flag indicating the result of a scalar compare operation.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
.. _amdgpu_synid_lds_direct:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
lds_direct
|
|
|
|
----------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A special operand which supplies a 32-bit value
|
|
|
|
fetched from *LDS* memory using :ref:`m0<amdgpu_synid_m0>` as an address.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
.. _amdgpu_synid_null:
|
|
|
|
|
|
|
|
null
|
|
|
|
----
|
|
|
|
|
|
|
|
This is a special operand which may be used as a source or a destination.
|
|
|
|
|
|
|
|
When used as a destination, the result of the operation is discarded.
|
|
|
|
|
|
|
|
When used as a source, it supplies zero value.
|
|
|
|
|
|
|
|
GFX10 only.
|
|
|
|
|
|
|
|
.. WARNING:: Due to a H/W bug, this operand cannot be used with VALU instructions in first generation of GFX10.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_constant:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
constant
|
|
|
|
--------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
A set of integer and floating-point *inline* constants and values:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
* :ref:`iconst<amdgpu_synid_iconst>`
|
|
|
|
* :ref:`fconst<amdgpu_synid_fconst>`
|
2019-07-09 00:50:11 +08:00
|
|
|
* :ref:`ival<amdgpu_synid_ival>`
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
In contrast with :ref:`literals<amdgpu_synid_literal>`, these operands are encoded as a part of instruction.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
If a number may be encoded as either
|
|
|
|
a :ref:`literal<amdgpu_synid_literal>` or
|
2019-07-09 00:50:11 +08:00
|
|
|
a :ref:`constant<amdgpu_synid_constant>`,
|
2018-12-18 01:38:11 +08:00
|
|
|
assembler selects the latter encoding as more efficient.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_iconst:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
iconst
|
2019-07-09 00:50:11 +08:00
|
|
|
~~~~~~
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
An :ref:`integer number<amdgpu_synid_integer_number>`
|
|
|
|
encoded as an *inline constant*.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Only a small fraction of integer numbers may be encoded as *inline constants*.
|
|
|
|
They are enumerated in the table below.
|
|
|
|
Other integer numbers have to be encoded as :ref:`literals<amdgpu_synid_literal>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Integer *inline constants* are converted to
|
|
|
|
:ref:`expected operand type<amdgpu_syn_instruction_type>`
|
|
|
|
as described :ref:`here<amdgpu_synid_int_const_conv>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
================================== ====================================
|
|
|
|
Value Note
|
|
|
|
================================== ====================================
|
|
|
|
{0..64} Positive integer inline constants.
|
|
|
|
{-16..-1} Negative integer inline constants.
|
|
|
|
================================== ====================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. WARNING:: GFX7 does not support inline constants for *f16* operands.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_fconst:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
fconst
|
2019-07-09 00:50:11 +08:00
|
|
|
~~~~~~
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A :ref:`floating-point number<amdgpu_synid_floating-point_number>`
|
|
|
|
encoded as an *inline constant*.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Only a small fraction of floating-point numbers may be encoded as *inline constants*.
|
|
|
|
They are enumerated in the table below.
|
|
|
|
Other floating-point numbers have to be encoded as :ref:`literals<amdgpu_synid_literal>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Floating-point *inline constants* are converted to
|
|
|
|
:ref:`expected operand type<amdgpu_syn_instruction_type>`
|
|
|
|
as described :ref:`here<amdgpu_synid_fp_const_conv>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-01-18 23:17:17 +08:00
|
|
|
===================== ===================================================== ==================
|
|
|
|
Value Note Availability
|
|
|
|
===================== ===================================================== ==================
|
|
|
|
0.0 The same as integer constant 0. All GPUs
|
|
|
|
0.5 Floating-point constant 0.5 All GPUs
|
|
|
|
1.0 Floating-point constant 1.0 All GPUs
|
|
|
|
2.0 Floating-point constant 2.0 All GPUs
|
|
|
|
4.0 Floating-point constant 4.0 All GPUs
|
|
|
|
-0.5 Floating-point constant -0.5 All GPUs
|
|
|
|
-1.0 Floating-point constant -1.0 All GPUs
|
|
|
|
-2.0 Floating-point constant -2.0 All GPUs
|
|
|
|
-4.0 Floating-point constant -4.0 All GPUs
|
2019-07-09 00:50:11 +08:00
|
|
|
0.1592 1.0/(2.0*pi). Use only for 16-bit operands. GFX8, GFX9, GFX10
|
|
|
|
0.15915494 1.0/(2.0*pi). Use only for 16- and 32-bit operands. GFX8, GFX9, GFX10
|
|
|
|
0.15915494309189532 1.0/(2.0*pi). GFX8, GFX9, GFX10
|
2019-01-18 23:17:17 +08:00
|
|
|
===================== ===================================================== ==================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. WARNING:: GFX7 does not support inline constants for *f16* operands.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
.. _amdgpu_synid_ival:
|
|
|
|
|
|
|
|
ival
|
|
|
|
~~~~
|
|
|
|
|
|
|
|
A symbolic operand encoded as an *inline constant*.
|
|
|
|
These operands provide read-only access to H/W registers.
|
|
|
|
|
|
|
|
======================== ================================================ =============
|
|
|
|
Syntax Note Availability
|
|
|
|
======================== ================================================ =============
|
|
|
|
shared_base Base address of shared memory region. GFX9, GFX10
|
|
|
|
shared_limit Address of the end of shared memory region. GFX9, GFX10
|
|
|
|
private_base Base address of private memory region. GFX9, GFX10
|
|
|
|
private_limit Address of the end of private memory region. GFX9, GFX10
|
|
|
|
pops_exiting_wave_id A dedicated counter for POPS. GFX9, GFX10
|
|
|
|
======================== ================================================ =============
|
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_literal:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
literal
|
|
|
|
-------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A literal is a 64-bit value which is encoded as a separate 32-bit dword in the instruction stream.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
If a number may be encoded as either
|
|
|
|
a :ref:`literal<amdgpu_synid_literal>` or
|
|
|
|
an :ref:`inline constant<amdgpu_synid_constant>`,
|
|
|
|
assembler selects the latter encoding as more efficient.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Literals may be specified as :ref:`integer numbers<amdgpu_synid_integer_number>`,
|
|
|
|
:ref:`floating-point numbers<amdgpu_synid_floating-point_number>` or
|
|
|
|
:ref:`expressions<amdgpu_synid_expression>`
|
|
|
|
(expressions are currently supported for 32-bit operands only).
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A 64-bit literal value is converted by assembler
|
|
|
|
to an :ref:`expected operand type<amdgpu_syn_instruction_type>`
|
|
|
|
as described :ref:`here<amdgpu_synid_lit_conv>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
An instruction may use only one literal but several operands may refer the same literal.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_uimm8:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
uimm8
|
|
|
|
-----
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A 8-bit positive :ref:`integer number<amdgpu_synid_integer_number>`.
|
|
|
|
The value is encoded as part of the opcode so it is free to use.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_uimm32:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
uimm32
|
|
|
|
------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A 32-bit positive :ref:`integer number<amdgpu_synid_integer_number>`.
|
|
|
|
The value is stored as a separate 32-bit dword in the instruction stream.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_uimm20:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
uimm20
|
|
|
|
------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A 20-bit positive :ref:`integer number<amdgpu_synid_integer_number>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_uimm21:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
uimm21
|
|
|
|
------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A 21-bit positive :ref:`integer number<amdgpu_synid_integer_number>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. WARNING:: Assembler currently supports 20-bit offsets only. Use :ref:`uimm20<amdgpu_synid_uimm20>` as a replacement.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_simm21:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
simm21
|
|
|
|
------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A 21-bit :ref:`integer number<amdgpu_synid_integer_number>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2019-07-09 00:50:11 +08:00
|
|
|
.. WARNING:: Assembler currently supports 20-bit unsigned offsets only. Use :ref:`uimm20<amdgpu_synid_uimm20>` as a replacement.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_off:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
off
|
|
|
|
---
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A special entity which indicates that the value of this operand is not used.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
================================== ===================================================
|
|
|
|
Syntax Description
|
|
|
|
================================== ===================================================
|
|
|
|
off Indicates an unused operand.
|
|
|
|
================================== ===================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_number:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Numbers
|
|
|
|
=======
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_integer_number:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Integer Numbers
|
|
|
|
---------------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Integer numbers are 64 bits wide.
|
|
|
|
They may be specified in binary, octal, hexadecimal and decimal formats:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
============== ====================================
|
|
|
|
Format Syntax
|
|
|
|
============== ====================================
|
|
|
|
Decimal [-]?[1-9][0-9]*
|
|
|
|
Binary [-]?0b[01]+
|
|
|
|
Octal [-]?0[0-7]+
|
|
|
|
Hexadecimal [-]?0x[0-9a-fA-F]+
|
|
|
|
\ [-]?[0x]?[0-9][0-9a-fA-F]*[hH]
|
|
|
|
============== ====================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
-1234
|
|
|
|
0b1010
|
|
|
|
010
|
|
|
|
0xff
|
|
|
|
0ffh
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_floating-point_number:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Floating-Point Numbers
|
|
|
|
----------------------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
All floating-point numbers are handled as double (64 bits wide).
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Floating-point numbers may be specified in hexadecimal and decimal formats:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
============== ======================================================== ========================================================
|
|
|
|
Format Syntax Note
|
|
|
|
============== ======================================================== ========================================================
|
|
|
|
Decimal [-]?[0-9]*[.][0-9]*([eE][+-]?[0-9]*)? Must include either a decimal separator or an exponent.
|
|
|
|
Hexadecimal [-]0x[0-9a-fA-F]*(.[0-9a-fA-F]*)?[pP][+-]?[0-9a-fA-F]+
|
|
|
|
============== ======================================================== ========================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
-1.234
|
|
|
|
234e2
|
|
|
|
-0x1afp-10
|
|
|
|
0x.1afp10
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_expression:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Expressions
|
|
|
|
===========
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
An expression specifies an address or a numeric value.
|
|
|
|
There are two kinds of expressions:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
* :ref:`Absolute<amdgpu_synid_absolute_expression>`.
|
|
|
|
* :ref:`Relocatable<amdgpu_synid_relocatable_expression>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_absolute_expression:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Absolute Expressions
|
|
|
|
--------------------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
The value of an absolute expression remains the same after program relocation.
|
|
|
|
Absolute expressions must not include unassigned and relocatable values
|
|
|
|
such as labels.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
x = -1
|
|
|
|
y = x + 10
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_relocatable_expression:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Relocatable Expressions
|
|
|
|
-----------------------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
The value of a relocatable expression depends on program relocation.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Note that use of relocatable expressions is limited with branch targets
|
|
|
|
and 32-bit :ref:`literals<amdgpu_synid_literal>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Addition information about relocation may be found :ref:`here<amdgpu-relocation-records>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
y = x + 10 // x is not yet defined. Undefined symbols are assumed to be PC-relative.
|
|
|
|
z = .
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Expression Data Type
|
|
|
|
--------------------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Expressions and operands of expressions are interpreted as 64-bit integers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Expressions may include 64-bit :ref:`floating-point numbers<amdgpu_synid_floating-point_number>` (double).
|
|
|
|
However these operands are also handled as 64-bit integers
|
|
|
|
using binary representation of specified floating-point numbers.
|
|
|
|
No conversion from floating-point to integer is performed.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
x = 0.1 // x is assigned an integer 4591870180066957722 which is a binary representation of 0.1.
|
|
|
|
y = x + x // y is a sum of two integer values; it is not equal to 0.2!
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Syntax
|
|
|
|
------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Expressions are composed of
|
|
|
|
:ref:`symbols<amdgpu_synid_symbol>`,
|
|
|
|
:ref:`integer numbers<amdgpu_synid_integer_number>`,
|
|
|
|
:ref:`floating-point numbers<amdgpu_synid_floating-point_number>`,
|
|
|
|
:ref:`binary operators<amdgpu_synid_expression_bin_op>`,
|
|
|
|
:ref:`unary operators<amdgpu_synid_expression_un_op>` and subexpressions.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Expressions may also use "." which is a reference to the current PC (program counter).
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
The syntax of expressions is shown below::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
expr ::= expr binop expr | primaryexpr ;
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
primaryexpr ::= '(' expr ')' | symbol | number | '.' | unop primaryexpr ;
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
binop ::= '&&'
|
|
|
|
| '||'
|
|
|
|
| '|'
|
|
|
|
| '^'
|
|
|
|
| '&'
|
|
|
|
| '!'
|
|
|
|
| '=='
|
|
|
|
| '!='
|
|
|
|
| '<>'
|
|
|
|
| '<'
|
|
|
|
| '<='
|
|
|
|
| '>'
|
|
|
|
| '>='
|
|
|
|
| '<<'
|
|
|
|
| '>>'
|
|
|
|
| '+'
|
|
|
|
| '-'
|
|
|
|
| '*'
|
|
|
|
| '/'
|
|
|
|
| '%' ;
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
unop ::= '~'
|
|
|
|
| '+'
|
|
|
|
| '-'
|
|
|
|
| '!' ;
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_expression_bin_op:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Binary Operators
|
|
|
|
----------------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Binary operators are described in the following table.
|
|
|
|
They operate on and produce 64-bit integers.
|
|
|
|
Operators with higher priority are performed first.
|
|
|
|
|
|
|
|
========== ========= ===============================================
|
|
|
|
Operator Priority Meaning
|
|
|
|
========== ========= ===============================================
|
|
|
|
\* 5 Integer multiplication.
|
|
|
|
/ 5 Integer division.
|
|
|
|
% 5 Integer signed remainder.
|
|
|
|
\+ 4 Integer addition.
|
|
|
|
\- 4 Integer subtraction.
|
|
|
|
<< 3 Integer shift left.
|
|
|
|
>> 3 Logical shift right.
|
|
|
|
== 2 Equality comparison.
|
|
|
|
!= 2 Inequality comparison.
|
|
|
|
<> 2 Inequality comparison.
|
|
|
|
< 2 Signed less than comparison.
|
|
|
|
<= 2 Signed less than or equal comparison.
|
|
|
|
> 2 Signed greater than comparison.
|
|
|
|
>= 2 Signed greater than or equal comparison.
|
|
|
|
\| 1 Bitwise or.
|
|
|
|
^ 1 Bitwise xor.
|
|
|
|
& 1 Bitwise and.
|
|
|
|
&& 0 Logical and.
|
|
|
|
|| 0 Logical or.
|
|
|
|
========== ========= ===============================================
|
|
|
|
|
|
|
|
.. _amdgpu_synid_expression_un_op:
|
|
|
|
|
|
|
|
Unary Operators
|
|
|
|
---------------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Unary operators are described in the following table.
|
|
|
|
They operate on and produce 64-bit integers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
========== ===============================================
|
|
|
|
Operator Meaning
|
|
|
|
========== ===============================================
|
|
|
|
! Logical negation.
|
|
|
|
~ Bitwise negation.
|
|
|
|
\+ Integer unary plus.
|
|
|
|
\- Integer unary minus.
|
|
|
|
========== ===============================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_symbol:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Symbols
|
|
|
|
-------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A symbol is a named 64-bit value, representing a relocatable
|
|
|
|
address or an absolute (non-relocatable) number.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Symbol names have the following syntax:
|
|
|
|
``[a-zA-Z_.][a-zA-Z0-9_$.@]*``
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
The table below provides several examples of syntax used for symbol definition.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
================ ==========================================================
|
|
|
|
Syntax Meaning
|
|
|
|
================ ==========================================================
|
|
|
|
.globl <S> Declares a global symbol S without assigning it a value.
|
|
|
|
.set <S>, <E> Assigns the value of an expression E to a symbol S.
|
|
|
|
<S> = <E> Assigns the value of an expression E to a symbol S.
|
|
|
|
<S>: Declares a label S and assigns it the current PC value.
|
|
|
|
================ ==========================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
A symbol may be used before it is declared or assigned;
|
|
|
|
unassigned symbols are assumed to be PC-relative.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Addition information about symbols may be found :ref:`here<amdgpu-symbols>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_conv:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Conversions
|
|
|
|
===========
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
This section describes what happens when a 64-bit
|
|
|
|
:ref:`integer number<amdgpu_synid_integer_number>`, a
|
|
|
|
:ref:`floating-point numbers<amdgpu_synid_floating-point_number>` or a
|
|
|
|
:ref:`symbol<amdgpu_synid_symbol>`
|
|
|
|
is used for an operand which has a different type or size.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Depending on operand kind, this conversion is performed by either assembler or AMDGPU H/W:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
* Values encoded as :ref:`inline constants<amdgpu_synid_constant>` are handled by H/W.
|
|
|
|
* Values encoded as :ref:`literals<amdgpu_synid_literal>` are converted by assembler.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_const_conv:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Inline Constants
|
|
|
|
----------------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_int_const_conv:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Integer Inline Constants
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Integer :ref:`inline constants<amdgpu_synid_constant>`
|
|
|
|
may be thought of as 64-bit
|
|
|
|
:ref:`integer numbers<amdgpu_synid_integer_number>`;
|
|
|
|
when used as operands they are truncated to the size of
|
|
|
|
:ref:`expected operand type<amdgpu_syn_instruction_type>`.
|
|
|
|
No data type conversions are performed.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
// GFX9
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
v_add_u16 v0, -1, 0 // v0 = 0xFFFF
|
|
|
|
v_add_f16 v0, -1, 0 // v0 = 0xFFFF (NaN)
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
v_add_u32 v0, -1, 0 // v0 = 0xFFFFFFFF
|
|
|
|
v_add_f32 v0, -1, 0 // v0 = 0xFFFFFFFF (NaN)
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_fp_const_conv:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Floating-Point Inline Constants
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Floating-point :ref:`inline constants<amdgpu_synid_constant>`
|
|
|
|
may be thought of as 64-bit
|
|
|
|
:ref:`floating-point numbers<amdgpu_synid_floating-point_number>`;
|
|
|
|
when used as operands they are converted to a floating-point number of
|
|
|
|
:ref:`expected operand size<amdgpu_syn_instruction_type>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
// GFX9
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
v_add_f16 v0, 1.0, 0 // v0 = 0x3C00 (1.0)
|
|
|
|
v_add_u16 v0, 1.0, 0 // v0 = 0x3C00
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
v_add_f32 v0, 1.0, 0 // v0 = 0x3F800000 (1.0)
|
|
|
|
v_add_u32 v0, 1.0, 0 // v0 = 0x3F800000
|
2018-03-12 23:55:08 +08:00
|
|
|
|
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_lit_conv:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Literals
|
|
|
|
--------
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_int_lit_conv:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Integer Literals
|
|
|
|
~~~~~~~~~~~~~~~~
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Integer :ref:`literals<amdgpu_synid_literal>`
|
|
|
|
are specified as 64-bit :ref:`integer numbers<amdgpu_synid_integer_number>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
When used as operands they are converted to
|
|
|
|
:ref:`expected operand type<amdgpu_syn_instruction_type>` as described below.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
============== ============== =============== ====================================================================
|
|
|
|
Expected type Condition Result Note
|
|
|
|
============== ============== =============== ====================================================================
|
2018-12-28 19:48:23 +08:00
|
|
|
i16, u16, b16 cond(num,16) num.u16 Truncate to 16 bits.
|
|
|
|
i32, u32, b32 cond(num,32) num.u32 Truncate to 32 bits.
|
|
|
|
i64 cond(num,32) {-1,num.i32} Truncate to 32 bits and then sign-extend the result to 64 bits.
|
|
|
|
u64, b64 cond(num,32) { 0,num.u32} Truncate to 32 bits and then zero-extend the result to 64 bits.
|
|
|
|
f16 cond(num,16) num.u16 Use low 16 bits as an f16 value.
|
|
|
|
f32 cond(num,32) num.u32 Use low 32 bits as an f32 value.
|
|
|
|
f64 cond(num,32) {num.u32,0} Use low 32 bits of the number as high 32 bits
|
2018-12-18 01:38:11 +08:00
|
|
|
of the result; low 32 bits of the result are zeroed.
|
|
|
|
============== ============== =============== ====================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
The condition *cond(X,S)* indicates if a 64-bit number *X*
|
|
|
|
can be converted to a smaller size *S* by truncation of upper bits.
|
|
|
|
There are two cases when the conversion is possible:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
* The truncated bits are all 0.
|
|
|
|
* The truncated bits are all 1 and the value after truncation has its MSB bit set.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples of valid literals:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
// GFX9
|
2018-12-28 19:48:23 +08:00
|
|
|
// Literal value after conversion:
|
|
|
|
v_add_u16 v0, 0xff00, v0 // 0xff00
|
|
|
|
v_add_u16 v0, 0xffffffffffffff00, v0 // 0xff00
|
|
|
|
v_add_u16 v0, -256, v0 // 0xff00
|
|
|
|
// Literal value after conversion:
|
|
|
|
s_bfe_i64 s[0:1], 0xffefffff, s3 // 0xffffffffffefffff
|
|
|
|
s_bfe_u64 s[0:1], 0xffefffff, s3 // 0x00000000ffefffff
|
|
|
|
v_ceil_f64_e32 v[0:1], 0xffefffff // 0xffefffff00000000 (-1.7976922776554302e308)
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples of invalid literals:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
// GFX9
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-28 19:48:23 +08:00
|
|
|
v_add_u16 v0, 0x1ff00, v0 // truncated bits are not all 0 or 1
|
|
|
|
v_add_u16 v0, 0xffffffffffff00ff, v0 // truncated bits do not match MSB of the result
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_fp_lit_conv:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Floating-Point Literals
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Floating-point :ref:`literals<amdgpu_synid_literal>` are specified as 64-bit
|
|
|
|
:ref:`floating-point numbers<amdgpu_synid_floating-point_number>`.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
When used as operands they are converted to
|
|
|
|
:ref:`expected operand type<amdgpu_syn_instruction_type>` as described below.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
============== ============== ================= =================================================================
|
|
|
|
Expected type Condition Result Note
|
|
|
|
============== ============== ================= =================================================================
|
2018-12-28 19:48:23 +08:00
|
|
|
i16, u16, b16 cond(num,16) f16(num) Convert to f16 and use bits of the result as an integer value.
|
|
|
|
i32, u32, b32 cond(num,32) f32(num) Convert to f32 and use bits of the result as an integer value.
|
2018-12-18 01:38:11 +08:00
|
|
|
i64, u64, b64 false \- Conversion disabled because of an unclear semantics.
|
2018-12-28 19:48:23 +08:00
|
|
|
f16 cond(num,16) f16(num) Convert to f16.
|
|
|
|
f32 cond(num,32) f32(num) Convert to f32.
|
|
|
|
f64 true {num.u32.hi,0} Use high 32 bits of the number as high 32 bits of the result;
|
2018-12-18 01:38:11 +08:00
|
|
|
zero-fill low 32 bits of the result.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Note that the result may differ from the original number.
|
|
|
|
============== ============== ================= =================================================================
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
The condition *cond(X,S)* indicates if an f64 number *X* can be converted
|
|
|
|
to a smaller *S*-bit floating-point type without overflow or underflow.
|
|
|
|
Precision lost is allowed.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples of valid literals:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
// GFX9
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
v_add_f16 v1, 65500.0, v2
|
|
|
|
v_add_f32 v1, 65600.0, v2
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-28 19:48:23 +08:00
|
|
|
// Literal value before conversion: 1.7976931348623157e308 (0x7fefffffffffffff)
|
|
|
|
// Literal value after conversion: 1.7976922776554302e308 (0x7fefffff00000000)
|
|
|
|
v_ceil_f64 v[0:1], 1.7976931348623157e308
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples of invalid literals:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
// GFX9
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-28 19:48:23 +08:00
|
|
|
v_add_f16 v1, 65600.0, v2 // overflow
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
.. _amdgpu_synid_exp_conv:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Expressions
|
|
|
|
~~~~~~~~~~~
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Expressions operate with and result in 64-bit integers.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
When used as operands they are truncated to
|
|
|
|
:ref:`expected operand size<amdgpu_syn_instruction_type>`.
|
|
|
|
No data type conversions are performed.
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
Examples:
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 02:53:10 +08:00
|
|
|
.. parsed-literal::
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
// GFX9
|
2018-03-12 23:55:08 +08:00
|
|
|
|
2018-12-18 01:38:11 +08:00
|
|
|
x = 0.1
|
|
|
|
v_sqrt_f32 v0, x // v0 = [low 32 bits of 0.1 (double)]
|
|
|
|
v_sqrt_f32 v0, (0.1 + 0) // the same as above
|
|
|
|
v_sqrt_f32 v0, 0.1 // v0 = [0.1 (double) converted to float]
|
2018-03-12 23:55:08 +08:00
|
|
|
|