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 Helpers for cat2/cat3 nop encoding, which re-uses the SRC1_R/SRC2_R 29bf215546Sopenharmony_ci fields to encode a # of nop delay slots following the instruction. 30bf215546Sopenharmony_ci --> 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ci<expr name="#cat2-cat3-nop-encoding"> 33bf215546Sopenharmony_ci (({SRC1_R} != 0) || ({SRC2_R} != 0)) && ({REPEAT} == 0) 34bf215546Sopenharmony_ci</expr> 35bf215546Sopenharmony_ci 36bf215546Sopenharmony_ci<expr name="#cat2-cat3-nop-value"> 37bf215546Sopenharmony_ci {SRC1_R} | ({SRC2_R} << 1) 38bf215546Sopenharmony_ci</expr> 39bf215546Sopenharmony_ci 40bf215546Sopenharmony_ci<!-- 41bf215546Sopenharmony_ci Source/Dest gpr encoding. In the gpr case, this handles the special 42bf215546Sopenharmony_ci cases (p0.x/a0.x) 43bf215546Sopenharmony_ci --> 44bf215546Sopenharmony_ci 45bf215546Sopenharmony_ci<expr name="#reg-gpr-a0"> 46bf215546Sopenharmony_ci {GPR} == 61 /* a0.* */ 47bf215546Sopenharmony_ci</expr> 48bf215546Sopenharmony_ci 49bf215546Sopenharmony_ci<expr name="#reg-gpr-p0"> 50bf215546Sopenharmony_ci {GPR} == 62 /* p0.x */ 51bf215546Sopenharmony_ci</expr> 52bf215546Sopenharmony_ci 53bf215546Sopenharmony_ci<bitset name="#reg-gpr" size="8"> 54bf215546Sopenharmony_ci <override expr="#reg-gpr-a0"> 55bf215546Sopenharmony_ci <display> 56bf215546Sopenharmony_ci a0.{SWIZ} 57bf215546Sopenharmony_ci </display> 58bf215546Sopenharmony_ci <assert low="2" high="7">111101</assert> 59bf215546Sopenharmony_ci </override> 60bf215546Sopenharmony_ci <override expr="#reg-gpr-p0"> 61bf215546Sopenharmony_ci <display> 62bf215546Sopenharmony_ci p0.{SWIZ} 63bf215546Sopenharmony_ci </display> 64bf215546Sopenharmony_ci <assert low="2" high="7">111110</assert> 65bf215546Sopenharmony_ci </override> 66bf215546Sopenharmony_ci <display> 67bf215546Sopenharmony_ci r{GPR}.{SWIZ} 68bf215546Sopenharmony_ci </display> 69bf215546Sopenharmony_ci <field name="SWIZ" low="0" high="1" type="#swiz"/> 70bf215546Sopenharmony_ci <field name="GPR" low="2" high="7" type="uint"/> 71bf215546Sopenharmony_ci <encode type="struct ir3_register *"> 72bf215546Sopenharmony_ci <map name="GPR">src->num >> 2</map> 73bf215546Sopenharmony_ci <map name="SWIZ">src->num & 0x3</map> 74bf215546Sopenharmony_ci </encode> 75bf215546Sopenharmony_ci</bitset> 76bf215546Sopenharmony_ci 77bf215546Sopenharmony_ci<bitset name="#reg-const" size="11"> 78bf215546Sopenharmony_ci <display> 79bf215546Sopenharmony_ci c{CONST}.{SWIZ} 80bf215546Sopenharmony_ci </display> 81bf215546Sopenharmony_ci <field name="SWIZ" low="0" high="1" type="#swiz"/> 82bf215546Sopenharmony_ci <field name="CONST" low="2" high="10" type="uint"/> 83bf215546Sopenharmony_ci <encode type="struct ir3_register *"> 84bf215546Sopenharmony_ci <map name="CONST">src->num >> 2</map> 85bf215546Sopenharmony_ci <map name="SWIZ">src->num & 0x3</map> 86bf215546Sopenharmony_ci </encode> 87bf215546Sopenharmony_ci</bitset> 88bf215546Sopenharmony_ci 89bf215546Sopenharmony_ci<expr name="#offset-zero"> 90bf215546Sopenharmony_ci {OFFSET} == 0 91bf215546Sopenharmony_ci</expr> 92bf215546Sopenharmony_ci 93bf215546Sopenharmony_ci<bitset name="#reg-relative-gpr" size="10"> 94bf215546Sopenharmony_ci <override expr="#offset-zero"> 95bf215546Sopenharmony_ci <display> 96bf215546Sopenharmony_ci r<a0.x> 97bf215546Sopenharmony_ci </display> 98bf215546Sopenharmony_ci </override> 99bf215546Sopenharmony_ci <display> 100bf215546Sopenharmony_ci r<a0.x + {OFFSET}> 101bf215546Sopenharmony_ci </display> 102bf215546Sopenharmony_ci <field name="OFFSET" low="0" high="9" type="int"/> 103bf215546Sopenharmony_ci <encode type="struct ir3_register *"> 104bf215546Sopenharmony_ci <map name="OFFSET">src->array.offset</map> 105bf215546Sopenharmony_ci </encode> 106bf215546Sopenharmony_ci</bitset> 107bf215546Sopenharmony_ci 108bf215546Sopenharmony_ci<bitset name="#reg-relative-const" size="10"> 109bf215546Sopenharmony_ci <override expr="#offset-zero"> 110bf215546Sopenharmony_ci <display> 111bf215546Sopenharmony_ci c<a0.x> 112bf215546Sopenharmony_ci </display> 113bf215546Sopenharmony_ci </override> 114bf215546Sopenharmony_ci <display> 115bf215546Sopenharmony_ci c<a0.x + {OFFSET}> 116bf215546Sopenharmony_ci </display> 117bf215546Sopenharmony_ci <field name="OFFSET" low="0" high="9" type="int"/> 118bf215546Sopenharmony_ci <encode type="struct ir3_register *"> 119bf215546Sopenharmony_ci <map name="OFFSET">src->array.offset</map> 120bf215546Sopenharmony_ci </encode> 121bf215546Sopenharmony_ci</bitset> 122bf215546Sopenharmony_ci 123bf215546Sopenharmony_ci<!-- 124bf215546Sopenharmony_ci Source Register encoding, used in cat2 and cat4 where a src can be 125bf215546Sopenharmony_ci either gpr/const/relative 126bf215546Sopenharmony_ci --> 127bf215546Sopenharmony_ci 128bf215546Sopenharmony_ci<bitset name="#multisrc" size="16"> 129bf215546Sopenharmony_ci <doc> 130bf215546Sopenharmony_ci Encoding for instruction source which can be GPR/CONST/IMMED 131bf215546Sopenharmony_ci or relative GPR/CONST. 132bf215546Sopenharmony_ci </doc> 133bf215546Sopenharmony_ci <encode type="struct ir3_register *" case-prefix="REG_"> 134bf215546Sopenharmony_ci <map name="ABSNEG">extract_ABSNEG(src)</map> 135bf215546Sopenharmony_ci <map name="SRC">src</map> 136bf215546Sopenharmony_ci </encode> 137bf215546Sopenharmony_ci</bitset> 138bf215546Sopenharmony_ci 139bf215546Sopenharmony_ci<bitset name="#mulitsrc-immed" extends="#multisrc"> 140bf215546Sopenharmony_ci <override expr="#multisrc-half"> 141bf215546Sopenharmony_ci <display> 142bf215546Sopenharmony_ci {ABSNEG}{SRC_R}h({IMMED}) 143bf215546Sopenharmony_ci </display> 144bf215546Sopenharmony_ci </override> 145bf215546Sopenharmony_ci <display> 146bf215546Sopenharmony_ci {ABSNEG}{SRC_R}{IMMED} 147bf215546Sopenharmony_ci </display> 148bf215546Sopenharmony_ci <field name="IMMED" low="0" high="10" type="int"/> 149bf215546Sopenharmony_ci <pattern low="11" high="13">100</pattern> 150bf215546Sopenharmony_ci <field name="ABSNEG" low="14" high="15" type="#absneg"/> 151bf215546Sopenharmony_ci <encode> 152bf215546Sopenharmony_ci <map name="IMMED">extract_reg_iim(src)</map> 153bf215546Sopenharmony_ci </encode> 154bf215546Sopenharmony_ci</bitset> 155bf215546Sopenharmony_ci 156bf215546Sopenharmony_ci<bitset name="#mulitsrc-immed-flut" extends="#multisrc"> 157bf215546Sopenharmony_ci <doc> 158bf215546Sopenharmony_ci Immediate with int->float lookup table: 159bf215546Sopenharmony_ci 160bf215546Sopenharmony_ci 0 -> 0.0 161bf215546Sopenharmony_ci 1 -> 0.5 162bf215546Sopenharmony_ci 2 -> 1.0 163bf215546Sopenharmony_ci 3 -> 2.0 164bf215546Sopenharmony_ci 4 -> e 165bf215546Sopenharmony_ci 5 -> pi 166bf215546Sopenharmony_ci 6 -> 1/pi 167bf215546Sopenharmony_ci 7 -> 1/log2(e) 168bf215546Sopenharmony_ci 8 -> log2(e) 169bf215546Sopenharmony_ci 9 -> 1/log2(10) 170bf215546Sopenharmony_ci 10 -> log2(10) 171bf215546Sopenharmony_ci 11 -> 4.0 172bf215546Sopenharmony_ci 173bf215546Sopenharmony_ci </doc> 174bf215546Sopenharmony_ci <field name="IMMED" low="0" high="9" type="#flut"/> 175bf215546Sopenharmony_ci <pattern low="11" high="13">101</pattern> 176bf215546Sopenharmony_ci <field name="ABSNEG" low="14" high="15" type="#absneg"/> 177bf215546Sopenharmony_ci <encode> 178bf215546Sopenharmony_ci <map name="IMMED">extract_reg_uim(src)</map> 179bf215546Sopenharmony_ci </encode> 180bf215546Sopenharmony_ci</bitset> 181bf215546Sopenharmony_ci 182bf215546Sopenharmony_ci<bitset name="#multisrc-immed-flut-full" extends="#mulitsrc-immed-flut"> 183bf215546Sopenharmony_ci <display> 184bf215546Sopenharmony_ci {ABSNEG}{SRC_R}{IMMED} 185bf215546Sopenharmony_ci </display> 186bf215546Sopenharmony_ci <pattern pos="10">0</pattern> 187bf215546Sopenharmony_ci</bitset> 188bf215546Sopenharmony_ci 189bf215546Sopenharmony_ci<bitset name="#multisrc-immed-flut-half" extends="#mulitsrc-immed-flut"> 190bf215546Sopenharmony_ci <display> 191bf215546Sopenharmony_ci {ABSNEG}{SRC_R}h{IMMED} 192bf215546Sopenharmony_ci </display> 193bf215546Sopenharmony_ci <pattern pos="10">1</pattern> 194bf215546Sopenharmony_ci</bitset> 195bf215546Sopenharmony_ci 196bf215546Sopenharmony_ci<expr name="#multisrc-half"> 197bf215546Sopenharmony_ci !{FULL} 198bf215546Sopenharmony_ci</expr> 199bf215546Sopenharmony_ci 200bf215546Sopenharmony_ci<bitset name="#multisrc-gpr" extends="#multisrc"> 201bf215546Sopenharmony_ci <display> 202bf215546Sopenharmony_ci {ABSNEG}{SRC_R}{HALF}{SRC} 203bf215546Sopenharmony_ci </display> 204bf215546Sopenharmony_ci <derived name="HALF" expr="#multisrc-half" type="bool" display="h"/> 205bf215546Sopenharmony_ci <field name="SRC" low="0" high="7" type="#reg-gpr"/> 206bf215546Sopenharmony_ci <pattern low="8" high="13">000000</pattern> 207bf215546Sopenharmony_ci <field name="ABSNEG" low="14" high="15" type="#absneg"/> 208bf215546Sopenharmony_ci</bitset> 209bf215546Sopenharmony_ci 210bf215546Sopenharmony_ci<bitset name="#multisrc-const" extends="#multisrc"> 211bf215546Sopenharmony_ci <display> 212bf215546Sopenharmony_ci {ABSNEG}{SRC_R}{HALF}{SRC} 213bf215546Sopenharmony_ci </display> 214bf215546Sopenharmony_ci <derived name="HALF" expr="#multisrc-half" type="bool" display="h"/> 215bf215546Sopenharmony_ci <field name="SRC" low="0" high="10" type="#reg-const"/> 216bf215546Sopenharmony_ci <pattern low="11" high="13">x10</pattern> 217bf215546Sopenharmony_ci <field name="ABSNEG" low="14" high="15" type="#absneg"/> 218bf215546Sopenharmony_ci</bitset> 219bf215546Sopenharmony_ci 220bf215546Sopenharmony_ci<bitset name="#multisrc-relative" extends="#multisrc"> 221bf215546Sopenharmony_ci <pattern low="11" high="13">001</pattern> 222bf215546Sopenharmony_ci <field name="ABSNEG" low="14" high="15" type="#absneg"/> 223bf215546Sopenharmony_ci</bitset> 224bf215546Sopenharmony_ci 225bf215546Sopenharmony_ci<bitset name="#multisrc-relative-gpr" extends="#multisrc-relative"> 226bf215546Sopenharmony_ci <display> 227bf215546Sopenharmony_ci {ABSNEG}{SRC_R}{HALF}{SRC} 228bf215546Sopenharmony_ci </display> 229bf215546Sopenharmony_ci <derived name="HALF" expr="#multisrc-half" type="bool" display="h"/> 230bf215546Sopenharmony_ci <field name="SRC" low="0" high="9" type="#reg-relative-gpr"/> 231bf215546Sopenharmony_ci <pattern pos="10">0</pattern> 232bf215546Sopenharmony_ci</bitset> 233bf215546Sopenharmony_ci 234bf215546Sopenharmony_ci<bitset name="#multisrc-relative-const" extends="#multisrc-relative"> 235bf215546Sopenharmony_ci <display> 236bf215546Sopenharmony_ci {ABSNEG}{SRC_R}{HALF}{SRC} 237bf215546Sopenharmony_ci </display> 238bf215546Sopenharmony_ci <derived name="HALF" expr="#multisrc-half" type="bool" display="h"/> 239bf215546Sopenharmony_ci <field name="SRC" low="0" high="9" type="#reg-relative-const"/> 240bf215546Sopenharmony_ci <pattern pos="10">1</pattern> 241bf215546Sopenharmony_ci</bitset> 242bf215546Sopenharmony_ci 243bf215546Sopenharmony_ci<!-- 244bf215546Sopenharmony_ci For cat2/cat4, the dst reg is full precision if {FULL} == {DEST_CONV} 245bf215546Sopenharmony_ci In addition, for cat2 instructions that can write p0.x (cmps.*, and.b, 246bf215546Sopenharmony_ci xor.b, etc), p0.x is never half (DEST_CONV is ignored) 247bf215546Sopenharmony_ci --> 248bf215546Sopenharmony_ci<expr name="#dest-half"> 249bf215546Sopenharmony_ci ({FULL} == {DST_CONV}) && ({DST} <= 0xf7 /* p0.x */) 250bf215546Sopenharmony_ci</expr> 251bf215546Sopenharmony_ci 252bf215546Sopenharmony_ci<expr name="#true"> 253bf215546Sopenharmony_ci 1 254bf215546Sopenharmony_ci</expr> 255bf215546Sopenharmony_ci 256bf215546Sopenharmony_ci<expr name="#false"> 257bf215546Sopenharmony_ci 0 258bf215546Sopenharmony_ci</expr> 259bf215546Sopenharmony_ci 260bf215546Sopenharmony_ci<!-- These make #true/#false a bit redundant, but I guess keep them for clarity --> 261bf215546Sopenharmony_ci<expr name="#zero"> 262bf215546Sopenharmony_ci 0 263bf215546Sopenharmony_ci</expr> 264bf215546Sopenharmony_ci<expr name="#one"> 265bf215546Sopenharmony_ci 1 266bf215546Sopenharmony_ci</expr> 267bf215546Sopenharmony_ci<expr name="#two"> 268bf215546Sopenharmony_ci 2 269bf215546Sopenharmony_ci</expr> 270bf215546Sopenharmony_ci 271bf215546Sopenharmony_ci<!-- 272bf215546Sopenharmony_ci Enums used in various places: 273bf215546Sopenharmony_ci --> 274bf215546Sopenharmony_ci 275bf215546Sopenharmony_ci<enum name="#rptN"> 276bf215546Sopenharmony_ci <value val="0" display=""/> 277bf215546Sopenharmony_ci <value val="1" display="(rpt1)"/> 278bf215546Sopenharmony_ci <value val="2" display="(rpt2)"/> 279bf215546Sopenharmony_ci <value val="3" display="(rpt3)"/> 280bf215546Sopenharmony_ci <value val="4" display="(rpt4)"/> 281bf215546Sopenharmony_ci <value val="5" display="(rpt5)"/> 282bf215546Sopenharmony_ci</enum> 283bf215546Sopenharmony_ci 284bf215546Sopenharmony_ci<enum name="#cond"> 285bf215546Sopenharmony_ci <value val="0" display="lt"/> 286bf215546Sopenharmony_ci <value val="1" display="le"/> 287bf215546Sopenharmony_ci <value val="2" display="gt"/> 288bf215546Sopenharmony_ci <value val="3" display="ge"/> 289bf215546Sopenharmony_ci <value val="4" display="eq"/> 290bf215546Sopenharmony_ci <value val="5" display="ne"/> 291bf215546Sopenharmony_ci</enum> 292bf215546Sopenharmony_ci 293bf215546Sopenharmony_ci<enum name="#swiz"> 294bf215546Sopenharmony_ci <value val="0" display="x"/> 295bf215546Sopenharmony_ci <value val="1" display="y"/> 296bf215546Sopenharmony_ci <value val="2" display="z"/> 297bf215546Sopenharmony_ci <value val="3" display="w"/> 298bf215546Sopenharmony_ci</enum> 299bf215546Sopenharmony_ci 300bf215546Sopenharmony_ci<enum name="#type"> 301bf215546Sopenharmony_ci <value val="0" display="f16"/> 302bf215546Sopenharmony_ci <value val="1" display="f32"/> 303bf215546Sopenharmony_ci <value val="2" display="u16"/> 304bf215546Sopenharmony_ci <value val="3" display="u32"/> 305bf215546Sopenharmony_ci <value val="4" display="s16"/> 306bf215546Sopenharmony_ci <value val="5" display="s32"/> 307bf215546Sopenharmony_ci <value val="6" display="u8"/> 308bf215546Sopenharmony_ci <value val="7" display="s8"/> 309bf215546Sopenharmony_ci</enum> 310bf215546Sopenharmony_ci 311bf215546Sopenharmony_ci<expr name="#type-half"> 312bf215546Sopenharmony_ci ({TYPE} == 0) /* f16 */ || 313bf215546Sopenharmony_ci ({TYPE} == 2) /* u16 */ || 314bf215546Sopenharmony_ci ({TYPE} == 4) /* s16 */ || 315bf215546Sopenharmony_ci ({TYPE} == 6) /* u8 */ || 316bf215546Sopenharmony_ci ({TYPE} == 7) /* s8 */ 317bf215546Sopenharmony_ci</expr> 318bf215546Sopenharmony_ci 319bf215546Sopenharmony_ci<enum name="#absneg"> 320bf215546Sopenharmony_ci <value val="0" display=""/> 321bf215546Sopenharmony_ci <value val="1" display="(neg)"/> 322bf215546Sopenharmony_ci <value val="2" display="(abs)"/> 323bf215546Sopenharmony_ci <value val="3" display="(absneg)"/> 324bf215546Sopenharmony_ci</enum> 325bf215546Sopenharmony_ci 326bf215546Sopenharmony_ci<enum name="#flut"> 327bf215546Sopenharmony_ci <doc>int to float lookup table</doc> 328bf215546Sopenharmony_ci <value val="0" display="(0.0)"/> 329bf215546Sopenharmony_ci <value val="1" display="(0.5)"/> 330bf215546Sopenharmony_ci <value val="2" display="(1.0)"/> 331bf215546Sopenharmony_ci <value val="3" display="(2.0)"/> 332bf215546Sopenharmony_ci <value val="4" display="(e)"/> 333bf215546Sopenharmony_ci <value val="5" display="(pi)"/> 334bf215546Sopenharmony_ci <value val="6" display="(1/pi)"/> 335bf215546Sopenharmony_ci <value val="7" display="(1/log2(e))"/> 336bf215546Sopenharmony_ci <value val="8" display="(log2(e))"/> 337bf215546Sopenharmony_ci <value val="9" display="(1/log2(10))"/> 338bf215546Sopenharmony_ci <value val="10" display="(log2(10))"/> 339bf215546Sopenharmony_ci <value val="11" display="(4.0)"/> 340bf215546Sopenharmony_ci</enum> 341bf215546Sopenharmony_ci 342bf215546Sopenharmony_ci<enum name="#wrmask"> 343bf215546Sopenharmony_ci <value val="0" display=""/> 344bf215546Sopenharmony_ci <value val="1" display="x"/> 345bf215546Sopenharmony_ci <value val="2" display="y"/> 346bf215546Sopenharmony_ci <value val="3" display="xy"/> 347bf215546Sopenharmony_ci <value val="4" display="z"/> 348bf215546Sopenharmony_ci <value val="5" display="zx"/> 349bf215546Sopenharmony_ci <value val="6" display="zy"/> 350bf215546Sopenharmony_ci <value val="7" display="xyz"/> 351bf215546Sopenharmony_ci <value val="8" display="w"/> 352bf215546Sopenharmony_ci <value val="9" display="xw"/> 353bf215546Sopenharmony_ci <value val="10" display="yw"/> 354bf215546Sopenharmony_ci <value val="11" display="xyw"/> 355bf215546Sopenharmony_ci <value val="12" display="zw"/> 356bf215546Sopenharmony_ci <value val="13" display="xzw"/> 357bf215546Sopenharmony_ci <value val="14" display="yzw"/> 358bf215546Sopenharmony_ci <value val="15" display="xyzw"/> 359bf215546Sopenharmony_ci</enum> 360bf215546Sopenharmony_ci 361bf215546Sopenharmony_ci</isa> 362