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	Cat4 Instructions:  SFU (aka EFU) instructions
29bf215546Sopenharmony_ci -->
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci<bitset name="#instruction-cat4" extends="#instruction">
32bf215546Sopenharmony_ci	<display>
33bf215546Sopenharmony_ci		{SY}{SS}{JP}{SAT}{REPEAT}{UL}{NAME} {DST_HALF}{DST}, {SRC}
34bf215546Sopenharmony_ci	</display>
35bf215546Sopenharmony_ci	<field name="SRC" low="0" high="15" type="#multisrc">
36bf215546Sopenharmony_ci		<param name="SRC_R"/>
37bf215546Sopenharmony_ci		<param name="FULL"/>
38bf215546Sopenharmony_ci	</field>
39bf215546Sopenharmony_ci	<pattern low="16" high="31">xxxxxxxxxxxxxxxx</pattern>
40bf215546Sopenharmony_ci	<field name="DST" low="32" high="39" type="#reg-gpr"/>
41bf215546Sopenharmony_ci	<field name="REPEAT" low="40" high="41" type="#rptN"/>
42bf215546Sopenharmony_ci	<field name="SAT" pos="42" type="bool" display="(sat)"/>
43bf215546Sopenharmony_ci	<field name="SRC_R" pos="43" type="bool" display="(r)"/>
44bf215546Sopenharmony_ci	<field name="SS" pos="44" type="bool" display="(ss)"/>
45bf215546Sopenharmony_ci	<field name="UL" pos="45" type="bool" display="(ul)"/>
46bf215546Sopenharmony_ci	<field name="DST_CONV" pos="46" type="bool">
47bf215546Sopenharmony_ci		<doc>
48bf215546Sopenharmony_ci			Destination register is opposite precision as source, ie.
49bf215546Sopenharmony_ci			if {FULL} is true then destination is half precision, and
50bf215546Sopenharmony_ci			visa versa.
51bf215546Sopenharmony_ci		</doc>
52bf215546Sopenharmony_ci	</field>
53bf215546Sopenharmony_ci	<derived name="DST_HALF" expr="#dest-half" type="bool" display="h"/>
54bf215546Sopenharmony_ci	<pattern low="47" high="51">xxxxx</pattern>
55bf215546Sopenharmony_ci	<field name="FULL" pos="52" type="bool">
56bf215546Sopenharmony_ci		<doc>Full precision source registers</doc>
57bf215546Sopenharmony_ci	</field>
58bf215546Sopenharmony_ci	<!-- 6b opc -->
59bf215546Sopenharmony_ci	<field name="JP" pos="59" type="bool" display="(jp)"/>
60bf215546Sopenharmony_ci	<field name="SY" pos="60" type="bool" display="(sy)"/>
61bf215546Sopenharmony_ci	<pattern low="61" high="63">100</pattern>  <!-- cat4 -->
62bf215546Sopenharmony_ci	<encode>
63bf215546Sopenharmony_ci		<map name="SRC">src->srcs[0]</map>
64bf215546Sopenharmony_ci		<map name="DST_CONV">
65bf215546Sopenharmony_ci			((src->dsts[0]->num >> 2) == 62) ? 0 :
66bf215546Sopenharmony_ci			!!((src->srcs[0]->flags ^ src->dsts[0]->flags) &amp; IR3_REG_HALF)
67bf215546Sopenharmony_ci		</map>
68bf215546Sopenharmony_ci		<map name="FULL">!(src->srcs[0]->flags &amp; IR3_REG_HALF)</map>
69bf215546Sopenharmony_ci		<map name="SRC_R">!!(src->srcs[0]->flags &amp; IR3_REG_R)</map>
70bf215546Sopenharmony_ci	</encode>
71bf215546Sopenharmony_ci</bitset>
72bf215546Sopenharmony_ci
73bf215546Sopenharmony_ci<bitset name="rcp" extends="#instruction-cat4">
74bf215546Sopenharmony_ci	<pattern low="53" high="58">000000</pattern> <!-- OPC -->
75bf215546Sopenharmony_ci</bitset>
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_ci<bitset name="rsq" extends="#instruction-cat4">
78bf215546Sopenharmony_ci	<pattern low="53" high="58">000001</pattern> <!-- OPC -->
79bf215546Sopenharmony_ci</bitset>
80bf215546Sopenharmony_ci
81bf215546Sopenharmony_ci<bitset name="log2" extends="#instruction-cat4">
82bf215546Sopenharmony_ci	<pattern low="53" high="58">000010</pattern> <!-- OPC -->
83bf215546Sopenharmony_ci</bitset>
84bf215546Sopenharmony_ci
85bf215546Sopenharmony_ci<bitset name="exp2" extends="#instruction-cat4">
86bf215546Sopenharmony_ci	<pattern low="53" high="58">000011</pattern> <!-- OPC -->
87bf215546Sopenharmony_ci</bitset>
88bf215546Sopenharmony_ci
89bf215546Sopenharmony_ci<bitset name="sin" extends="#instruction-cat4">
90bf215546Sopenharmony_ci	<pattern low="53" high="58">000100</pattern> <!-- OPC -->
91bf215546Sopenharmony_ci</bitset>
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_ci<bitset name="cos" extends="#instruction-cat4">
94bf215546Sopenharmony_ci	<pattern low="53" high="58">000101</pattern> <!-- OPC -->
95bf215546Sopenharmony_ci</bitset>
96bf215546Sopenharmony_ci
97bf215546Sopenharmony_ci<bitset name="sqrt" extends="#instruction-cat4">
98bf215546Sopenharmony_ci	<pattern low="53" high="58">000110</pattern> <!-- OPC -->
99bf215546Sopenharmony_ci</bitset>
100bf215546Sopenharmony_ci
101bf215546Sopenharmony_ci<!--
102bf215546Sopenharmony_ci	NOTE that these are 8+opc from their highp equivs, so it's possible
103bf215546Sopenharmony_ci	that the high order bit in the opc field has been repurposed for
104bf215546Sopenharmony_ci	half-precision use?  But note that other ops (rcp/lsin/cos/sqrt)
105bf215546Sopenharmony_ci	still use the same opc as highp
106bf215546Sopenharmony_ci -->
107bf215546Sopenharmony_ci
108bf215546Sopenharmony_ci<bitset name="hrsq" extends="#instruction-cat4">
109bf215546Sopenharmony_ci	<pattern low="53" high="58">001001</pattern> <!-- OPC -->
110bf215546Sopenharmony_ci</bitset>
111bf215546Sopenharmony_ci
112bf215546Sopenharmony_ci<bitset name="hlog2" extends="#instruction-cat4">
113bf215546Sopenharmony_ci	<pattern low="53" high="58">001010</pattern> <!-- OPC -->
114bf215546Sopenharmony_ci</bitset>
115bf215546Sopenharmony_ci
116bf215546Sopenharmony_ci<bitset name="hexp2" extends="#instruction-cat4">
117bf215546Sopenharmony_ci	<pattern low="53" high="58">001011</pattern> <!-- OPC -->
118bf215546Sopenharmony_ci</bitset>
119bf215546Sopenharmony_ci
120bf215546Sopenharmony_ci</isa>
121