1 ======================================
2 Syntax of AMDGPU Instruction Modifiers
3 ======================================
11 The following notation is used throughout this document:
13 =================== =============================================================
15 =================== =============================================================
16 {0..N} Any integer value in the range from 0 to N (inclusive).
17 <x> Syntax and meaning of *x* is explained elsewhere.
18 =================== =============================================================
20 .. _amdgpu_syn_modifiers:
28 .. _amdgpu_synid_ds_offset8:
33 Specifies an immediate unsigned 8-bit offset, in bytes. The default value is 0.
35 Used with DS instructions which have 2 addresses.
37 =================== =====================================================
39 =================== =====================================================
40 offset:{0..0xFF} Specifies an unsigned 8-bit offset as a positive
41 :ref:`integer number <amdgpu_synid_integer_number>`.
42 =================== =====================================================
51 .. _amdgpu_synid_ds_offset16:
56 Specifies an immediate unsigned 16-bit offset, in bytes. The default value is 0.
58 Used with DS instructions which have 1 address.
60 ==================== ======================================================
62 ==================== ======================================================
63 offset:{0..0xFFFF} Specifies an unsigned 16-bit offset as a positive
64 :ref:`integer number <amdgpu_synid_integer_number>`.
65 ==================== ======================================================
74 .. _amdgpu_synid_sw_offset16:
79 This is a special modifier which may be used with *ds_swizzle_b32* instruction only.
80 It specifies a swizzle pattern in numeric or symbolic form. The default value is 0.
82 See AMD documentation for more information.
84 ======================================================= ===========================================================
86 ======================================================= ===========================================================
87 offset:{0..0xFFFF} Specifies a 16-bit swizzle pattern.
88 offset:swizzle(QUAD_PERM,{0..3},{0..3},{0..3},{0..3}) Specifies a quad permute mode pattern
90 Each number is a lane *id*.
91 offset:swizzle(BITMASK_PERM, "<mask>") Specifies a bitmask permute mode pattern.
93 The pattern converts a 5-bit lane *id* to another
94 lane *id* with which the lane interacts.
96 *mask* is a 5 character sequence which
97 specifies how to transform the bits of the
100 The following characters are allowed:
102 * "0" - set bit to 0.
104 * "1" - set bit to 1.
106 * "p" - preserve bit.
110 offset:swizzle(BROADCAST,{2..32},{0..N}) Specifies a broadcast mode.
112 Broadcasts the value of any particular lane to
113 all lanes in its group.
115 The first numeric parameter is a group
116 size and must be equal to 2, 4, 8, 16 or 32.
118 The second numeric parameter is an index of the
119 lane being broadcasted.
121 The index must not exceed group size.
122 offset:swizzle(SWAP,{1..16}) Specifies a swap mode.
124 Swaps the neighboring groups of
125 1, 2, 4, 8 or 16 lanes.
126 offset:swizzle(REVERSE,{2..32}) Specifies a reverse mode.
128 Reverses the lanes for groups of 2, 4, 8, 16 or 32 lanes.
129 ======================================================= ===========================================================
131 Numeric parameters may be specified as either :ref:`integer numbers<amdgpu_synid_integer_number>` or
132 :ref:`absolute expressions<amdgpu_synid_absolute_expression>`.
140 offset:swizzle(QUAD_PERM, 0, 1, 2 ,3)
141 offset:swizzle(BITMASK_PERM, "01pi0")
142 offset:swizzle(BROADCAST, 2, 0)
143 offset:swizzle(SWAP, 8)
144 offset:swizzle(REVERSE, 30 + 2)
146 .. _amdgpu_synid_gds:
151 Specifies whether to use GDS or LDS memory (LDS is the default).
153 ======================================== ================================================
155 ======================================== ================================================
157 ======================================== ================================================
163 .. _amdgpu_synid_done:
168 Specifies if this is the last export from the shader to the target. By default,
169 *exp* instruction does not finish an export sequence.
171 ======================================== ================================================
173 ======================================== ================================================
174 done Indicates the last export operation.
175 ======================================== ================================================
177 .. _amdgpu_synid_compr:
182 Indicates if the data are compressed (data are not compressed by default).
184 ======================================== ================================================
186 ======================================== ================================================
187 compr Data are compressed.
188 ======================================== ================================================
195 Specifies valid mask flag state (off by default).
197 ======================================== ================================================
199 ======================================== ================================================
200 vm Set valid mask flag.
201 ======================================== ================================================
206 .. _amdgpu_synid_flat_offset12:
211 Specifies an immediate unsigned 12-bit offset, in bytes. The default value is 0.
213 Cannot be used with *global/scratch* opcodes. GFX9 only.
215 ================= ======================================================
217 ================= ======================================================
218 offset:{0..4095} Specifies a 12-bit unsigned offset as a positive
219 :ref:`integer number <amdgpu_synid_integer_number>`.
220 ================= ======================================================
229 .. _amdgpu_synid_flat_offset13s:
234 Specifies an immediate signed 13-bit offset, in bytes. The default value is 0.
236 Can be used with *global/scratch* opcodes only. GFX9 only.
238 ============================ =======================================================
240 ============================ =======================================================
241 offset:{-4096..4095} Specifies a 13-bit signed offset as an
242 :ref:`integer number <amdgpu_synid_integer_number>`.
243 ============================ =======================================================
252 .. _amdgpu_synid_flat_offset12s:
257 Specifies an immediate signed 12-bit offset, in bytes. The default value is 0.
259 Can be used with *global/scratch* opcodes only.
263 ============================ =======================================================
265 ============================ =======================================================
266 offset:{-2048..2047} Specifies a 12-bit signed offset as an
267 :ref:`integer number <amdgpu_synid_integer_number>`.
268 ============================ =======================================================
277 .. _amdgpu_synid_flat_offset11:
282 Specifies an immediate unsigned 11-bit offset, in bytes. The default value is 0.
284 Cannot be used with *global/scratch* opcodes.
288 ================= ======================================================
290 ================= ======================================================
291 offset:{0..2047} Specifies an 11-bit unsigned offset as a positive
292 :ref:`integer number <amdgpu_synid_integer_number>`.
293 ================= ======================================================
305 See a description :ref:`here<amdgpu_synid_dlc>`. GFX10 only.
310 See a description :ref:`here<amdgpu_synid_glc>`.
315 See a description :ref:`here<amdgpu_synid_lds>`. GFX10 only.
320 See a description :ref:`here<amdgpu_synid_slc>`.
325 See a description :ref:`here<amdgpu_synid_tfe>`.
330 See a description :ref:`here<amdgpu_synid_nv>`.
335 .. _amdgpu_synid_dmask:
340 Specifies which channels (image components) are used by the operation. By default, no channels
343 =============== =====================================================
345 =============== =====================================================
346 dmask:{0..15} Specifies image channels as a positive
347 :ref:`integer number <amdgpu_synid_integer_number>`.
349 Each bit corresponds to one of 4 image
352 If the specified bit value
353 is 0, the component is not used, value 1 means
354 that the component is used.
355 =============== =====================================================
357 This modifier has some limitations depending on instruction kind:
359 =================================================== ========================
360 Instruction Kind Valid dmask Values
361 =================================================== ========================
362 32-bit atomic *cmpswap* 0x3
363 32-bit atomic instructions except for *cmpswap* 0x1
364 64-bit atomic *cmpswap* 0xF
365 64-bit atomic instructions except for *cmpswap* 0x3
366 *gather4* 0x1, 0x2, 0x4, 0x8
367 Other instructions any value
368 =================================================== ========================
378 .. _amdgpu_synid_unorm:
383 Specifies whether the address is normalized or not (the address is normalized by default).
385 ======================== ========================================
387 ======================== ========================================
388 unorm Force the address to be unnormalized.
389 ======================== ========================================
394 See a description :ref:`here<amdgpu_synid_glc>`.
399 See a description :ref:`here<amdgpu_synid_slc>`.
401 .. _amdgpu_synid_r128:
406 Specifies texture resource size. The default size is 256 bits.
408 GFX7, GFX8 and GFX10 only.
410 =================== ================================================
412 =================== ================================================
413 r128 Specifies 128 bits texture resource size.
414 =================== ================================================
416 .. WARNING:: Using this modifier should descrease *rsrc* operand size from 8 to 4 dwords, but assembler does not currently support this feature.
421 See a description :ref:`here<amdgpu_synid_tfe>`.
423 .. _amdgpu_synid_lwe:
428 Specifies LOD warning status (LOD warning is disabled by default).
430 ======================================== ================================================
432 ======================================== ================================================
433 lwe Enables LOD warning.
434 ======================================== ================================================
441 Specifies if an array index must be sent to TA. By default, array index is not sent.
443 ======================================== ================================================
445 ======================================== ================================================
446 da Send an array-index to TA.
447 ======================================== ================================================
449 .. _amdgpu_synid_d16:
454 Specifies data size: 16 or 32 bits (32 bits by default). Not supported by GFX7.
456 ======================================== ================================================
458 ======================================== ================================================
459 d16 Enables 16-bits data mode.
461 On loads, convert data in memory to 16-bit
462 format before storing it in VGPRs.
464 For stores, convert 16-bit data in VGPRs to
465 32 bits before going to memory.
467 Note that GFX8.0 does not support data packing.
468 Each 16-bit data element occupies 1 VGPR.
470 GFX8.1, GFX9 and GFX10 support data packing.
471 Each pair of 16-bit data elements
473 ======================================== ================================================
475 .. _amdgpu_synid_a16:
480 Specifies size of image address components: 16 or 32 bits (32 bits by default).
483 ======================================== ================================================
485 ======================================== ================================================
486 a16 Enables 16-bits image address components.
487 ======================================== ================================================
489 .. _amdgpu_synid_dim:
494 Specifies surface dimension. This is a mandatory modifier. There is no default value.
498 =============================== =========================================================
500 =============================== =========================================================
501 dim:1D One-dimensional image.
502 dim:2D Two-dimensional image.
503 dim:3D Three-dimensional image.
504 dim:CUBE Cubemap array.
505 dim:1D_ARRAY One-dimensional image array.
506 dim:2D_ARRAY Two-dimensional image array.
507 dim:2D_MSAA Two-dimensional multi-sample auto-aliasing image.
508 dim:2D_MSAA_ARRAY Two-dimensional multi-sample auto-aliasing image array.
509 =============================== =========================================================
511 The following table defines an alternative syntax which is supported
512 for compatibility with SP3 assembler:
514 =============================== =========================================================
516 =============================== =========================================================
517 dim:SQ_RSRC_IMG_1D One-dimensional image.
518 dim:SQ_RSRC_IMG_2D Two-dimensional image.
519 dim:SQ_RSRC_IMG_3D Three-dimensional image.
520 dim:SQ_RSRC_IMG_CUBE Cubemap array.
521 dim:SQ_RSRC_IMG_1D_ARRAY One-dimensional image array.
522 dim:SQ_RSRC_IMG_2D_ARRAY Two-dimensional image array.
523 dim:SQ_RSRC_IMG_2D_MSAA Two-dimensional multi-sample auto-aliasing image.
524 dim:SQ_RSRC_IMG_2D_MSAA_ARRAY Two-dimensional multi-sample auto-aliasing image array.
525 =============================== =========================================================
530 See a description :ref:`here<amdgpu_synid_dlc>`. GFX10 only.
532 Miscellaneous Modifiers
533 -----------------------
535 .. _amdgpu_synid_dlc:
540 Controls device level cache policy for memory operations. Used for synchronization.
541 When specified, forces operation to bypass device level cache making the operation device
542 level coherent. By default, instructions use device level cache.
546 ======================================== ================================================
548 ======================================== ================================================
549 dlc Bypass device level cache.
550 ======================================== ================================================
552 .. _amdgpu_synid_glc:
557 This modifier has different meaning for loads, stores, and atomic operations.
558 The default value is off (0).
560 See AMD documentation for details.
562 ======================================== ================================================
564 ======================================== ================================================
565 glc Set glc bit to 1.
566 ======================================== ================================================
568 .. _amdgpu_synid_lds:
573 Specifies where to store the result: VGPRs or LDS (VGPRs by default).
575 ======================================== ===========================
577 ======================================== ===========================
578 lds Store result in LDS.
579 ======================================== ===========================
586 Specifies if instruction is operating on non-volatile memory. By default, memory is volatile.
590 ======================================== ================================================
592 ======================================== ================================================
593 nv Indicates that instruction operates on
595 ======================================== ================================================
597 .. _amdgpu_synid_slc:
602 Specifies cache policy. The default value is off (0).
604 See AMD documentation for details.
606 ======================================== ================================================
608 ======================================== ================================================
609 slc Set slc bit to 1.
610 ======================================== ================================================
612 .. _amdgpu_synid_tfe:
617 Controls access to partially resident textures. The default value is off (0).
619 See AMD documentation for details.
621 ======================================== ================================================
623 ======================================== ================================================
624 tfe Set tfe bit to 1.
625 ======================================== ================================================
627 MUBUF/MTBUF Modifiers
628 ---------------------
630 .. _amdgpu_synid_idxen:
635 Specifies whether address components include an index. By default, no components are used.
637 Can be used together with :ref:`offen<amdgpu_synid_offen>`.
639 Cannot be used with :ref:`addr64<amdgpu_synid_addr64>`.
641 ======================================== ================================================
643 ======================================== ================================================
644 idxen Address components include an index.
645 ======================================== ================================================
647 .. _amdgpu_synid_offen:
652 Specifies whether address components include an offset. By default, no components are used.
654 Can be used together with :ref:`idxen<amdgpu_synid_idxen>`.
656 Cannot be used with :ref:`addr64<amdgpu_synid_addr64>`.
658 ======================================== ================================================
660 ======================================== ================================================
661 offen Address components include an offset.
662 ======================================== ================================================
664 .. _amdgpu_synid_addr64:
669 Specifies whether a 64-bit address is used. By default, no address is used.
671 GFX7 only. Cannot be used with :ref:`offen<amdgpu_synid_offen>` and
672 :ref:`idxen<amdgpu_synid_idxen>` modifiers.
674 ======================================== ================================================
676 ======================================== ================================================
677 addr64 A 64-bit address is used.
678 ======================================== ================================================
680 .. _amdgpu_synid_buf_offset12:
685 Specifies an immediate unsigned 12-bit offset, in bytes. The default value is 0.
687 =============================== ======================================================
689 =============================== ======================================================
690 offset:{0..0xFFF} Specifies a 12-bit unsigned offset as a positive
691 :ref:`integer number <amdgpu_synid_integer_number>`.
692 =============================== ======================================================
704 See a description :ref:`here<amdgpu_synid_glc>`.
709 See a description :ref:`here<amdgpu_synid_slc>`.
714 See a description :ref:`here<amdgpu_synid_lds>`.
719 See a description :ref:`here<amdgpu_synid_dlc>`. GFX10 only.
724 See a description :ref:`here<amdgpu_synid_tfe>`.
726 .. _amdgpu_synid_dfmt:
733 .. _amdgpu_synid_nfmt:
746 See a description :ref:`here<amdgpu_synid_glc>`.
751 See a description :ref:`here<amdgpu_synid_nv>`. GFX9 only.
756 See a description :ref:`here<amdgpu_synid_dlc>`. GFX10 only.
761 .. _amdgpu_synid_high:
766 Specifies which half of the LDS word to use. Low half of LDS word is used by default.
769 ======================================== ================================
771 ======================================== ================================
772 high Use high half of LDS word.
773 ======================================== ================================
780 .. _amdgpu_synid_dpp8_sel:
785 Selects which lane to pull data from, within a group of 8 lanes. This is a mandatory modifier.
786 There is no default value.
790 The *dpp8_sel* modifier must specify exactly 8 values, each ranging from 0 to 7.
791 First value selects which lane to read from to supply data into lane 0.
792 Second value controls value for lane 1 and so on.
794 =============================================================== ===========================
796 =============================================================== ===========================
797 dpp8:[{0..7},{0..7},{0..7},{0..7},{0..7},{0..7},{0..7},{0..7}] Select lanes to read from.
798 =============================================================== ===========================
804 dpp8:[7,6,5,4,3,2,1,0]
805 dpp8:[0,1,0,1,0,1,0,1]
807 .. _amdgpu_synid_fi8:
812 Controls interaction with inactive lanes for *dpp8* instructions. The default value is zero.
814 Note. *Inactive* lanes are those whose :ref:`exec<amdgpu_synid_exec>` mask bit is zero.
818 ==================================== =====================================================
820 ==================================== =====================================================
821 fi:0 Fetch zero when accessing data from inactive lanes.
822 fi:1 Fetch pre-exist values from inactive lanes.
823 ==================================== =====================================================
828 GFX8, GFX9 and GFX10 only.
830 .. _amdgpu_synid_dpp_ctrl:
835 Specifies how data are shared between threads. This is a mandatory modifier.
836 There is no default value.
838 GFX8 and GFX9 only. Use :ref:`dpp16_ctrl<amdgpu_synid_dpp16_ctrl>` for GFX10.
840 Note. The lanes of a wavefront are organized in four *rows* and four *banks*.
842 ======================================== ================================================
844 ======================================== ================================================
845 quad_perm:[{0..3},{0..3},{0..3},{0..3}] Full permute of 4 threads.
846 row_mirror Mirror threads within row.
847 row_half_mirror Mirror threads within 1/2 row (8 threads).
848 row_bcast:15 Broadcast 15th thread of each row to next row.
849 row_bcast:31 Broadcast thread 31 to rows 2 and 3.
850 wave_shl:1 Wavefront left shift by 1 thread.
851 wave_rol:1 Wavefront left rotate by 1 thread.
852 wave_shr:1 Wavefront right shift by 1 thread.
853 wave_ror:1 Wavefront right rotate by 1 thread.
854 row_shl:{1..15} Row shift left by 1-15 threads.
855 row_shr:{1..15} Row shift right by 1-15 threads.
856 row_ror:{1..15} Row rotate right by 1-15 threads.
857 ======================================== ================================================
859 Note: Numeric parameters may be specified as either
860 :ref:`integer numbers<amdgpu_synid_integer_number>` or
861 :ref:`absolute expressions<amdgpu_synid_absolute_expression>`.
867 quad_perm:[0, 1, 2, 3]
870 .. _amdgpu_synid_dpp16_ctrl:
875 Specifies how data are shared between threads. This is a mandatory modifier.
876 There is no default value.
878 GFX10 only. Use :ref:`dpp_ctrl<amdgpu_synid_dpp_ctrl>` for GFX8 and GFX9.
880 Note. The lanes of a wavefront are organized in four *rows* and four *banks*.
881 (There are only two rows in *wave32* mode.)
883 ======================================== ====================================================
885 ======================================== ====================================================
886 quad_perm:[{0..3},{0..3},{0..3},{0..3}] Full permute of 4 threads.
887 row_mirror Mirror threads within row.
888 row_half_mirror Mirror threads within 1/2 row (8 threads).
889 row_share:{0..15} Share the value from the specified lane with other
891 row_xmask:{0..15} Fetch from XOR(current lane id, specified lane id).
892 row_shl:{1..15} Row shift left by 1-15 threads.
893 row_shr:{1..15} Row shift right by 1-15 threads.
894 row_ror:{1..15} Row rotate right by 1-15 threads.
895 ======================================== ====================================================
897 Note: Numeric parameters may be specified as either
898 :ref:`integer numbers<amdgpu_synid_integer_number>` or
899 :ref:`absolute expressions<amdgpu_synid_absolute_expression>`.
905 quad_perm:[0, 1, 2, 3]
908 .. _amdgpu_synid_row_mask:
913 Controls which rows are enabled for data sharing. By default, all rows are enabled.
915 Note. The lanes of a wavefront are organized in four *rows* and four *banks*.
916 (There are only two rows in *wave32* mode.)
918 ======================================== =====================================================
920 ======================================== =====================================================
921 row_mask:{0..15} Specifies a *row mask* as a positive
922 :ref:`integer number <amdgpu_synid_integer_number>`.
924 Each of 4 bits in the mask controls one
925 row (0 - disabled, 1 - enabled).
927 In *wave32* mode the values should be limited to
929 ======================================== =====================================================
939 .. _amdgpu_synid_bank_mask:
944 Controls which banks are enabled for data sharing. By default, all banks are enabled.
946 Note. The lanes of a wavefront are organized in four *rows* and four *banks*.
947 (There are only two rows in *wave32* mode.)
949 ======================================== =======================================================
951 ======================================== =======================================================
952 bank_mask:{0..15} Specifies a *bank mask* as a positive
953 :ref:`integer number <amdgpu_synid_integer_number>`.
955 Each of 4 bits in the mask controls one
956 bank (0 - disabled, 1 - enabled).
957 ======================================== =======================================================
967 .. _amdgpu_synid_bound_ctrl:
972 Controls data sharing when accessing an invalid lane. By default, data sharing with
973 invalid lanes is disabled.
975 ======================================== ================================================
977 ======================================== ================================================
978 bound_ctrl:0 Enables data sharing with invalid lanes.
980 Accessing data from an invalid lane will
982 ======================================== ================================================
984 .. _amdgpu_synid_fi16:
989 Controls interaction with *inactive* lanes for *dpp16* instructions. The default value is zero.
991 Note. *Inactive* lanes are those whose :ref:`exec<amdgpu_synid_exec>` mask bit is zero.
995 ======================================== ==================================================
997 ======================================== ==================================================
998 fi:0 Interaction with inactive lanes is controlled by
999 :ref:`bound_ctrl<amdgpu_synid_bound_ctrl>`.
1001 fi:1 Fetch pre-exist values from inactive lanes.
1002 ======================================== ==================================================
1007 GFX8, GFX9 and GFX10 only.
1012 See a description :ref:`here<amdgpu_synid_clamp>`.
1017 See a description :ref:`here<amdgpu_synid_omod>`.
1019 GFX9 and GFX10 only.
1021 .. _amdgpu_synid_dst_sel:
1026 Selects which bits in the destination are affected. By default, all bits are affected.
1028 ======================================== ================================================
1030 ======================================== ================================================
1031 dst_sel:DWORD Use bits 31:0.
1032 dst_sel:BYTE_0 Use bits 7:0.
1033 dst_sel:BYTE_1 Use bits 15:8.
1034 dst_sel:BYTE_2 Use bits 23:16.
1035 dst_sel:BYTE_3 Use bits 31:24.
1036 dst_sel:WORD_0 Use bits 15:0.
1037 dst_sel:WORD_1 Use bits 31:16.
1038 ======================================== ================================================
1041 .. _amdgpu_synid_dst_unused:
1046 Controls what to do with the bits in the destination which are not selected
1047 by :ref:`dst_sel<amdgpu_synid_dst_sel>`.
1048 By default, unused bits are preserved.
1050 ======================================== ================================================
1052 ======================================== ================================================
1053 dst_unused:UNUSED_PAD Pad with zeros.
1054 dst_unused:UNUSED_SEXT Sign-extend upper bits, zero lower bits.
1055 dst_unused:UNUSED_PRESERVE Preserve bits.
1056 ======================================== ================================================
1058 .. _amdgpu_synid_src0_sel:
1063 Controls which bits in the src0 are used. By default, all bits are used.
1065 ======================================== ================================================
1067 ======================================== ================================================
1068 src0_sel:DWORD Use bits 31:0.
1069 src0_sel:BYTE_0 Use bits 7:0.
1070 src0_sel:BYTE_1 Use bits 15:8.
1071 src0_sel:BYTE_2 Use bits 23:16.
1072 src0_sel:BYTE_3 Use bits 31:24.
1073 src0_sel:WORD_0 Use bits 15:0.
1074 src0_sel:WORD_1 Use bits 31:16.
1075 ======================================== ================================================
1077 .. _amdgpu_synid_src1_sel:
1082 Controls which bits in the src1 are used. By default, all bits are used.
1084 ======================================== ================================================
1086 ======================================== ================================================
1087 src1_sel:DWORD Use bits 31:0.
1088 src1_sel:BYTE_0 Use bits 7:0.
1089 src1_sel:BYTE_1 Use bits 15:8.
1090 src1_sel:BYTE_2 Use bits 23:16.
1091 src1_sel:BYTE_3 Use bits 31:24.
1092 src1_sel:WORD_0 Use bits 15:0.
1093 src1_sel:WORD_1 Use bits 31:16.
1094 ======================================== ================================================
1096 .. _amdgpu_synid_sdwa_operand_modifiers:
1098 SDWA Operand Modifiers
1099 ----------------------
1101 Operand modifiers are not used separately. They are applied to source operands.
1103 GFX8, GFX9 and GFX10 only.
1108 See a description :ref:`here<amdgpu_synid_abs>`.
1113 See a description :ref:`here<amdgpu_synid_neg>`.
1115 .. _amdgpu_synid_sext:
1120 Sign-extends value of a (sub-dword) operand to fill all 32 bits.
1121 Has no effect for 32-bit operands.
1123 Valid for integer operands only.
1125 ======================================== ================================================
1127 ======================================== ================================================
1128 sext(<operand>) Sign-extend operand value.
1129 ======================================== ================================================
1141 .. _amdgpu_synid_vop3_op_sel:
1146 Selects the low [15:0] or high [31:16] operand bits for source and destination operands.
1147 By default, low bits are used for all operands.
1149 The number of values specified with the op_sel modifier must match the number of instruction
1150 operands (both source and destination). First value controls src0, second value controls src1
1151 and so on, except that the last value controls destination.
1152 The value 0 selects the low bits, while 1 selects the high bits.
1154 Note. op_sel modifier affects 16-bit operands only. For 32-bit operands the value specified
1155 by op_sel must be 0.
1157 GFX9 and GFX10 only.
1159 ======================================== ============================================================
1161 ======================================== ============================================================
1162 op_sel:[{0..1},{0..1}] Select operand bits for instructions with 1 source operand.
1163 op_sel:[{0..1},{0..1},{0..1}] Select operand bits for instructions with 2 source operands.
1164 op_sel:[{0..1},{0..1},{0..1},{0..1}] Select operand bits for instructions with 3 source operands.
1165 ======================================== ============================================================
1174 .. _amdgpu_synid_clamp:
1179 Clamp meaning depends on instruction.
1181 For *v_cmp* instructions, clamp modifier indicates that the compare signals
1182 if a floating point exception occurs. By default, signaling is disabled.
1183 Not supported by GFX7.
1185 For integer operations, clamp modifier indicates that the result must be clamped
1186 to the largest and smallest representable value. By default, there is no clamping.
1187 Integer clamping is not supported by GFX7.
1189 For floating point operations, clamp modifier indicates that the result must be clamped
1190 to the range [0.0, 1.0]. By default, there is no clamping.
1192 Note. Clamp modifier is applied after :ref:`output modifiers<amdgpu_synid_omod>` (if any).
1194 ======================================== ================================================
1196 ======================================== ================================================
1197 clamp Enables clamping (or signaling).
1198 ======================================== ================================================
1200 .. _amdgpu_synid_omod:
1205 Specifies if an output modifier must be applied to the result.
1206 By default, no output modifiers are applied.
1208 Note. Output modifiers are applied before :ref:`clamping<amdgpu_synid_clamp>` (if any).
1210 Output modifiers are valid for f32 and f64 floating point results only.
1211 They must not be used with f16.
1213 Note. *v_cvt_f16_f32* is an exception. This instruction produces f16 result
1214 but accepts output modifiers.
1216 ======================================== ================================================
1218 ======================================== ================================================
1219 mul:2 Multiply the result by 2.
1220 mul:4 Multiply the result by 4.
1221 div:2 Multiply the result by 0.5.
1222 ======================================== ================================================
1224 .. _amdgpu_synid_vop3_operand_modifiers:
1226 VOP3 Operand Modifiers
1227 ----------------------
1229 Operand modifiers are not used separately. They are applied to source operands.
1231 .. _amdgpu_synid_abs:
1236 Computes absolute value of its operand. Applied before :ref:`neg<amdgpu_synid_neg>` (if any).
1237 Valid for floating point operands only.
1239 ======================================== ================================================
1241 ======================================== ================================================
1242 abs(<operand>) Get absolute value of operand.
1243 \|<operand>| The same as above.
1244 ======================================== ================================================
1253 .. _amdgpu_synid_neg:
1258 Computes negative value of its operand. Applied after :ref:`abs<amdgpu_synid_abs>` (if any).
1259 Valid for floating point operands only.
1261 ======================================== ================================================
1263 ======================================== ================================================
1264 neg(<operand>) Get negative value of operand.
1265 -<operand> The same as above.
1266 ======================================== ================================================
1278 This section describes modifiers of *regular* VOP3P instructions.
1280 *v_mad_mix_f32*, *v_mad_mixhi_f16* and *v_mad_mixlo_f16*
1281 instructions use these modifiers :ref:`in a special manner<amdgpu_synid_mad_mix>`.
1283 GFX9 and GFX10 only.
1285 .. _amdgpu_synid_op_sel:
1290 Selects the low [15:0] or high [31:16] operand bits as input to the operation
1291 which results in the lower-half of the destination.
1292 By default, low bits are used for all operands.
1294 The number of values specified by the *op_sel* modifier must match the number of source
1295 operands. First value controls src0, second value controls src1 and so on.
1297 The value 0 selects the low bits, while 1 selects the high bits.
1299 ================================= =============================================================
1301 ================================= =============================================================
1302 op_sel:[{0..1}] Select operand bits for instructions with 1 source operand.
1303 op_sel:[{0..1},{0..1}] Select operand bits for instructions with 2 source operands.
1304 op_sel:[{0..1},{0..1},{0..1}] Select operand bits for instructions with 3 source operands.
1305 ================================= =============================================================
1314 .. _amdgpu_synid_op_sel_hi:
1319 Selects the low [15:0] or high [31:16] operand bits as input to the operation
1320 which results in the upper-half of the destination.
1321 By default, high bits are used for all operands.
1323 The number of values specified by the *op_sel_hi* modifier must match the number of source
1324 operands. First value controls src0, second value controls src1 and so on.
1326 The value 0 selects the low bits, while 1 selects the high bits.
1328 =================================== =============================================================
1330 =================================== =============================================================
1331 op_sel_hi:[{0..1}] Select operand bits for instructions with 1 source operand.
1332 op_sel_hi:[{0..1},{0..1}] Select operand bits for instructions with 2 source operands.
1333 op_sel_hi:[{0..1},{0..1},{0..1}] Select operand bits for instructions with 3 source operands.
1334 =================================== =============================================================
1343 .. _amdgpu_synid_neg_lo:
1348 Specifies whether to change sign of operand values selected by
1349 :ref:`op_sel<amdgpu_synid_op_sel>`. These values are then used
1350 as input to the operation which results in the upper-half of the destination.
1352 The number of values specified by this modifier must match the number of source
1353 operands. First value controls src0, second value controls src1 and so on.
1355 The value 0 indicates that the corresponding operand value is used unmodified,
1356 the value 1 indicates that negative value of the operand must be used.
1358 By default, operand values are used unmodified.
1360 This modifier is valid for floating point operands only.
1362 ================================ ==================================================================
1364 ================================ ==================================================================
1365 neg_lo:[{0..1}] Select affected operands for instructions with 1 source operand.
1366 neg_lo:[{0..1},{0..1}] Select affected operands for instructions with 2 source operands.
1367 neg_lo:[{0..1},{0..1},{0..1}] Select affected operands for instructions with 3 source operands.
1368 ================================ ==================================================================
1377 .. _amdgpu_synid_neg_hi:
1382 Specifies whether to change sign of operand values selected by
1383 :ref:`op_sel_hi<amdgpu_synid_op_sel_hi>`. These values are then used
1384 as input to the operation which results in the upper-half of the destination.
1386 The number of values specified by this modifier must match the number of source
1387 operands. First value controls src0, second value controls src1 and so on.
1389 The value 0 indicates that the corresponding operand value is used unmodified,
1390 the value 1 indicates that negative value of the operand must be used.
1392 By default, operand values are used unmodified.
1394 This modifier is valid for floating point operands only.
1396 =============================== ==================================================================
1398 =============================== ==================================================================
1399 neg_hi:[{0..1}] Select affected operands for instructions with 1 source operand.
1400 neg_hi:[{0..1},{0..1}] Select affected operands for instructions with 2 source operands.
1401 neg_hi:[{0..1},{0..1},{0..1}] Select affected operands for instructions with 3 source operands.
1402 =============================== ==================================================================
1414 See a description :ref:`here<amdgpu_synid_clamp>`.
1416 .. _amdgpu_synid_mad_mix:
1418 VOP3P V_MAD_MIX Modifiers
1419 -------------------------
1421 *v_mad_mix_f32*, *v_mad_mixhi_f16* and *v_mad_mixlo_f16* instructions
1422 use *op_sel* and *op_sel_hi* modifiers
1423 in a manner different from *regular* VOP3P instructions.
1425 See a description below.
1427 GFX9 and GFX10 only.
1429 .. _amdgpu_synid_mad_mix_op_sel:
1434 This operand has meaning only for 16-bit source operands as indicated by
1435 :ref:`m_op_sel_hi<amdgpu_synid_mad_mix_op_sel_hi>`.
1436 It specifies to select either the low [15:0] or high [31:16] operand bits
1437 as input to the operation.
1439 The number of values specified by the *op_sel* modifier must match the number of source
1440 operands. First value controls src0, second value controls src1 and so on.
1442 The value 0 indicates the low bits, the value 1 indicates the high 16 bits.
1444 By default, low bits are used for all operands.
1446 =============================== ================================================
1448 =============================== ================================================
1449 op_sel:[{0..1},{0..1},{0..1}] Select location of each 16-bit source operand.
1450 =============================== ================================================
1458 .. _amdgpu_synid_mad_mix_op_sel_hi:
1463 Selects the size of source operands: either 32 bits or 16 bits.
1464 By default, 32 bits are used for all source operands.
1466 The number of values specified by the *op_sel_hi* modifier must match the number of source
1467 operands. First value controls src0, second value controls src1 and so on.
1469 The value 0 indicates 32 bits, the value 1 indicates 16 bits.
1471 The location of 16 bits in the operand may be specified by
1472 :ref:`m_op_sel<amdgpu_synid_mad_mix_op_sel>`.
1474 ======================================== ====================================
1476 ======================================== ====================================
1477 op_sel_hi:[{0..1},{0..1},{0..1}] Select size of each source operand.
1478 ======================================== ====================================
1489 See a description :ref:`here<amdgpu_synid_abs>`.
1494 See a description :ref:`here<amdgpu_synid_neg>`.
1499 See a description :ref:`here<amdgpu_synid_clamp>`.