1
<?xml version="1.0" encoding="UTF-8"?>
3
Copyright © 2020 Google, Inc.
5
Permission is hereby granted, free of charge, to any person obtaining a
6
copy of this software and associated documentation files (the "Software"),
7
to deal in the Software without restriction, including without limitation
8
the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
and/or sell copies of the Software, and to permit persons to whom the
10
Software is furnished to do so, subject to the following conditions:
12
The above copyright notice and this permission notice (including the next
13
paragraph) shall be included in all copies or substantial portions of the
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
Helpers for cat2/cat3 nop encoding, which re-uses the SRC1_R/SRC2_R
29
fields to encode a # of nop delay slots following the instruction.
32
<expr name="#cat2-cat3-nop-encoding">
33
(({SRC1_R} != 0) || ({SRC2_R} != 0)) && ({REPEAT} == 0)
36
<expr name="#cat2-cat3-nop-value">
37
{SRC1_R} | ({SRC2_R} << 1)
41
Source/Dest gpr encoding. In the gpr case, this handles the special
45
<expr name="#reg-gpr-a0">
46
{GPR} == 61 /* a0.* */
49
<expr name="#reg-gpr-p0">
50
{GPR} == 62 /* p0.x */
53
<bitset name="#reg-gpr" size="8">
54
<override expr="#reg-gpr-a0">
58
<assert low="2" high="7">111101</assert>
60
<override expr="#reg-gpr-p0">
64
<assert low="2" high="7">111110</assert>
69
<field name="SWIZ" low="0" high="1" type="#swiz"/>
70
<field name="GPR" low="2" high="7" type="uint"/>
71
<encode type="struct ir3_register *">
72
<map name="GPR">src->num >> 2</map>
73
<map name="SWIZ">src->num & 0x3</map>
77
<bitset name="#reg-const" size="11">
81
<field name="SWIZ" low="0" high="1" type="#swiz"/>
82
<field name="CONST" low="2" high="10" type="uint"/>
83
<encode type="struct ir3_register *">
84
<map name="CONST">src->num >> 2</map>
85
<map name="SWIZ">src->num & 0x3</map>
89
<expr name="#offset-zero">
93
<bitset name="#reg-relative-gpr" size="10">
94
<override expr="#offset-zero">
100
r<a0.x + {OFFSET}>
102
<field name="OFFSET" low="0" high="9" type="int"/>
103
<encode type="struct ir3_register *">
104
<map name="OFFSET">src->array.offset</map>
108
<bitset name="#reg-relative-const" size="10">
109
<override expr="#offset-zero">
115
c<a0.x + {OFFSET}>
117
<field name="OFFSET" low="0" high="9" type="int"/>
118
<encode type="struct ir3_register *">
119
<map name="OFFSET">src->array.offset</map>
124
Source Register encoding, used in cat2 and cat4 where a src can be
125
either gpr/const/relative
128
<bitset name="#multisrc" size="16">
130
Encoding for instruction source which can be GPR/CONST/IMMED
131
or relative GPR/CONST.
133
<encode type="struct ir3_register *" case-prefix="REG_">
134
<map name="ABSNEG">extract_ABSNEG(src)</map>
135
<map name="SRC">src</map>
139
<bitset name="#mulitsrc-immed" extends="#multisrc">
140
<override expr="#multisrc-half">
142
{ABSNEG}{SRC_R}h({IMMED})
146
{ABSNEG}{SRC_R}{IMMED}
148
<field name="IMMED" low="0" high="10" type="int"/>
149
<pattern low="11" high="13">100</pattern>
150
<field name="ABSNEG" low="14" high="15" type="#absneg"/>
152
<map name="IMMED">extract_reg_iim(src)</map>
156
<bitset name="#mulitsrc-immed-flut" extends="#multisrc">
158
Immediate with int->float lookup table:
174
<field name="IMMED" low="0" high="9" type="#flut"/>
175
<pattern low="11" high="13">101</pattern>
176
<field name="ABSNEG" low="14" high="15" type="#absneg"/>
178
<map name="IMMED">extract_reg_uim(src)</map>
182
<bitset name="#multisrc-immed-flut-full" extends="#mulitsrc-immed-flut">
184
{ABSNEG}{SRC_R}{IMMED}
186
<pattern pos="10">0</pattern>
189
<bitset name="#multisrc-immed-flut-half" extends="#mulitsrc-immed-flut">
191
{ABSNEG}{SRC_R}h{IMMED}
193
<pattern pos="10">1</pattern>
196
<expr name="#multisrc-half">
200
<bitset name="#multisrc-gpr" extends="#multisrc">
202
{ABSNEG}{SRC_R}{HALF}{SRC}
204
<derived name="HALF" expr="#multisrc-half" type="bool" display="h"/>
205
<field name="SRC" low="0" high="7" type="#reg-gpr"/>
206
<pattern low="8" high="13">000000</pattern>
207
<field name="ABSNEG" low="14" high="15" type="#absneg"/>
210
<bitset name="#multisrc-const" extends="#multisrc">
212
{ABSNEG}{SRC_R}{HALF}{SRC}
214
<derived name="HALF" expr="#multisrc-half" type="bool" display="h"/>
215
<field name="SRC" low="0" high="10" type="#reg-const"/>
216
<pattern low="11" high="13">x10</pattern>
217
<field name="ABSNEG" low="14" high="15" type="#absneg"/>
220
<bitset name="#multisrc-relative" extends="#multisrc">
221
<pattern low="11" high="13">001</pattern>
222
<field name="ABSNEG" low="14" high="15" type="#absneg"/>
225
<bitset name="#multisrc-relative-gpr" extends="#multisrc-relative">
227
{ABSNEG}{SRC_R}{HALF}{SRC}
229
<derived name="HALF" expr="#multisrc-half" type="bool" display="h"/>
230
<field name="SRC" low="0" high="9" type="#reg-relative-gpr"/>
231
<pattern pos="10">0</pattern>
234
<bitset name="#multisrc-relative-const" extends="#multisrc-relative">
236
{ABSNEG}{SRC_R}{HALF}{SRC}
238
<derived name="HALF" expr="#multisrc-half" type="bool" display="h"/>
239
<field name="SRC" low="0" high="9" type="#reg-relative-const"/>
240
<pattern pos="10">1</pattern>
244
For cat2/cat4, the dst reg is full precision if {FULL} == {DEST_CONV}
245
In addition, for cat2 instructions that can write p0.x (cmps.*, and.b,
246
xor.b, etc), p0.x is never half (DEST_CONV is ignored)
248
<expr name="#dest-half">
249
({FULL} == {DST_CONV}) && ({DST} <= 0xf7 /* p0.x */)
260
<!-- These make #true/#false a bit redundant, but I guess keep them for clarity -->
272
Enums used in various places:
276
<value val="0" display=""/>
277
<value val="1" display="(rpt1)"/>
278
<value val="2" display="(rpt2)"/>
279
<value val="3" display="(rpt3)"/>
280
<value val="4" display="(rpt4)"/>
281
<value val="5" display="(rpt5)"/>
285
<value val="0" display="lt"/>
286
<value val="1" display="le"/>
287
<value val="2" display="gt"/>
288
<value val="3" display="ge"/>
289
<value val="4" display="eq"/>
290
<value val="5" display="ne"/>
294
<value val="0" display="x"/>
295
<value val="1" display="y"/>
296
<value val="2" display="z"/>
297
<value val="3" display="w"/>
301
<value val="0" display="f16"/>
302
<value val="1" display="f32"/>
303
<value val="2" display="u16"/>
304
<value val="3" display="u32"/>
305
<value val="4" display="s16"/>
306
<value val="5" display="s32"/>
307
<value val="6" display="u8"/>
308
<value val="7" display="s8"/>
311
<expr name="#type-half">
312
({TYPE} == 0) /* f16 */ ||
313
({TYPE} == 2) /* u16 */ ||
314
({TYPE} == 4) /* s16 */ ||
315
({TYPE} == 6) /* u8 */ ||
316
({TYPE} == 7) /* s8 */
319
<enum name="#absneg">
320
<value val="0" display=""/>
321
<value val="1" display="(neg)"/>
322
<value val="2" display="(abs)"/>
323
<value val="3" display="(absneg)"/>
327
<doc>int to float lookup table</doc>
328
<value val="0" display="(0.0)"/>
329
<value val="1" display="(0.5)"/>
330
<value val="2" display="(1.0)"/>
331
<value val="3" display="(2.0)"/>
332
<value val="4" display="(e)"/>
333
<value val="5" display="(pi)"/>
334
<value val="6" display="(1/pi)"/>
335
<value val="7" display="(1/log2(e))"/>
336
<value val="8" display="(log2(e))"/>
337
<value val="9" display="(1/log2(10))"/>
338
<value val="10" display="(log2(10))"/>
339
<value val="11" display="(4.0)"/>
342
<enum name="#wrmask">
343
<value val="0" display=""/>
344
<value val="1" display="x"/>
345
<value val="2" display="y"/>
346
<value val="3" display="xy"/>
347
<value val="4" display="z"/>
348
<value val="5" display="zx"/>
349
<value val="6" display="zy"/>
350
<value val="7" display="xyz"/>
351
<value val="8" display="w"/>
352
<value val="9" display="xw"/>
353
<value val="10" display="yw"/>
354
<value val="11" display="xyw"/>
355
<value val="12" display="zw"/>
356
<value val="13" display="xzw"/>
357
<value val="14" display="yzw"/>
358
<value val="15" display="xyzw"/>