1bf215546Sopenharmony_ci<?xml version="1.0" encoding="UTF-8"?>
2bf215546Sopenharmony_ci<!--
3bf215546Sopenharmony_ciCopyright © 2020 Google, Inc.
4bf215546Sopenharmony_ci
5bf215546Sopenharmony_ciPermission is hereby granted, free of charge, to any person obtaining a
6bf215546Sopenharmony_cicopy of this software and associated documentation files (the "Software"),
7bf215546Sopenharmony_cito deal in the Software without restriction, including without limitation
8bf215546Sopenharmony_cithe rights to use, copy, modify, merge, publish, distribute, sublicense,
9bf215546Sopenharmony_ciand/or sell copies of the Software, and to permit persons to whom the
10bf215546Sopenharmony_ciSoftware is furnished to do so, subject to the following conditions:
11bf215546Sopenharmony_ci
12bf215546Sopenharmony_ciThe above copyright notice and this permission notice (including the next
13bf215546Sopenharmony_ciparagraph) shall be included in all copies or substantial portions of the
14bf215546Sopenharmony_ciSoftware.
15bf215546Sopenharmony_ci
16bf215546Sopenharmony_ciTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17bf215546Sopenharmony_ciIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18bf215546Sopenharmony_ciFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19bf215546Sopenharmony_ciTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20bf215546Sopenharmony_ciLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21bf215546Sopenharmony_ciOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22bf215546Sopenharmony_ciSOFTWARE.
23bf215546Sopenharmony_ci -->
24bf215546Sopenharmony_ci
25bf215546Sopenharmony_ci<isa>
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_ci<!--
28bf215546Sopenharmony_ci	Cat5 Instructions: texture instructions
29bf215546Sopenharmony_ci -->
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci<bitset name="#cat5-s2en-bindless-base" size="1">
32bf215546Sopenharmony_ci	<doc>
33bf215546Sopenharmony_ci		The BASE field is actually split across BASE_LO and BASE_HI,
34bf215546Sopenharmony_ci		but '.baseN' should only appear in the bindless case.. the
35bf215546Sopenharmony_ci		easiest way to accomplish that is by splitting it out into a
36bf215546Sopenharmony_ci		bitset.  We just arbitrarily map this to BASE_LO
37bf215546Sopenharmony_ci	</doc>
38bf215546Sopenharmony_ci	<override>
39bf215546Sopenharmony_ci		<expr>{BINDLESS}</expr>
40bf215546Sopenharmony_ci		<display>
41bf215546Sopenharmony_ci			.base{BASE}
42bf215546Sopenharmony_ci		</display>
43bf215546Sopenharmony_ci	</override>
44bf215546Sopenharmony_ci	<display/>
45bf215546Sopenharmony_ci	<field name="BASE_LO" pos="0" type="uint"/>
46bf215546Sopenharmony_ci	<derived name="BASE" type="uint">
47bf215546Sopenharmony_ci		<expr>({BASE_HI} * 2) | {BASE_LO}</expr>
48bf215546Sopenharmony_ci	</derived>
49bf215546Sopenharmony_ci	<encode type="struct ir3_instruction *">
50bf215546Sopenharmony_ci		<map name="BASE_LO">src->cat5.tex_base &amp; 0x1</map>
51bf215546Sopenharmony_ci	</encode>
52bf215546Sopenharmony_ci</bitset>
53bf215546Sopenharmony_ci
54bf215546Sopenharmony_ci<bitset name="#instruction-cat5" extends="#instruction">
55bf215546Sopenharmony_ci	<doc>
56bf215546Sopenharmony_ci		The "normal" case, ie. not s2en (indirect) and/or bindless
57bf215546Sopenharmony_ci	</doc>
58bf215546Sopenharmony_ci	<display>
59bf215546Sopenharmony_ci		{SY}{JP}{NAME}{3D}{A}{O}{P}{S} {TYPE}({WRMASK}){DST_HALF}{DST}{SRC1}{SRC2}{SAMP}{TEX}
60bf215546Sopenharmony_ci	</display>
61bf215546Sopenharmony_ci	<derived name="DST_HALF" expr="#type-half" type="bool" display="h"/>
62bf215546Sopenharmony_ci	<field name="FULL" pos="0" type="bool"/>
63bf215546Sopenharmony_ci	<derived name="HALF" expr="#multisrc-half" type="bool" display="h"/>
64bf215546Sopenharmony_ci	<field name="SRC1" low="1" high="8" type="#cat5-src1">
65bf215546Sopenharmony_ci		<param name="NUM_SRC"/>
66bf215546Sopenharmony_ci		<param name="HALF"/>
67bf215546Sopenharmony_ci	</field>
68bf215546Sopenharmony_ci	<field name="SRC2" low="9" high="16" type="#cat5-src2">
69bf215546Sopenharmony_ci		<param name="NUM_SRC"/>
70bf215546Sopenharmony_ci		<param name="HALF"/>
71bf215546Sopenharmony_ci		<param name="O"/>
72bf215546Sopenharmony_ci	</field>
73bf215546Sopenharmony_ci	<!--
74bf215546Sopenharmony_ci		TODO remainder of first 32b differ depending on s2en/bindless..
75bf215546Sopenharmony_ci		possibly use overrides?  Need to sort-out how to display..
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_ci		Note b17 seems to show up in some blob traces (samgpN), need
78bf215546Sopenharmony_ci		to figure out what this bit does
79bf215546Sopenharmony_ci	 -->
80bf215546Sopenharmony_ci	<pattern low="17" high="18">0x</pattern>
81bf215546Sopenharmony_ci
82bf215546Sopenharmony_ci	<field name="SAMP" low="21" high="24" type="#cat5-samp">
83bf215546Sopenharmony_ci		<param name="HAS_SAMP"/>
84bf215546Sopenharmony_ci	</field>
85bf215546Sopenharmony_ci	<field name="TEX" low="25" high="31" type="#cat5-tex">
86bf215546Sopenharmony_ci		<param name="HAS_TEX"/>
87bf215546Sopenharmony_ci	</field>
88bf215546Sopenharmony_ci
89bf215546Sopenharmony_ci	<field name="DST" low="32" high="39" type="#reg-gpr"/>
90bf215546Sopenharmony_ci	<field name="WRMASK" low="40" high="43" type="#wrmask"/>
91bf215546Sopenharmony_ci	<field name="TYPE" low="44" high="46" type="#cat5-type">
92bf215546Sopenharmony_ci		<param name="HAS_TYPE"/>
93bf215546Sopenharmony_ci	</field>
94bf215546Sopenharmony_ci	<assert pos="47">0</assert>    <!-- BASE_LO -->
95bf215546Sopenharmony_ci	<field name="3D" pos="48" type="bool" display=".3d"/>
96bf215546Sopenharmony_ci	<field name="A" pos="49" type="bool" display=".a"/>
97bf215546Sopenharmony_ci	<field name="S" pos="50" type="bool" display=".s"/>
98bf215546Sopenharmony_ci	<field name="S2EN_BINDLESS" pos="51" type="bool"/>
99bf215546Sopenharmony_ci	<field name="O" pos="52" type="bool" display=".o"/>
100bf215546Sopenharmony_ci	<!-- OPC -->
101bf215546Sopenharmony_ci	<field name="JP" pos="59" type="bool" display="(jp)"/>
102bf215546Sopenharmony_ci	<field name="SY" pos="60" type="bool" display="(sy)"/>
103bf215546Sopenharmony_ci	<pattern low="61" high="63">101</pattern>  <!-- cat5 -->
104bf215546Sopenharmony_ci	<encode>
105bf215546Sopenharmony_ci		<map name="FULL">extract_cat5_FULL(src)</map>
106bf215546Sopenharmony_ci		<map name="TEX">src</map>
107bf215546Sopenharmony_ci		<map name="SAMP">src</map>
108bf215546Sopenharmony_ci		<map name="WRMASK">src->dsts[0]->wrmask</map>
109bf215546Sopenharmony_ci		<map name="BASE">src</map>
110bf215546Sopenharmony_ci		<map name="TYPE">src</map>
111bf215546Sopenharmony_ci		<map name="BASE_HI">src->cat5.tex_base >> 1</map>
112bf215546Sopenharmony_ci		<map name="3D">!!(src->flags &amp; IR3_INSTR_3D)</map>
113bf215546Sopenharmony_ci		<map name="A">!!(src->flags &amp; IR3_INSTR_A)</map>
114bf215546Sopenharmony_ci		<map name="S">!!(src->flags &amp; IR3_INSTR_S)</map>
115bf215546Sopenharmony_ci		<map name="S2EN_BINDLESS">!!(src->flags &amp; (IR3_INSTR_S2EN | IR3_INSTR_B))</map>
116bf215546Sopenharmony_ci		<map name="O">!!(src->flags &amp; IR3_INSTR_O)</map>
117bf215546Sopenharmony_ci		<map name="DESC_MODE">extract_cat5_DESC_MODE(src)</map>
118bf215546Sopenharmony_ci		<!--
119bf215546Sopenharmony_ci			TODO the src order is currently a bit messy due to ir3 using srcs[0]
120bf215546Sopenharmony_ci			for s2en src in the s2en case
121bf215546Sopenharmony_ci		 -->
122bf215546Sopenharmony_ci		<map name="SRC1">extract_cat5_SRC(src, 0)</map>
123bf215546Sopenharmony_ci		<map name="SRC2">extract_cat5_SRC(src, 1)</map>
124bf215546Sopenharmony_ci		<map name="SRC3">(src->srcs_count > 0) ? src->srcs[0] : NULL</map>
125bf215546Sopenharmony_ci	</encode>
126bf215546Sopenharmony_ci</bitset>
127bf215546Sopenharmony_ci
128bf215546Sopenharmony_ci<bitset name="#instruction-cat5-tex" extends="#instruction-cat5">
129bf215546Sopenharmony_ci	<override>
130bf215546Sopenharmony_ci		<expr>{S2EN_BINDLESS}</expr>
131bf215546Sopenharmony_ci		<doc>
132bf215546Sopenharmony_ci			The s2en (indirect) or bindless case
133bf215546Sopenharmony_ci		</doc>
134bf215546Sopenharmony_ci		<display>
135bf215546Sopenharmony_ci			{SY}{JP}{NAME}{3D}{A}{O}{P}{S}{S2EN}{UNIFORM}{NONUNIFORM}{BASE} {TYPE}({WRMASK}){DST_HALF}{DST}{SRC1}{SRC2}{SRC3}{A1}
136bf215546Sopenharmony_ci		</display>
137bf215546Sopenharmony_ci		<field name="BASE_HI" low="19" high="20" type="uint"/>
138bf215546Sopenharmony_ci		<field name="SRC3" low="21" high="28" type="#cat5-src3">
139bf215546Sopenharmony_ci			<param name="BINDLESS"/>
140bf215546Sopenharmony_ci			<param name="DESC_MODE"/>
141bf215546Sopenharmony_ci			<param name="HAS_SAMP"/>
142bf215546Sopenharmony_ci			<param name="HAS_TEX"/>
143bf215546Sopenharmony_ci		</field>
144bf215546Sopenharmony_ci		<field name="DESC_MODE" low="29" high="31" type="#cat5-s2en-bindless-desc-mode"/>
145bf215546Sopenharmony_ci		<field name="BASE" pos="47" type="#cat5-s2en-bindless-base">
146bf215546Sopenharmony_ci			<param name="BINDLESS"/>
147bf215546Sopenharmony_ci			<param name="BASE_HI"/>
148bf215546Sopenharmony_ci		</field>
149bf215546Sopenharmony_ci		<derived name="BINDLESS" expr="#cat5-s2enb-is-bindless" type="bool"/>
150bf215546Sopenharmony_ci		<derived name="S2EN" expr="#cat5-s2enb-is-indirect" type="bool" display=".s2en"/>
151bf215546Sopenharmony_ci		<derived name="UNIFORM" expr="#cat5-s2enb-is-uniform" type="bool" display=".uniform"/>
152bf215546Sopenharmony_ci		<derived name="NONUNIFORM" expr="#cat5-s2enb-is-nonuniform" type="bool" display=".nonuniform"/>
153bf215546Sopenharmony_ci		<derived name="A1" expr="#cat5-s2enb-uses_a1" type="bool" display=", a1.x"/>
154bf215546Sopenharmony_ci	</override>
155bf215546Sopenharmony_ci
156bf215546Sopenharmony_ci	<assert low="19" high="20">00</assert>   <!-- BASE_HI -->
157bf215546Sopenharmony_ci	<field name="P" pos="53" type="bool" display=".p"/>
158bf215546Sopenharmony_ci
159bf215546Sopenharmony_ci	<encode>
160bf215546Sopenharmony_ci		<map name="P">!!(src->flags &amp; IR3_INSTR_P)</map>
161bf215546Sopenharmony_ci	</encode>
162bf215546Sopenharmony_ci</bitset>
163bf215546Sopenharmony_ci
164bf215546Sopenharmony_ci<bitset name="isam" extends="#instruction-cat5-tex">
165bf215546Sopenharmony_ci	<pattern low="54" high="58">00000</pattern>
166bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
167bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
168bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
169bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
170bf215546Sopenharmony_ci</bitset>
171bf215546Sopenharmony_ci
172bf215546Sopenharmony_ci<bitset name="isaml" extends="#instruction-cat5-tex">
173bf215546Sopenharmony_ci	<pattern low="54" high="58">00001</pattern>
174bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#two" type="uint"/>
175bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
176bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
177bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
178bf215546Sopenharmony_ci</bitset>
179bf215546Sopenharmony_ci
180bf215546Sopenharmony_ci<bitset name="isamm" extends="#instruction-cat5-tex">
181bf215546Sopenharmony_ci	<pattern low="54" high="58">00010</pattern>
182bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
183bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
184bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
185bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
186bf215546Sopenharmony_ci</bitset>
187bf215546Sopenharmony_ci
188bf215546Sopenharmony_ci<bitset name="sam" extends="#instruction-cat5-tex">
189bf215546Sopenharmony_ci	<pattern low="54" high="58">00011</pattern>
190bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
191bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
192bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
193bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
194bf215546Sopenharmony_ci</bitset>
195bf215546Sopenharmony_ci
196bf215546Sopenharmony_ci<bitset name="samb" extends="#instruction-cat5-tex">
197bf215546Sopenharmony_ci	<pattern low="54" high="58">00100</pattern>
198bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#two" type="uint"/>
199bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
200bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
201bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
202bf215546Sopenharmony_ci</bitset>
203bf215546Sopenharmony_ci
204bf215546Sopenharmony_ci<bitset name="saml" extends="#instruction-cat5-tex">
205bf215546Sopenharmony_ci	<pattern low="54" high="58">00101</pattern>
206bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#two" type="uint"/>
207bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
208bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
209bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
210bf215546Sopenharmony_ci</bitset>
211bf215546Sopenharmony_ci
212bf215546Sopenharmony_ci<bitset name="samgq" extends="#instruction-cat5-tex">
213bf215546Sopenharmony_ci	<pattern low="54" high="58">00110</pattern>
214bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
215bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
216bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
217bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
218bf215546Sopenharmony_ci</bitset>
219bf215546Sopenharmony_ci
220bf215546Sopenharmony_ci<bitset name="getlod" extends="#instruction-cat5-tex">
221bf215546Sopenharmony_ci	<pattern low="54" high="58">00111</pattern>
222bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
223bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
224bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
225bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
226bf215546Sopenharmony_ci</bitset>
227bf215546Sopenharmony_ci
228bf215546Sopenharmony_ci<bitset name="conv" extends="#instruction-cat5-tex">
229bf215546Sopenharmony_ci	<pattern low="54" high="58">01000</pattern>
230bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#two" type="uint"/>
231bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
232bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
233bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
234bf215546Sopenharmony_ci</bitset>
235bf215546Sopenharmony_ci
236bf215546Sopenharmony_ci<bitset name="convm" extends="#instruction-cat5-tex">
237bf215546Sopenharmony_ci	<pattern low="54" high="58">01001</pattern>
238bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#two" type="uint"/>
239bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
240bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
241bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
242bf215546Sopenharmony_ci</bitset>
243bf215546Sopenharmony_ci
244bf215546Sopenharmony_ci<bitset name="getsize" extends="#instruction-cat5-tex">
245bf215546Sopenharmony_ci	<pattern low="54" high="58">01010</pattern>
246bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
247bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
248bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
249bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
250bf215546Sopenharmony_ci</bitset>
251bf215546Sopenharmony_ci
252bf215546Sopenharmony_ci<bitset name="getbuf" extends="#instruction-cat5-tex">
253bf215546Sopenharmony_ci	<pattern low="54" high="58">01011</pattern>
254bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#zero" type="uint"/>
255bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
256bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
257bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
258bf215546Sopenharmony_ci</bitset>
259bf215546Sopenharmony_ci
260bf215546Sopenharmony_ci<bitset name="getpos" extends="#instruction-cat5-tex">
261bf215546Sopenharmony_ci	<pattern low="54" high="58">01100</pattern>
262bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
263bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
264bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
265bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
266bf215546Sopenharmony_ci</bitset>
267bf215546Sopenharmony_ci
268bf215546Sopenharmony_ci<bitset name="getinfo" extends="#instruction-cat5-tex">
269bf215546Sopenharmony_ci	<doc>
270bf215546Sopenharmony_ci		GETINFO returns 4 values, in .xyzw:
271bf215546Sopenharmony_ci
272bf215546Sopenharmony_ci		x: A value associated with the channel type, i.e. OpenCL's
273bf215546Sopenharmony_ci		   get_image_channel_data_type:
274bf215546Sopenharmony_ci
275bf215546Sopenharmony_ci		   The below was RE'd on A420 and confirmed with the
276bf215546Sopenharmony_ci		   blob's headers.
277bf215546Sopenharmony_ci
278bf215546Sopenharmony_ci		   8_SNORM:	     0 (CLK_SNORM_INT8)
279bf215546Sopenharmony_ci		   16_SNORM:	     1 (CLK_SNORM_INT16)
280bf215546Sopenharmony_ci		   8_UNORM:	     2 (CLK_UNORM_INT8)
281bf215546Sopenharmony_ci		   16_UNORM:	     3 (CLK_UNORM_INT16)
282bf215546Sopenharmony_ci		   5_6_5_UNORM:	     4 (CLK_UNORM_SHORT_565)
283bf215546Sopenharmony_ci		   5_5_5_1_UNORM:    5 (CLK_UNORM_SHORT_555)
284bf215546Sopenharmony_ci		   10_10_10_2_UNORM: 6 (CLK_UNORM_INT_101010, CLK_UNORM_SHORT_101010)
285bf215546Sopenharmony_ci		   8_SINT:	     7 (CLK_SIGNED_INT8)
286bf215546Sopenharmony_ci		   16_SINT:	     8 (CLK_SIGNED_INT16)
287bf215546Sopenharmony_ci		   32_SINT:	     9 (CLK_SIGNED_INT32)
288bf215546Sopenharmony_ci		   8_UINT:	    10 (CLK_UNSIGNED_INT8)
289bf215546Sopenharmony_ci		   16_UINT:	    11 (CLK_UNSIGNED_INT16)
290bf215546Sopenharmony_ci		   32_UINT:	    12 (CLK_UNSIGNED_INT32)
291bf215546Sopenharmony_ci		   16_FLOAT:	    13 (CLK_HALF_FLOAT)
292bf215546Sopenharmony_ci		   32_FLOAT:	    14 (CLK_FLOAT)
293bf215546Sopenharmony_ci		   9_9_9_E5_FLOAT:  15 (CLK_FLOAT_10F_11F_11F)
294bf215546Sopenharmony_ci		   11_11_10_FLOAT:  15 (CLK_FLOAT_10F_11F_11F)
295bf215546Sopenharmony_ci		   10_10_10_2_UINT: 16 (CLK_UNSIGNED_SHORT_101010)
296bf215546Sopenharmony_ci		   4_4_4_4_UNORM:   17 (CLK_UNORM_INT4)
297bf215546Sopenharmony_ci		   X8Z24_UNORM:	    18 (CLK_UNORM_INT32)
298bf215546Sopenharmony_ci
299bf215546Sopenharmony_ci		y: A value associated with the number of components
300bf215546Sopenharmony_ci		   and swizzle, i.e. OpenCL's get_image_channel_order:
301bf215546Sopenharmony_ci
302bf215546Sopenharmony_ci		   The below was largely taken from the blob's headers.
303bf215546Sopenharmony_ci
304bf215546Sopenharmony_ci		   A3xx/A4xx:
305bf215546Sopenharmony_ci
306bf215546Sopenharmony_ci		   0:  CLK_A
307bf215546Sopenharmony_ci		   1:  CLK_R
308bf215546Sopenharmony_ci		   2:  CLK_Rx
309bf215546Sopenharmony_ci		   3:  CLK_RG
310bf215546Sopenharmony_ci		   4:  CLK_RGx
311bf215546Sopenharmony_ci		   5:  CLK_RA
312bf215546Sopenharmony_ci		   6:  CLK_RGB
313bf215546Sopenharmony_ci		   7:  CLK_RGBx
314bf215546Sopenharmony_ci		   8:  CLK_RGBA
315bf215546Sopenharmony_ci		   9:  CLK_ARGB
316bf215546Sopenharmony_ci		   10: CLK_BGRA
317bf215546Sopenharmony_ci		   11: CLK_LUMINANCE
318bf215546Sopenharmony_ci		   12: CLK_INTENSITY
319bf215546Sopenharmony_ci		   13: CLK_ABGR
320bf215546Sopenharmony_ci		   14: CLK_BGR
321bf215546Sopenharmony_ci		   15: CLK_sRGB
322bf215546Sopenharmony_ci		   16: CLK_sRGBA
323bf215546Sopenharmony_ci		   17: CLK_DEPTH
324bf215546Sopenharmony_ci
325bf215546Sopenharmony_ci		   A5xx/A6xx:
326bf215546Sopenharmony_ci
327bf215546Sopenharmony_ci		   0:  CLK_A
328bf215546Sopenharmony_ci		   1:  CLK_R
329bf215546Sopenharmony_ci		   2:  CLK_RX
330bf215546Sopenharmony_ci		   3:  CLK_RG
331bf215546Sopenharmony_ci		   4:  CLK_RGX
332bf215546Sopenharmony_ci		   5:  CLK_RA
333bf215546Sopenharmony_ci		   6:  CLK_RGB
334bf215546Sopenharmony_ci		   7:  CLK_RGBX
335bf215546Sopenharmony_ci		   8:  CLK_RGBA
336bf215546Sopenharmony_ci		   9:  CLK_ARGB
337bf215546Sopenharmony_ci		   10: CLK_BGRA
338bf215546Sopenharmony_ci		   11: CLK_INTENSITY
339bf215546Sopenharmony_ci		   12: CLK_LUMINANCE
340bf215546Sopenharmony_ci		   13: CLK_ABGR
341bf215546Sopenharmony_ci		   14: CLK_DEPTH
342bf215546Sopenharmony_ci		   15: CLK_sRGB
343bf215546Sopenharmony_ci		   16: CLK_sRGBx
344bf215546Sopenharmony_ci		   17: CLK_sRGBA
345bf215546Sopenharmony_ci		   18: CLK_sBGRA
346bf215546Sopenharmony_ci		   19: CLK_sARGB
347bf215546Sopenharmony_ci		   20: CLK_sABGR
348bf215546Sopenharmony_ci		   21: CLK_BGR
349bf215546Sopenharmony_ci
350bf215546Sopenharmony_ci		z: Number of levels
351bf215546Sopenharmony_ci
352bf215546Sopenharmony_ci		w: Number of samples
353bf215546Sopenharmony_ci	</doc>
354bf215546Sopenharmony_ci	<pattern low="54" high="58">01101</pattern>
355bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#zero" type="uint"/>
356bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
357bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
358bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
359bf215546Sopenharmony_ci</bitset>
360bf215546Sopenharmony_ci
361bf215546Sopenharmony_ci<bitset name="dsx" extends="#instruction-cat5-tex">
362bf215546Sopenharmony_ci	<pattern low="54" high="58">01110</pattern>
363bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
364bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
365bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#false" type="bool"/>
366bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
367bf215546Sopenharmony_ci</bitset>
368bf215546Sopenharmony_ci
369bf215546Sopenharmony_ci<bitset name="dsy" extends="#instruction-cat5-tex">
370bf215546Sopenharmony_ci	<pattern low="54" high="58">01111</pattern>
371bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
372bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
373bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#false" type="bool"/>
374bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
375bf215546Sopenharmony_ci</bitset>
376bf215546Sopenharmony_ci
377bf215546Sopenharmony_ci<bitset name="gather4r" extends="#instruction-cat5-tex">
378bf215546Sopenharmony_ci	<pattern low="54" high="58">10000</pattern>
379bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
380bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
381bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
382bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
383bf215546Sopenharmony_ci</bitset>
384bf215546Sopenharmony_ci
385bf215546Sopenharmony_ci<bitset name="gather4g" extends="#instruction-cat5-tex">
386bf215546Sopenharmony_ci	<pattern low="54" high="58">10001</pattern>
387bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
388bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
389bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
390bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
391bf215546Sopenharmony_ci</bitset>
392bf215546Sopenharmony_ci
393bf215546Sopenharmony_ci<bitset name="gather4b" extends="#instruction-cat5-tex">
394bf215546Sopenharmony_ci	<pattern low="54" high="58">10010</pattern>
395bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
396bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
397bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
398bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
399bf215546Sopenharmony_ci</bitset>
400bf215546Sopenharmony_ci
401bf215546Sopenharmony_ci<bitset name="gather4a" extends="#instruction-cat5-tex">
402bf215546Sopenharmony_ci	<pattern low="54" high="58">10011</pattern>
403bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
404bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
405bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
406bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
407bf215546Sopenharmony_ci</bitset>
408bf215546Sopenharmony_ci
409bf215546Sopenharmony_ci<bitset name="samgp0" extends="#instruction-cat5-tex">
410bf215546Sopenharmony_ci	<pattern low="54" high="58">10100</pattern>
411bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
412bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
413bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
414bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
415bf215546Sopenharmony_ci</bitset>
416bf215546Sopenharmony_ci
417bf215546Sopenharmony_ci<bitset name="samgp1" extends="#instruction-cat5-tex">
418bf215546Sopenharmony_ci	<pattern low="54" high="58">10101</pattern>
419bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
420bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
421bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
422bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
423bf215546Sopenharmony_ci</bitset>
424bf215546Sopenharmony_ci
425bf215546Sopenharmony_ci<bitset name="samgp2" extends="#instruction-cat5-tex">
426bf215546Sopenharmony_ci	<pattern low="54" high="58">10110</pattern>
427bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
428bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
429bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
430bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
431bf215546Sopenharmony_ci</bitset>
432bf215546Sopenharmony_ci
433bf215546Sopenharmony_ci<bitset name="samgp3" extends="#instruction-cat5-tex">
434bf215546Sopenharmony_ci	<pattern low="54" high="58">10111</pattern>
435bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
436bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#true" type="bool"/>
437bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#true" type="bool"/>
438bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
439bf215546Sopenharmony_ci</bitset>
440bf215546Sopenharmony_ci
441bf215546Sopenharmony_ci<bitset name="dsxpp.1" extends="#instruction-cat5-tex">
442bf215546Sopenharmony_ci	<pattern low="54" high="58">11000</pattern>
443bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
444bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
445bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#false" type="bool"/>
446bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#false" type="bool"/>
447bf215546Sopenharmony_ci</bitset>
448bf215546Sopenharmony_ci
449bf215546Sopenharmony_ci<bitset name="dsypp.1" extends="#instruction-cat5-tex">
450bf215546Sopenharmony_ci	<pattern low="54" high="58">11001</pattern>
451bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
452bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
453bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#false" type="bool"/>
454bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#false" type="bool"/>
455bf215546Sopenharmony_ci</bitset>
456bf215546Sopenharmony_ci
457bf215546Sopenharmony_ci<bitset name="rgetpos" extends="#instruction-cat5-tex">
458bf215546Sopenharmony_ci	<pattern low="54" high="58">11010</pattern>
459bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
460bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
461bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#false" type="bool"/>
462bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
463bf215546Sopenharmony_ci</bitset>
464bf215546Sopenharmony_ci
465bf215546Sopenharmony_ci<bitset name="rgetinfo" extends="#instruction-cat5-tex">
466bf215546Sopenharmony_ci	<pattern low="54" high="58">11011</pattern>
467bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#zero" type="uint"/>
468bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
469bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#false" type="bool"/>
470bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
471bf215546Sopenharmony_ci</bitset>
472bf215546Sopenharmony_ci
473bf215546Sopenharmony_ci<bitset name="brcst.active" extends="#instruction-cat5">
474bf215546Sopenharmony_ci	<doc>
475bf215546Sopenharmony_ci		The subgroup is divided into (subgroup_size / CLUSTER_SIZE)
476bf215546Sopenharmony_ci		clusters. For each cluster brcst.active.w does:
477bf215546Sopenharmony_ci
478bf215546Sopenharmony_ci		Given a cluster of fibers f_0, f_1, ..., f_{CLUSTER_SIZE-1} brcst
479bf215546Sopenharmony_ci		broadcasts the SRC value from the fiber f_{CLUSTER_SIZE/2-1}
480bf215546Sopenharmony_ci		to fibers f_{CLUSTER_SIZE/2}, ..., f_{CLUSTER_SIZE-1}. The DST reg
481bf215546Sopenharmony_ci		in other fibers is unaffected. If fiber f_{CLUSTER_SIZE/2-1} is
482bf215546Sopenharmony_ci		inactive the value to broadcast is taken from lower fibers
483bf215546Sopenharmony_ci		f_{CLUSTER_SIZE/2-2}, f_{CLUSTER_SIZE/2-3}, ...
484bf215546Sopenharmony_ci		If all fibers f_0, f_1, ..., f_{CLUSTER_SIZE/2-1} are inactive
485bf215546Sopenharmony_ci		the DST reg remains unchanged for all fibers.
486bf215546Sopenharmony_ci
487bf215546Sopenharmony_ci		It is necessary in order to implement arithmetic subgroup
488bf215546Sopenharmony_ci		operations with prefix sum (https://en.wikipedia.org/wiki/Prefix_sum).
489bf215546Sopenharmony_ci
490bf215546Sopenharmony_ci		For brcst.active.w8 without inactive fibers:
491bf215546Sopenharmony_ci			Fiber      | 0  1  2  3  4  5  6  7  | 8  9  10  11  12  13  14  15
492bf215546Sopenharmony_ci			SRC        | s0 s1 s2 s3 ...      s7 | s8  ...   s11 ...         s15
493bf215546Sopenharmony_ci			DST_before | d0 d1       ...      d7 | d8  ...                   d15
494bf215546Sopenharmony_ci			DST_after  | d0 d1 d2 d3 s3 s3 s3 s3 | d8  ...   d11 s11 s11 s11 s11
495bf215546Sopenharmony_ci
496bf215546Sopenharmony_ci		If fibers 2 and 3 are inactive:
497bf215546Sopenharmony_ci			Fiber      | 0  1  X  X  4  5  6  7  | ...
498bf215546Sopenharmony_ci			SRC        | s0 s1 X  X  ...      s7 | ...
499bf215546Sopenharmony_ci			DST_before | d0 d1       ...      d7 | ...
500bf215546Sopenharmony_ci			DST_after  | d0 d1 X  X  s1 s1 s1 s1 | ...
501bf215546Sopenharmony_ci	</doc>
502bf215546Sopenharmony_ci
503bf215546Sopenharmony_ci	<gen min="600"/>
504bf215546Sopenharmony_ci
505bf215546Sopenharmony_ci	<display>
506bf215546Sopenharmony_ci		{SY}{JP}{NAME}.w{CLUSTER_SIZE} {TYPE}({WRMASK}){DST_HALF}{DST}{SRC1}
507bf215546Sopenharmony_ci	</display>
508bf215546Sopenharmony_ci
509bf215546Sopenharmony_ci	<field name="W" low="19" high="20" type="uint"/>
510bf215546Sopenharmony_ci	<pattern low="53" high="58">111110</pattern> <!-- OPC -->
511bf215546Sopenharmony_ci
512bf215546Sopenharmony_ci	<derived name="CLUSTER_SIZE" type="uint">
513bf215546Sopenharmony_ci		<expr>
514bf215546Sopenharmony_ci			2 &lt;&lt; {W}
515bf215546Sopenharmony_ci		</expr>
516bf215546Sopenharmony_ci	</derived>
517bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
518bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
519bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#false" type="bool"/>
520bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
521bf215546Sopenharmony_ci
522bf215546Sopenharmony_ci	<encode>
523bf215546Sopenharmony_ci		<map name="W">util_logbase2(src->cat5.cluster_size) - 1</map>
524bf215546Sopenharmony_ci	</encode>
525bf215546Sopenharmony_ci</bitset>
526bf215546Sopenharmony_ci
527bf215546Sopenharmony_ci<bitset name="#instruction-cat5-quad-shuffle" extends="#instruction-cat5">
528bf215546Sopenharmony_ci	<gen min="600"/>
529bf215546Sopenharmony_ci
530bf215546Sopenharmony_ci	<display>
531bf215546Sopenharmony_ci		{SY}{JP}{NAME} {TYPE}({WRMASK}){DST_HALF}{DST}{SRC1}{SRC2}
532bf215546Sopenharmony_ci	</display>
533bf215546Sopenharmony_ci
534bf215546Sopenharmony_ci	<pattern low="53" high="58">111111</pattern> <!-- OPC -->
535bf215546Sopenharmony_ci
536bf215546Sopenharmony_ci	<derived name="HAS_SAMP" expr="#false" type="bool"/>
537bf215546Sopenharmony_ci	<derived name="HAS_TEX" expr="#false" type="bool"/>
538bf215546Sopenharmony_ci	<derived name="HAS_TYPE" expr="#true" type="bool"/>
539bf215546Sopenharmony_ci</bitset>
540bf215546Sopenharmony_ci
541bf215546Sopenharmony_ci<bitset name="quad_shuffle.brcst" extends="#instruction-cat5-quad-shuffle">
542bf215546Sopenharmony_ci	<doc>subgroupQuadBroadcast</doc>
543bf215546Sopenharmony_ci
544bf215546Sopenharmony_ci	<pattern low="19" high="20">00</pattern>   <!-- Quad-shuffle variant -->
545bf215546Sopenharmony_ci
546bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#two" type="uint"/>
547bf215546Sopenharmony_ci</bitset>
548bf215546Sopenharmony_ci
549bf215546Sopenharmony_ci<bitset name="quad_shuffle.horiz" extends="#instruction-cat5-quad-shuffle">
550bf215546Sopenharmony_ci	<doc>subgroupQuadSwapHorizontal</doc>
551bf215546Sopenharmony_ci
552bf215546Sopenharmony_ci	<pattern low="19" high="20">01</pattern>   <!-- Quad-shuffle variant -->
553bf215546Sopenharmony_ci
554bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
555bf215546Sopenharmony_ci</bitset>
556bf215546Sopenharmony_ci
557bf215546Sopenharmony_ci<bitset name="quad_shuffle.vert" extends="#instruction-cat5-quad-shuffle">
558bf215546Sopenharmony_ci	<doc>subgroupQuadSwapVertical</doc>
559bf215546Sopenharmony_ci
560bf215546Sopenharmony_ci	<pattern low="19" high="20">10</pattern>   <!-- Quad-shuffle variant -->
561bf215546Sopenharmony_ci
562bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
563bf215546Sopenharmony_ci</bitset>
564bf215546Sopenharmony_ci
565bf215546Sopenharmony_ci<bitset name="quad_shuffle.diag" extends="#instruction-cat5-quad-shuffle">
566bf215546Sopenharmony_ci	<doc>subgroupQuadSwapDiagonal</doc>
567bf215546Sopenharmony_ci
568bf215546Sopenharmony_ci	<pattern low="19" high="20">11</pattern>   <!-- Quad-shuffle variant -->
569bf215546Sopenharmony_ci
570bf215546Sopenharmony_ci	<derived name="NUM_SRC" expr="#one" type="uint"/>
571bf215546Sopenharmony_ci</bitset>
572bf215546Sopenharmony_ci
573bf215546Sopenharmony_ci<!--
574bf215546Sopenharmony_ci	All the magic for conditionally displaying various srcs, etc
575bf215546Sopenharmony_ci	for the non-bindless / non-indirect case, or things that are in
576bf215546Sopenharmony_ci	common with the bindless / indirect case
577bf215546Sopenharmony_ci -->
578bf215546Sopenharmony_ci
579bf215546Sopenharmony_ci<bitset name="#cat5-src1" size="8">
580bf215546Sopenharmony_ci	<override>
581bf215546Sopenharmony_ci		<expr>{NUM_SRC} > 0</expr>
582bf215546Sopenharmony_ci		<display>
583bf215546Sopenharmony_ci			, {HALF}{SRC}
584bf215546Sopenharmony_ci		</display>
585bf215546Sopenharmony_ci		<field name="SRC" low="0" high="7" type="#reg-gpr"/>
586bf215546Sopenharmony_ci	</override>
587bf215546Sopenharmony_ci	<display/>
588bf215546Sopenharmony_ci	<assert low="0" high="7">00000000</assert>
589bf215546Sopenharmony_ci	<encode type="struct ir3_register *">
590bf215546Sopenharmony_ci		<map name="SRC">src</map>
591bf215546Sopenharmony_ci	</encode>
592bf215546Sopenharmony_ci</bitset>
593bf215546Sopenharmony_ci
594bf215546Sopenharmony_ci<bitset name="#cat5-src2" size="8">
595bf215546Sopenharmony_ci	<override>
596bf215546Sopenharmony_ci		<expr>{O} || ({NUM_SRC} > 1)</expr>
597bf215546Sopenharmony_ci		<display>
598bf215546Sopenharmony_ci			, {HALF}{SRC}
599bf215546Sopenharmony_ci		</display>
600bf215546Sopenharmony_ci		<field name="SRC" low="0" high="7" type="#reg-gpr"/>
601bf215546Sopenharmony_ci	</override>
602bf215546Sopenharmony_ci	<display/>
603bf215546Sopenharmony_ci	<assert low="0" high="7">00000000</assert>
604bf215546Sopenharmony_ci	<encode type="struct ir3_register *">
605bf215546Sopenharmony_ci		<map name="SRC">src</map>
606bf215546Sopenharmony_ci	</encode>
607bf215546Sopenharmony_ci</bitset>
608bf215546Sopenharmony_ci
609bf215546Sopenharmony_ci<bitset name="#cat5-samp" size="4">
610bf215546Sopenharmony_ci	<override>
611bf215546Sopenharmony_ci		<expr>{HAS_SAMP}</expr>
612bf215546Sopenharmony_ci		<display>
613bf215546Sopenharmony_ci			, s#{SAMP}
614bf215546Sopenharmony_ci		</display>
615bf215546Sopenharmony_ci		<field name="SAMP" low="0" high="3" type="uint"/>
616bf215546Sopenharmony_ci	</override>
617bf215546Sopenharmony_ci	<display/>
618bf215546Sopenharmony_ci	<assert low="0" high="3">0000</assert>
619bf215546Sopenharmony_ci	<encode type="struct ir3_instruction *">
620bf215546Sopenharmony_ci		<map name="SAMP">src->cat5.samp</map>
621bf215546Sopenharmony_ci	</encode>
622bf215546Sopenharmony_ci</bitset>
623bf215546Sopenharmony_ci
624bf215546Sopenharmony_ci<bitset name="#cat5-samp-s2en-bindless-a1" size="8">
625bf215546Sopenharmony_ci	<doc>s2en (indirect) / bindless case with a1.x has 8b samp</doc>
626bf215546Sopenharmony_ci	<override>
627bf215546Sopenharmony_ci		<expr>{HAS_SAMP}</expr>
628bf215546Sopenharmony_ci		<display>
629bf215546Sopenharmony_ci			, s#{SAMP}
630bf215546Sopenharmony_ci		</display>
631bf215546Sopenharmony_ci		<field name="SAMP" low="0" high="7" type="uint"/>
632bf215546Sopenharmony_ci	</override>
633bf215546Sopenharmony_ci	<display/>
634bf215546Sopenharmony_ci	<assert low="0" high="7">00000000</assert>
635bf215546Sopenharmony_ci	<encode type="struct ir3_instruction *">
636bf215546Sopenharmony_ci		<map name="SAMP">src->cat5.samp</map>
637bf215546Sopenharmony_ci	</encode>
638bf215546Sopenharmony_ci</bitset>
639bf215546Sopenharmony_ci
640bf215546Sopenharmony_ci<bitset name="#cat5-tex" size="7">
641bf215546Sopenharmony_ci	<override>
642bf215546Sopenharmony_ci		<expr>{HAS_TEX}</expr>
643bf215546Sopenharmony_ci		<display>
644bf215546Sopenharmony_ci			, t#{TEX}
645bf215546Sopenharmony_ci		</display>
646bf215546Sopenharmony_ci		<field name="TEX" low="0" high="6" type="uint"/>
647bf215546Sopenharmony_ci	</override>
648bf215546Sopenharmony_ci	<display/>
649bf215546Sopenharmony_ci	<assert low="0" high="6">0000000</assert>
650bf215546Sopenharmony_ci	<encode type="struct ir3_instruction *">
651bf215546Sopenharmony_ci		<map name="TEX">src->cat5.tex</map>
652bf215546Sopenharmony_ci	</encode>
653bf215546Sopenharmony_ci</bitset>
654bf215546Sopenharmony_ci
655bf215546Sopenharmony_ci<bitset name="#cat5-tex-s2en-bindless" size="4">
656bf215546Sopenharmony_ci	<doc>s2en (indirect) / bindless case only has 4b tex</doc>
657bf215546Sopenharmony_ci	<override>
658bf215546Sopenharmony_ci		<expr>{HAS_TEX}</expr>
659bf215546Sopenharmony_ci		<display>
660bf215546Sopenharmony_ci			, t#{TEX}
661bf215546Sopenharmony_ci		</display>
662bf215546Sopenharmony_ci		<field name="TEX" low="0" high="3" type="uint"/>
663bf215546Sopenharmony_ci	</override>
664bf215546Sopenharmony_ci	<display/>
665bf215546Sopenharmony_ci	<assert low="0" high="3">0000</assert>
666bf215546Sopenharmony_ci	<encode type="struct ir3_instruction *">
667bf215546Sopenharmony_ci		<map name="TEX">src->cat5.tex</map>
668bf215546Sopenharmony_ci	</encode>
669bf215546Sopenharmony_ci</bitset>
670bf215546Sopenharmony_ci
671bf215546Sopenharmony_ci<bitset name="#cat5-type" size="3">
672bf215546Sopenharmony_ci	<display/>
673bf215546Sopenharmony_ci	<override>
674bf215546Sopenharmony_ci		<expr>{HAS_TYPE}</expr>
675bf215546Sopenharmony_ci		<display>
676bf215546Sopenharmony_ci			({TYPE})
677bf215546Sopenharmony_ci		</display>
678bf215546Sopenharmony_ci	</override>
679bf215546Sopenharmony_ci	<field name="TYPE" low="0" high="2" type="#type"/>
680bf215546Sopenharmony_ci	<encode type="struct ir3_instruction *">
681bf215546Sopenharmony_ci		<!--
682bf215546Sopenharmony_ci			Normally we only encode fields that have visible impact on
683bf215546Sopenharmony_ci			the decoded disasm, but the type field is one of those
684bf215546Sopenharmony_ci			special exceptions
685bf215546Sopenharmony_ci		 -->
686bf215546Sopenharmony_ci		<map name="TYPE" force="true">src->cat5.type</map>
687bf215546Sopenharmony_ci	</encode>
688bf215546Sopenharmony_ci</bitset>
689bf215546Sopenharmony_ci
690bf215546Sopenharmony_ci<!--
691bf215546Sopenharmony_ci	Helpers/bitsets/etc for dealing with the bindless/indirect case:
692bf215546Sopenharmony_ci -->
693bf215546Sopenharmony_ci
694bf215546Sopenharmony_ci<enum name="#cat5-s2en-bindless-desc-mode">
695bf215546Sopenharmony_ci	<doc>
696bf215546Sopenharmony_ci		We don't actually display this enum, but it is useful to
697bf215546Sopenharmony_ci		document the various cases
698bf215546Sopenharmony_ci
699bf215546Sopenharmony_ci		TODO we should probably have an option for uniforms w/out
700bf215546Sopenharmony_ci		display strings, but which have 'C' names that can be used
701bf215546Sopenharmony_ci		to generate header that the compiler can use
702bf215546Sopenharmony_ci	</doc>
703bf215546Sopenharmony_ci	<value val="0" display="CAT5_UNIFORM">
704bf215546Sopenharmony_ci		<doc>
705bf215546Sopenharmony_ci			Use traditional GL binding model, get texture and sampler index
706bf215546Sopenharmony_ci			from src3 which is presumed to be uniform on a4xx+ (a3xx doesn't
707bf215546Sopenharmony_ci			have the other modes, but does handle non-uniform indexing).
708bf215546Sopenharmony_ci		</doc>
709bf215546Sopenharmony_ci	</value>
710bf215546Sopenharmony_ci	<value val="1" display="CAT5_BINDLESS_A1_UNIFORM">
711bf215546Sopenharmony_ci		<doc>
712bf215546Sopenharmony_ci			The sampler base comes from the low 3 bits of a1.x, and the sampler
713bf215546Sopenharmony_ci			and texture index come from src3 which is presumed to be uniform.
714bf215546Sopenharmony_ci		</doc>
715bf215546Sopenharmony_ci	</value>
716bf215546Sopenharmony_ci	<value val="2" display="CAT5_BINDLESS_NONUNIFORM">
717bf215546Sopenharmony_ci		<doc>
718bf215546Sopenharmony_ci			The texture and sampler share the same base, and the sampler and
719bf215546Sopenharmony_ci			texture index come from src3 which is *not* presumed to be uniform.
720bf215546Sopenharmony_ci		</doc>
721bf215546Sopenharmony_ci	</value>
722bf215546Sopenharmony_ci	<value val="3" display="CAT5_BINDLESS_A1_NONUNIFORM">
723bf215546Sopenharmony_ci		<doc>
724bf215546Sopenharmony_ci			The sampler base comes from the low 3 bits of a1.x, and the sampler
725bf215546Sopenharmony_ci			and texture index come from src3 which is *not* presumed to be
726bf215546Sopenharmony_ci			uniform.
727bf215546Sopenharmony_ci		</doc>
728bf215546Sopenharmony_ci	</value>
729bf215546Sopenharmony_ci	<value val="4" display="CAT5_NONUNIFORM">
730bf215546Sopenharmony_ci		<doc>
731bf215546Sopenharmony_ci			Use traditional GL binding model, get texture and sampler index
732bf215546Sopenharmony_ci			from src3 which is *not* presumed to be uniform.
733bf215546Sopenharmony_ci		</doc>
734bf215546Sopenharmony_ci	</value>
735bf215546Sopenharmony_ci	<value val="5" display="CAT5_BINDLESS_UNIFORM">
736bf215546Sopenharmony_ci		<doc>
737bf215546Sopenharmony_ci			The texture and sampler share the same base, and the sampler and
738bf215546Sopenharmony_ci			texture index come from src3 which is presumed to be uniform.
739bf215546Sopenharmony_ci		</doc>
740bf215546Sopenharmony_ci	</value>
741bf215546Sopenharmony_ci	<value val="6" display="CAT5_BINDLESS_IMM">
742bf215546Sopenharmony_ci		<doc>
743bf215546Sopenharmony_ci			The texture and sampler share the same base, get sampler index from low
744bf215546Sopenharmony_ci			4 bits of src3 and texture index from high 4 bits.
745bf215546Sopenharmony_ci		</doc>
746bf215546Sopenharmony_ci	</value>
747bf215546Sopenharmony_ci	<value val="7" display="CAT5_BINDLESS_A1_IMM">
748bf215546Sopenharmony_ci		<doc>
749bf215546Sopenharmony_ci			The sampler base comes from the low 3 bits of a1.x, and the texture
750bf215546Sopenharmony_ci			index comes from the next 8 bits of a1.x. The sampler index is an
751bf215546Sopenharmony_ci			immediate in src3.
752bf215546Sopenharmony_ci		</doc>
753bf215546Sopenharmony_ci	</value>
754bf215546Sopenharmony_ci</enum>
755bf215546Sopenharmony_ci
756bf215546Sopenharmony_ci<!-- Helper to map s2en/bindless DESC_MODE to whether it is an indirect mode -->
757bf215546Sopenharmony_ci<expr name="#cat5-s2enb-is-indirect">
758bf215546Sopenharmony_ci	{DESC_MODE} &lt; 6  /* CAT5_BINDLESS_IMM */
759bf215546Sopenharmony_ci</expr>
760bf215546Sopenharmony_ci
761bf215546Sopenharmony_ci<!-- Helper to map s2en/bindless DESC_MODE to whether it is a bindless mode -->
762bf215546Sopenharmony_ci<expr name="#cat5-s2enb-is-bindless">
763bf215546Sopenharmony_ci	({DESC_MODE} == 1) /* CAT5_BINDLESS_A1_UNIFORM */ ||
764bf215546Sopenharmony_ci	({DESC_MODE} == 2) /* CAT5_BINDLESS_NONUNIFORM */ ||
765bf215546Sopenharmony_ci	({DESC_MODE} == 3) /* CAT5_BINDLESS_A1_NONUNIFORM */ ||
766bf215546Sopenharmony_ci	({DESC_MODE} == 5) /* CAT5_BINDLESS_UNIFORM */ ||
767bf215546Sopenharmony_ci	({DESC_MODE} == 6) /* CAT5_BINDLESS_IMM */ ||
768bf215546Sopenharmony_ci	({DESC_MODE} == 7) /* CAT5_BINDLESS_A1_IMM */
769bf215546Sopenharmony_ci</expr>
770bf215546Sopenharmony_ci
771bf215546Sopenharmony_ci<!-- Helper to map s2en/bindless DESC_MODE to whether it uses a1.x -->
772bf215546Sopenharmony_ci<expr name="#cat5-s2enb-uses_a1">
773bf215546Sopenharmony_ci	({DESC_MODE} == 1) /* CAT5_BINDLESS_A1_UNIFORM */ ||
774bf215546Sopenharmony_ci	({DESC_MODE} == 3) /* CAT5_BINDLESS_A1_NONUNIFORM */ ||
775bf215546Sopenharmony_ci	({DESC_MODE} == 7) /* CAT5_BINDLESS_A1_IMM */
776bf215546Sopenharmony_ci</expr>
777bf215546Sopenharmony_ci
778bf215546Sopenharmony_ci<!-- Helper to map s2en/bindless DESC_MODE to whether it is uniform (flow control) mode -->
779bf215546Sopenharmony_ci<expr name="#cat5-s2enb-is-uniform">
780bf215546Sopenharmony_ci	({DESC_MODE} == 0) /* CAT5_UNIFORM */ ||
781bf215546Sopenharmony_ci	({DESC_MODE} == 1) /* CAT5_BINDLESS_A1_UNIFORM */ ||
782bf215546Sopenharmony_ci	({DESC_MODE} == 5) /* CAT5_BINDLESS_UNIFORM */
783bf215546Sopenharmony_ci</expr>
784bf215546Sopenharmony_ci
785bf215546Sopenharmony_ci<!-- Helper to map s2en/bindless DESC_MODE to whether it is non-uniform mode. -->
786bf215546Sopenharmony_ci<expr name="#cat5-s2enb-is-nonuniform">
787bf215546Sopenharmony_ci	({DESC_MODE} == 2) /* CAT5_BINDLESS_NONUNIFORM */ ||
788bf215546Sopenharmony_ci	({DESC_MODE} == 3) /* CAT5_BINDLESS_A1_NONUNIFORM */ ||
789bf215546Sopenharmony_ci	({DESC_MODE} == 4) /* CAT5_NONUNIFORM */
790bf215546Sopenharmony_ci</expr>
791bf215546Sopenharmony_ci
792bf215546Sopenharmony_ci<bitset name="#cat5-src3" size="8">
793bf215546Sopenharmony_ci	<doc>bindless/indirect src3, which can either be GPR or samp/tex</doc>
794bf215546Sopenharmony_ci	<override expr="#cat5-s2enb-is-indirect">
795bf215546Sopenharmony_ci		<display>
796bf215546Sopenharmony_ci			, {SRC_HALF}{SRC}
797bf215546Sopenharmony_ci		</display>
798bf215546Sopenharmony_ci		<field name="SRC" low="0" high="7" type="#reg-gpr"/>
799bf215546Sopenharmony_ci		<derived name="SRC_HALF" type="bool" display="h">
800bf215546Sopenharmony_ci			<expr>!{BINDLESS}</expr>
801bf215546Sopenharmony_ci		</derived>
802bf215546Sopenharmony_ci	</override>
803bf215546Sopenharmony_ci	<override expr="#cat5-s2enb-uses_a1">
804bf215546Sopenharmony_ci		<doc>
805bf215546Sopenharmony_ci			In the case that a1.x is used, all 8 bits encode sampler
806bf215546Sopenharmony_ci		</doc>
807bf215546Sopenharmony_ci		<display>
808bf215546Sopenharmony_ci			{SAMP}
809bf215546Sopenharmony_ci		</display>
810bf215546Sopenharmony_ci		<field name="SAMP" low="0" high="7" type="#cat5-samp-s2en-bindless-a1">
811bf215546Sopenharmony_ci			<param name="HAS_SAMP"/>
812bf215546Sopenharmony_ci		</field>
813bf215546Sopenharmony_ci	</override>
814bf215546Sopenharmony_ci	<display>
815bf215546Sopenharmony_ci		{SAMP}{TEX}
816bf215546Sopenharmony_ci	</display>
817bf215546Sopenharmony_ci	<field name="SAMP" low="0" high="3" type="#cat5-samp">
818bf215546Sopenharmony_ci		<param name="HAS_SAMP"/>
819bf215546Sopenharmony_ci	</field>
820bf215546Sopenharmony_ci	<field name="TEX" low="4" high="7" type="#cat5-tex-s2en-bindless">
821bf215546Sopenharmony_ci		<param name="HAS_TEX"/>
822bf215546Sopenharmony_ci	</field>
823bf215546Sopenharmony_ci	<encode type="struct ir3_register *">
824bf215546Sopenharmony_ci		<map name="SAMP">s->instr</map>
825bf215546Sopenharmony_ci		<map name="TEX">s->instr</map>
826bf215546Sopenharmony_ci		<map name="SRC">src</map>
827bf215546Sopenharmony_ci	</encode>
828bf215546Sopenharmony_ci</bitset>
829bf215546Sopenharmony_ci
830bf215546Sopenharmony_ci</isa>
831