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 Cat3 Instructions: three-source ALU instructions 29bf215546Sopenharmony_ci --> 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_ci<bitset name="#cat3-src" size="13"> 32bf215546Sopenharmony_ci <doc> 33bf215546Sopenharmony_ci cat3 src1 and src2, some parts are similar to cat2/cat4 src 34bf215546Sopenharmony_ci encoding, but a few extra bits trimmed out to squeeze in the 35bf215546Sopenharmony_ci 3rd src register (dropping (abs), immed encoding, and moving 36bf215546Sopenharmony_ci a few other bits elsewhere) 37bf215546Sopenharmony_ci </doc> 38bf215546Sopenharmony_ci <encode type="struct ir3_register *" case-prefix="REG_"/> 39bf215546Sopenharmony_ci</bitset> 40bf215546Sopenharmony_ci 41bf215546Sopenharmony_ci<bitset name="#cat3-src-gpr" extends="#cat3-src"> 42bf215546Sopenharmony_ci <display> 43bf215546Sopenharmony_ci {HALF}{SRC} 44bf215546Sopenharmony_ci </display> 45bf215546Sopenharmony_ci <field name="SRC" low="0" high="7" type="#reg-gpr"/> 46bf215546Sopenharmony_ci <pattern low="8" high="12">00000</pattern> 47bf215546Sopenharmony_ci <encode> 48bf215546Sopenharmony_ci <map name="SRC">src</map> 49bf215546Sopenharmony_ci </encode> 50bf215546Sopenharmony_ci</bitset> 51bf215546Sopenharmony_ci 52bf215546Sopenharmony_ci 53bf215546Sopenharmony_ci<bitset name="#cat3-src-const-or-immed" extends="#cat3-src"> 54bf215546Sopenharmony_ci <override> 55bf215546Sopenharmony_ci <expr>{IMMED_ENCODING}</expr> 56bf215546Sopenharmony_ci <display> 57bf215546Sopenharmony_ci {IMMED} 58bf215546Sopenharmony_ci </display> 59bf215546Sopenharmony_ci <field name="IMMED" low="0" high="11" type="uint"/> 60bf215546Sopenharmony_ci <pattern pos="12">1</pattern> 61bf215546Sopenharmony_ci </override> 62bf215546Sopenharmony_ci 63bf215546Sopenharmony_ci <display> 64bf215546Sopenharmony_ci {HALF}c{CONST}.{SWIZ} 65bf215546Sopenharmony_ci </display> 66bf215546Sopenharmony_ci <field name="SWIZ" low="0" high="1" type="#swiz"/> 67bf215546Sopenharmony_ci <field name="CONST" low="2" high="10" type="uint"/> 68bf215546Sopenharmony_ci <pattern low="11" high="12">10</pattern> 69bf215546Sopenharmony_ci <encode> 70bf215546Sopenharmony_ci <map name="CONST">src->num >> 2</map> 71bf215546Sopenharmony_ci <map name="SWIZ">src->num & 0x3</map> 72bf215546Sopenharmony_ci <map name="IMMED">extract_reg_uim(src)</map> 73bf215546Sopenharmony_ci </encode> 74bf215546Sopenharmony_ci</bitset> 75bf215546Sopenharmony_ci 76bf215546Sopenharmony_ci<bitset name="#cat3-src-relative" extends="#cat3-src"> 77bf215546Sopenharmony_ci <pattern low="11" high="12">01</pattern> 78bf215546Sopenharmony_ci <encode> 79bf215546Sopenharmony_ci <map name="OFFSET">src->array.offset</map> 80bf215546Sopenharmony_ci </encode> 81bf215546Sopenharmony_ci</bitset> 82bf215546Sopenharmony_ci 83bf215546Sopenharmony_ci<bitset name="#cat3-src-relative-gpr" extends="#cat3-src-relative"> 84bf215546Sopenharmony_ci <display> 85bf215546Sopenharmony_ci {HALF}r<a0.x + {OFFSET}> 86bf215546Sopenharmony_ci </display> 87bf215546Sopenharmony_ci <field name="OFFSET" low="0" high="9" type="int"/> 88bf215546Sopenharmony_ci <pattern pos="10">0</pattern> 89bf215546Sopenharmony_ci</bitset> 90bf215546Sopenharmony_ci 91bf215546Sopenharmony_ci<bitset name="#cat3-src-relative-const" extends="#cat3-src-relative"> 92bf215546Sopenharmony_ci <display> 93bf215546Sopenharmony_ci {HALF}c<a0.x + {OFFSET}> 94bf215546Sopenharmony_ci </display> 95bf215546Sopenharmony_ci <field name="OFFSET" low="0" high="9" type="int"/> 96bf215546Sopenharmony_ci <pattern pos="10">1</pattern> 97bf215546Sopenharmony_ci</bitset> 98bf215546Sopenharmony_ci 99bf215546Sopenharmony_ci<bitset name="#instruction-cat3-base" extends="#instruction"> 100bf215546Sopenharmony_ci <override expr="#cat2-cat3-nop-encoding"> 101bf215546Sopenharmony_ci <display> 102bf215546Sopenharmony_ci {SY}{SS}{JP}{SAT}(nop{NOP}) {UL}{NAME} {DST_HALF}{DST}, {SRC1_NEG}{SRC1}, {SRC2_NEG}{HALF}{SRC2}, {SRC3_NEG}{SRC3} 103bf215546Sopenharmony_ci </display> 104bf215546Sopenharmony_ci <derived name="NOP" expr="#cat2-cat3-nop-value" type="uint"/> 105bf215546Sopenharmony_ci </override> 106bf215546Sopenharmony_ci <display> 107bf215546Sopenharmony_ci {SY}{SS}{JP}{SAT}{REPEAT}{UL}{NAME} {DST_HALF}{DST}, {SRC1_NEG}{SRC1_R}{SRC1}, {SRC2_NEG}{SRC2_R}{HALF}{SRC2}, {SRC3_NEG}{SRC3_R}{SRC3} 108bf215546Sopenharmony_ci </display> 109bf215546Sopenharmony_ci <field name="SRC2_R" pos="15" type="bool" display="(r)"/> 110bf215546Sopenharmony_ci <field name="SRC3_R" pos="29" type="bool" display="(r)"/> 111bf215546Sopenharmony_ci <field name="DST" low="32" high="39" type="#reg-gpr"/> 112bf215546Sopenharmony_ci <field name="REPEAT" low="40" high="41" type="#rptN"/> 113bf215546Sopenharmony_ci <field name="SRC1_R" pos="43" type="bool" display="(r)"/> 114bf215546Sopenharmony_ci <field name="SS" pos="44" type="bool" display="(ss)"/> 115bf215546Sopenharmony_ci <field name="UL" pos="45" type="bool" display="(ul)"/> 116bf215546Sopenharmony_ci <field name="SRC2" low="47" high="54" type="#reg-gpr"/> 117bf215546Sopenharmony_ci <!-- opcode, 4 bits --> 118bf215546Sopenharmony_ci <field name="JP" pos="59" type="bool" display="(jp)"/> 119bf215546Sopenharmony_ci <field name="SY" pos="60" type="bool" display="(sy)"/> 120bf215546Sopenharmony_ci <pattern low="61" high="63">011</pattern> <!-- cat3 --> 121bf215546Sopenharmony_ci <derived name="HALF" expr="#multisrc-half" type="bool" display="h"/> 122bf215546Sopenharmony_ci <derived name="DST_HALF" expr="#dest-half" type="bool" display="h"/> 123bf215546Sopenharmony_ci <encode> 124bf215546Sopenharmony_ci <map name="SRC1_NEG">!!(src->srcs[0]->flags & (IR3_REG_FNEG | IR3_REG_SNEG | IR3_REG_BNOT))</map> 125bf215546Sopenharmony_ci <map name="SRC1_R">extract_SRC1_R(src)</map> 126bf215546Sopenharmony_ci <map name="SRC2_R">extract_SRC2_R(src)</map> 127bf215546Sopenharmony_ci <map name="SRC3_R">!!(src->srcs[2]->flags & IR3_REG_R)</map> 128bf215546Sopenharmony_ci <map name="SRC2_NEG">!!(src->srcs[1]->flags & (IR3_REG_FNEG | IR3_REG_SNEG | IR3_REG_BNOT))</map> 129bf215546Sopenharmony_ci <map name="SRC3_NEG">!!(src->srcs[2]->flags & (IR3_REG_FNEG | IR3_REG_SNEG | IR3_REG_BNOT))</map> 130bf215546Sopenharmony_ci <map name="SRC1">src->srcs[0]</map> 131bf215546Sopenharmony_ci </encode> 132bf215546Sopenharmony_ci</bitset> 133bf215546Sopenharmony_ci 134bf215546Sopenharmony_ci<bitset name="#instruction-cat3" extends="#instruction-cat3-base"> 135bf215546Sopenharmony_ci <derived name="IMMED_ENCODING" expr="#false" type="bool" display="h"/> 136bf215546Sopenharmony_ci 137bf215546Sopenharmony_ci <field name="SRC1" low="0" high="12" type="#cat3-src"> 138bf215546Sopenharmony_ci <param name="HALF"/> 139bf215546Sopenharmony_ci <param name="IMMED_ENCODING"/> 140bf215546Sopenharmony_ci </field> 141bf215546Sopenharmony_ci <field name="SRC1_NEG" pos="14" type="bool" display="(neg)"/> 142bf215546Sopenharmony_ci 143bf215546Sopenharmony_ci <pattern pos="13">0</pattern> 144bf215546Sopenharmony_ci 145bf215546Sopenharmony_ci <field name="SRC3" low="16" high="28" type="#cat3-src"> 146bf215546Sopenharmony_ci <param name="HALF"/> 147bf215546Sopenharmony_ci <param name="IMMED_ENCODING"/> 148bf215546Sopenharmony_ci </field> 149bf215546Sopenharmony_ci 150bf215546Sopenharmony_ci <field name="SRC2_NEG" pos="30" type="bool" display="(neg)"/> 151bf215546Sopenharmony_ci <field name="SRC3_NEG" pos="31" type="bool" display="(neg)"/> 152bf215546Sopenharmony_ci <field name="SAT" pos="42" type="bool" display="(sat)"/> 153bf215546Sopenharmony_ci 154bf215546Sopenharmony_ci <field name="DST_CONV" pos="46" type="bool"> 155bf215546Sopenharmony_ci <doc> 156bf215546Sopenharmony_ci The source precision is determined by the instruction 157bf215546Sopenharmony_ci opcode. If {DST_CONV} the result is widened/narrowed 158bf215546Sopenharmony_ci to the opposite precision. 159bf215546Sopenharmony_ci </doc> 160bf215546Sopenharmony_ci </field> 161bf215546Sopenharmony_ci 162bf215546Sopenharmony_ci <encode> 163bf215546Sopenharmony_ci <map name="DST_CONV"> 164bf215546Sopenharmony_ci ((src->dsts[0]->num >> 2) == 62) ? 0 : 165bf215546Sopenharmony_ci !!((src->srcs[0]->flags ^ src->dsts[0]->flags) & IR3_REG_HALF) 166bf215546Sopenharmony_ci </map> 167bf215546Sopenharmony_ci </encode> 168bf215546Sopenharmony_ci</bitset> 169bf215546Sopenharmony_ci 170bf215546Sopenharmony_ci<!-- TODO check on pre a6xx gens --> 171bf215546Sopenharmony_ci<bitset name="#instruction-cat3-alt" extends="#instruction-cat3-base"> 172bf215546Sopenharmony_ci <doc> 173bf215546Sopenharmony_ci The difference is that this cat3 version does not support plain 174bf215546Sopenharmony_ci const registers as src1/src3 but does support inmidiate values. 175bf215546Sopenharmony_ci On the other hand it still supports relative gpr and consts. 176bf215546Sopenharmony_ci </doc> 177bf215546Sopenharmony_ci 178bf215546Sopenharmony_ci <gen min="600"/> 179bf215546Sopenharmony_ci 180bf215546Sopenharmony_ci <derived name="IMMED_ENCODING" expr="#true" type="bool" display="h"/> 181bf215546Sopenharmony_ci <derived name="SAT" expr="#false" type="bool" display=""/> 182bf215546Sopenharmony_ci 183bf215546Sopenharmony_ci <field name="SRC1" low="0" high="12" type="#cat3-src"> 184bf215546Sopenharmony_ci <param name="HALF"/> 185bf215546Sopenharmony_ci <param name="IMMED_ENCODING"/> 186bf215546Sopenharmony_ci </field> 187bf215546Sopenharmony_ci <field name="SRC1_NEG" pos="14" type="bool" display="(neg)"/> 188bf215546Sopenharmony_ci 189bf215546Sopenharmony_ci <pattern pos="13">1</pattern> 190bf215546Sopenharmony_ci 191bf215546Sopenharmony_ci <field name="SRC3" low="16" high="28" type="#cat3-src"> 192bf215546Sopenharmony_ci <param name="HALF"/> 193bf215546Sopenharmony_ci <param name="IMMED_ENCODING"/> 194bf215546Sopenharmony_ci </field> 195bf215546Sopenharmony_ci 196bf215546Sopenharmony_ci <field name="SRC2_NEG" pos="30" type="bool" display="(neg)"/> 197bf215546Sopenharmony_ci <field name="SRC3_NEG" pos="31" type="bool" display="(neg)"/> 198bf215546Sopenharmony_ci <field name="FULL" pos="42" type="bool"/> 199bf215546Sopenharmony_ci <field name="DST_CONV" pos="46" type="bool"/> 200bf215546Sopenharmony_ci 201bf215546Sopenharmony_ci <encode> 202bf215546Sopenharmony_ci <map name="SRC3">src->srcs[2]</map> 203bf215546Sopenharmony_ci <map name="FULL">!(src->srcs[1]->flags & IR3_REG_HALF)</map> 204bf215546Sopenharmony_ci <map name="DST_CONV"> 205bf215546Sopenharmony_ci ((src->dsts[0]->num >> 2) == 62) ? 0 : 206bf215546Sopenharmony_ci !!((src->srcs[1]->flags ^ src->dsts[0]->flags) & IR3_REG_HALF) 207bf215546Sopenharmony_ci </map> 208bf215546Sopenharmony_ci </encode> 209bf215546Sopenharmony_ci</bitset> 210bf215546Sopenharmony_ci 211bf215546Sopenharmony_ci<bitset name="mad.u16" extends="#instruction-cat3"> 212bf215546Sopenharmony_ci <pattern low="55" high="58">0000</pattern> <!-- OPC --> 213bf215546Sopenharmony_ci <derived name="FULL" expr="#false" type="bool"/> 214bf215546Sopenharmony_ci</bitset> 215bf215546Sopenharmony_ci 216bf215546Sopenharmony_ci<bitset name="madsh.u16" extends="#instruction-cat3"> 217bf215546Sopenharmony_ci <pattern low="55" high="58">0001</pattern> <!-- OPC --> 218bf215546Sopenharmony_ci <derived name="FULL" expr="#true" type="bool"/> 219bf215546Sopenharmony_ci</bitset> 220bf215546Sopenharmony_ci 221bf215546Sopenharmony_ci<bitset name="mad.s16" extends="#instruction-cat3"> 222bf215546Sopenharmony_ci <pattern low="55" high="58">0010</pattern> <!-- OPC --> 223bf215546Sopenharmony_ci <derived name="FULL" expr="#false" type="bool"/> 224bf215546Sopenharmony_ci</bitset> 225bf215546Sopenharmony_ci 226bf215546Sopenharmony_ci<bitset name="madsh.m16" extends="#instruction-cat3"> 227bf215546Sopenharmony_ci <pattern low="55" high="58">0011</pattern> <!-- OPC --> 228bf215546Sopenharmony_ci <derived name="FULL" expr="#true" type="bool"/> 229bf215546Sopenharmony_ci</bitset> 230bf215546Sopenharmony_ci 231bf215546Sopenharmony_ci<bitset name="mad.u24" extends="#instruction-cat3"> 232bf215546Sopenharmony_ci <pattern low="55" high="58">0100</pattern> <!-- OPC --> 233bf215546Sopenharmony_ci <derived name="FULL" expr="#true" type="bool"/> 234bf215546Sopenharmony_ci</bitset> 235bf215546Sopenharmony_ci 236bf215546Sopenharmony_ci<bitset name="mad.s24" extends="#instruction-cat3"> 237bf215546Sopenharmony_ci <pattern low="55" high="58">0101</pattern> <!-- OPC --> 238bf215546Sopenharmony_ci <derived name="FULL" expr="#true" type="bool"/> 239bf215546Sopenharmony_ci</bitset> 240bf215546Sopenharmony_ci 241bf215546Sopenharmony_ci<bitset name="mad.f16" extends="#instruction-cat3"> 242bf215546Sopenharmony_ci <pattern low="55" high="58">0110</pattern> <!-- OPC --> 243bf215546Sopenharmony_ci <derived name="FULL" expr="#false" type="bool"/> 244bf215546Sopenharmony_ci</bitset> 245bf215546Sopenharmony_ci 246bf215546Sopenharmony_ci<bitset name="mad.f32" extends="#instruction-cat3"> 247bf215546Sopenharmony_ci <pattern low="55" high="58">0111</pattern> <!-- OPC --> 248bf215546Sopenharmony_ci <derived name="FULL" expr="#true" type="bool"/> 249bf215546Sopenharmony_ci</bitset> 250bf215546Sopenharmony_ci 251bf215546Sopenharmony_ci<bitset name="sel.b16" extends="#instruction-cat3"> 252bf215546Sopenharmony_ci <pattern low="55" high="58">1000</pattern> <!-- OPC --> 253bf215546Sopenharmony_ci <derived name="FULL" expr="#false" type="bool"/> 254bf215546Sopenharmony_ci</bitset> 255bf215546Sopenharmony_ci 256bf215546Sopenharmony_ci<bitset name="sel.b32" extends="#instruction-cat3"> 257bf215546Sopenharmony_ci <pattern low="55" high="58">1001</pattern> <!-- OPC --> 258bf215546Sopenharmony_ci <derived name="FULL" expr="#true" type="bool"/> 259bf215546Sopenharmony_ci</bitset> 260bf215546Sopenharmony_ci 261bf215546Sopenharmony_ci<bitset name="sel.s16" extends="#instruction-cat3"> 262bf215546Sopenharmony_ci <pattern low="55" high="58">1010</pattern> <!-- OPC --> 263bf215546Sopenharmony_ci <derived name="FULL" expr="#false" type="bool"/> 264bf215546Sopenharmony_ci</bitset> 265bf215546Sopenharmony_ci 266bf215546Sopenharmony_ci<bitset name="sel.s32" extends="#instruction-cat3"> 267bf215546Sopenharmony_ci <pattern low="55" high="58">1011</pattern> <!-- OPC --> 268bf215546Sopenharmony_ci <derived name="FULL" expr="#true" type="bool"/> 269bf215546Sopenharmony_ci</bitset> 270bf215546Sopenharmony_ci 271bf215546Sopenharmony_ci<bitset name="sel.f16" extends="#instruction-cat3"> 272bf215546Sopenharmony_ci <pattern low="55" high="58">1100</pattern> <!-- OPC --> 273bf215546Sopenharmony_ci <derived name="FULL" expr="#false" type="bool"/> 274bf215546Sopenharmony_ci</bitset> 275bf215546Sopenharmony_ci 276bf215546Sopenharmony_ci<bitset name="sel.f32" extends="#instruction-cat3"> 277bf215546Sopenharmony_ci <pattern low="55" high="58">1101</pattern> <!-- OPC --> 278bf215546Sopenharmony_ci <derived name="FULL" expr="#true" type="bool"/> 279bf215546Sopenharmony_ci</bitset> 280bf215546Sopenharmony_ci 281bf215546Sopenharmony_ci<bitset name="sad.s16" extends="#instruction-cat3"> 282bf215546Sopenharmony_ci <pattern low="55" high="58">1110</pattern> <!-- OPC --> 283bf215546Sopenharmony_ci <derived name="FULL" expr="#false" type="bool"/> 284bf215546Sopenharmony_ci</bitset> 285bf215546Sopenharmony_ci 286bf215546Sopenharmony_ci<bitset name="sad.s32" extends="#instruction-cat3"> 287bf215546Sopenharmony_ci <pattern low="55" high="58">1111</pattern> <!-- OPC --> 288bf215546Sopenharmony_ci <derived name="FULL" expr="#false" type="bool"/> <!-- We think? --> 289bf215546Sopenharmony_ci</bitset> 290bf215546Sopenharmony_ci 291bf215546Sopenharmony_ci<bitset name="shrm" extends="#instruction-cat3-alt"> 292bf215546Sopenharmony_ci <doc> 293bf215546Sopenharmony_ci (src2 >> src1) & src3 294bf215546Sopenharmony_ci </doc> 295bf215546Sopenharmony_ci 296bf215546Sopenharmony_ci <pattern low="55" high="58">1000</pattern> <!-- OPC --> 297bf215546Sopenharmony_ci</bitset> 298bf215546Sopenharmony_ci 299bf215546Sopenharmony_ci<bitset name="shlm" extends="#instruction-cat3-alt"> 300bf215546Sopenharmony_ci <doc> 301bf215546Sopenharmony_ci (src2 << src1) & src3 302bf215546Sopenharmony_ci </doc> 303bf215546Sopenharmony_ci 304bf215546Sopenharmony_ci <pattern low="55" high="58">1001</pattern> <!-- OPC --> 305bf215546Sopenharmony_ci</bitset> 306bf215546Sopenharmony_ci 307bf215546Sopenharmony_ci<bitset name="shrg" extends="#instruction-cat3-alt"> 308bf215546Sopenharmony_ci <doc> 309bf215546Sopenharmony_ci (src2 >> src1) | src3 310bf215546Sopenharmony_ci </doc> 311bf215546Sopenharmony_ci 312bf215546Sopenharmony_ci <pattern low="55" high="58">1010</pattern> <!-- OPC --> 313bf215546Sopenharmony_ci</bitset> 314bf215546Sopenharmony_ci 315bf215546Sopenharmony_ci<bitset name="shlg" extends="#instruction-cat3-alt"> 316bf215546Sopenharmony_ci <doc> 317bf215546Sopenharmony_ci (src2 << src1) | src3 318bf215546Sopenharmony_ci </doc> 319bf215546Sopenharmony_ci 320bf215546Sopenharmony_ci <pattern low="55" high="58">1011</pattern> <!-- OPC --> 321bf215546Sopenharmony_ci</bitset> 322bf215546Sopenharmony_ci 323bf215546Sopenharmony_ci<bitset name="andg" extends="#instruction-cat3-alt"> 324bf215546Sopenharmony_ci <doc> 325bf215546Sopenharmony_ci (src2 & src1) | src3 326bf215546Sopenharmony_ci </doc> 327bf215546Sopenharmony_ci 328bf215546Sopenharmony_ci <pattern low="55" high="58">1100</pattern> <!-- OPC --> 329bf215546Sopenharmony_ci</bitset> 330bf215546Sopenharmony_ci 331bf215546Sopenharmony_ci<enum name="#signedness"> 332bf215546Sopenharmony_ci <value val="0" display=".unsigned"/> 333bf215546Sopenharmony_ci <value val="1" display=".mixed"/> 334bf215546Sopenharmony_ci</enum> 335bf215546Sopenharmony_ci 336bf215546Sopenharmony_ci<enum name="#8bitvec2pack"> 337bf215546Sopenharmony_ci <value val="0" display=".low"/> 338bf215546Sopenharmony_ci <value val="1" display=".high"/> 339bf215546Sopenharmony_ci</enum> 340bf215546Sopenharmony_ci 341bf215546Sopenharmony_ci<bitset name="#instruction-cat3-dp" extends="#instruction-cat3-base"> 342bf215546Sopenharmony_ci <gen min="600"/> 343bf215546Sopenharmony_ci 344bf215546Sopenharmony_ci <display> 345bf215546Sopenharmony_ci {SY}{SS}{JP}{SAT}(nop{NOP}) {UL}{NAME}{SRC_SIGN}{SRC_PACK} {DST}, {SRC1}, {SRC2}, {SRC3_NEG}{SRC3} 346bf215546Sopenharmony_ci </display> 347bf215546Sopenharmony_ci 348bf215546Sopenharmony_ci <derived name="FULL" expr="#true" type="bool"/> 349bf215546Sopenharmony_ci 350bf215546Sopenharmony_ci <field name="SRC1" low="0" high="12" type="#cat3-src"> 351bf215546Sopenharmony_ci <param name="HALF"/> 352bf215546Sopenharmony_ci </field> 353bf215546Sopenharmony_ci <field name="SRC_SIGN" pos="14" type="#signedness"/> 354bf215546Sopenharmony_ci 355bf215546Sopenharmony_ci <pattern pos="13">1</pattern> 356bf215546Sopenharmony_ci 357bf215546Sopenharmony_ci <field name="SRC3" low="16" high="28" type="#cat3-src"> 358bf215546Sopenharmony_ci <param name="HALF"/> 359bf215546Sopenharmony_ci </field> 360bf215546Sopenharmony_ci <field name="SRC_PACK" pos="30" type="#8bitvec2pack"/> 361bf215546Sopenharmony_ci <field name="SRC3_NEG" pos="31" type="bool" display="(neg)"/> 362bf215546Sopenharmony_ci <field name="SAT" pos="42" type="bool" display="(sat)"/> 363bf215546Sopenharmony_ci 364bf215546Sopenharmony_ci <encode> 365bf215546Sopenharmony_ci <map name="SRC3">src->srcs[2]</map> 366bf215546Sopenharmony_ci <map name="SRC_SIGN">src->cat3.signedness</map> 367bf215546Sopenharmony_ci <map name="SRC_PACK">src->cat3.packed</map> 368bf215546Sopenharmony_ci </encode> 369bf215546Sopenharmony_ci</bitset> 370bf215546Sopenharmony_ci 371bf215546Sopenharmony_ci<bitset name="dp2acc" extends="#instruction-cat3-dp"> 372bf215546Sopenharmony_ci <doc> 373bf215546Sopenharmony_ci Given: 374bf215546Sopenharmony_ci SRC1 is a i8vec2 or u8vec2 375bf215546Sopenharmony_ci SRC2 is a u8vec2 376bf215546Sopenharmony_ci SRC1 and SRC2 are packed into low or high halves of the registers. 377bf215546Sopenharmony_ci SRC3 is a int32_t or uint32_t 378bf215546Sopenharmony_ci Do: 379bf215546Sopenharmony_ci DST = dot(SRC1, SRC2) + SRC3 380bf215546Sopenharmony_ci </doc> 381bf215546Sopenharmony_ci 382bf215546Sopenharmony_ci <pattern pos="46">0</pattern> 383bf215546Sopenharmony_ci <pattern low="55" high="58">1101</pattern> <!-- OPC --> 384bf215546Sopenharmony_ci</bitset> 385bf215546Sopenharmony_ci 386bf215546Sopenharmony_ci<bitset name="dp4acc" extends="#instruction-cat3-dp"> 387bf215546Sopenharmony_ci <doc> 388bf215546Sopenharmony_ci Same a dp2acc but for vec4 instead of vec2. 389bf215546Sopenharmony_ci Corresponds to packed variantes of OpUDotKHR and OpSUDotKHR. 390bf215546Sopenharmony_ci </doc> 391bf215546Sopenharmony_ci 392bf215546Sopenharmony_ci <pattern pos="46">1</pattern> 393bf215546Sopenharmony_ci <pattern low="55" high="58">1101</pattern> <!-- OPC --> 394bf215546Sopenharmony_ci</bitset> 395bf215546Sopenharmony_ci 396bf215546Sopenharmony_ci<expr name="#wmm-dest-half"> 397bf215546Sopenharmony_ci (!{DST_FULL}) 398bf215546Sopenharmony_ci</expr> 399bf215546Sopenharmony_ci 400bf215546Sopenharmony_ci<bitset name="#instruction-cat3-wmm" extends="#instruction-cat3-base"> 401bf215546Sopenharmony_ci <gen min="600"/> 402bf215546Sopenharmony_ci 403bf215546Sopenharmony_ci <derived name="IMMED_ENCODING" expr="#true" type="bool" display="h"/> 404bf215546Sopenharmony_ci <derived name="SAT" expr="#false" type="bool" display=""/> 405bf215546Sopenharmony_ci <derived name="SRC3_NEG" expr="#false" type="bool" display=""/> 406bf215546Sopenharmony_ci <derived name="DST_HALF" expr="#wmm-dest-half" type="bool" display="h"/> 407bf215546Sopenharmony_ci 408bf215546Sopenharmony_ci <field name="SRC1" low="0" high="12" type="#cat3-src"> 409bf215546Sopenharmony_ci <param name="HALF"/> 410bf215546Sopenharmony_ci </field> 411bf215546Sopenharmony_ci 412bf215546Sopenharmony_ci <pattern pos="13">1</pattern> 413bf215546Sopenharmony_ci <field name="SRC1_NEG" pos="14" type="bool" display="(neg)"/> 414bf215546Sopenharmony_ci 415bf215546Sopenharmony_ci <field name="SRC3" low="16" high="28" type="#cat3-src"> 416bf215546Sopenharmony_ci <param name="HALF"/> 417bf215546Sopenharmony_ci <param name="IMMED_ENCODING"/> 418bf215546Sopenharmony_ci </field> 419bf215546Sopenharmony_ci 420bf215546Sopenharmony_ci <field name="SRC2_NEG" pos="30" type="bool" display="(neg)"/> 421bf215546Sopenharmony_ci <field name="FULL" pos="31" type="bool" display=""/> 422bf215546Sopenharmony_ci <field name="DST_FULL" pos="46" type="bool"/> 423bf215546Sopenharmony_ci 424bf215546Sopenharmony_ci <encode> 425bf215546Sopenharmony_ci <map name="SRC3">src->srcs[2]</map> 426bf215546Sopenharmony_ci <map name="FULL">!(src->srcs[0]->flags & IR3_REG_HALF)</map> 427bf215546Sopenharmony_ci <map name="DST_FULL"> 428bf215546Sopenharmony_ci ((src->dsts[0]->num >> 2) == 62) ? 1 : 429bf215546Sopenharmony_ci !(src->dsts[0]->flags & IR3_REG_HALF) 430bf215546Sopenharmony_ci </map> 431bf215546Sopenharmony_ci </encode> 432bf215546Sopenharmony_ci</bitset> 433bf215546Sopenharmony_ci 434bf215546Sopenharmony_ci<bitset name="wmm" extends="#instruction-cat3-wmm"> 435bf215546Sopenharmony_ci <doc> 436bf215546Sopenharmony_ci Given: 437bf215546Sopenharmony_ci SRC1 = (x_1, x_2, x_3, x_4) - 4 consecutive registers 438bf215546Sopenharmony_ci SRC2 = (y_1, y_2, y_3, y_4) - 4 consecutive registers 439bf215546Sopenharmony_ci SRC3 is an immediate in range of [0, 160] 440bf215546Sopenharmony_ci 441bf215546Sopenharmony_ci Do: 442bf215546Sopenharmony_ci float y_sum = y_1 + y_2 + y_3 + y_4 443bf215546Sopenharmony_ci vec4 result = (x_1 * y_sum, x_2 * y_sum, x_3 * y_sum, x_4 * y_sum) 444bf215546Sopenharmony_ci 445bf215546Sopenharmony_ci Starting from DST reg duplicate *result* into consecutive registers 446bf215546Sopenharmony_ci (1 << (SRC3 / 32)) times. 447bf215546Sopenharmony_ci </doc> 448bf215546Sopenharmony_ci 449bf215546Sopenharmony_ci <pattern pos="42">0</pattern> 450bf215546Sopenharmony_ci <pattern low="55" high="58">1110</pattern> <!-- OPC --> 451bf215546Sopenharmony_ci</bitset> 452bf215546Sopenharmony_ci 453bf215546Sopenharmony_ci<bitset name="wmm.accu" extends="#instruction-cat3-wmm"> 454bf215546Sopenharmony_ci <doc> 455bf215546Sopenharmony_ci Same as wmm but instead of overwriting DST - the result is 456bf215546Sopenharmony_ci added to DST registers, however the first reg of the result 457bf215546Sopenharmony_ci is always overwritten. 458bf215546Sopenharmony_ci </doc> 459bf215546Sopenharmony_ci 460bf215546Sopenharmony_ci <pattern pos="42">1</pattern> 461bf215546Sopenharmony_ci <pattern low="55" high="58">1110</pattern> <!-- OPC --> 462bf215546Sopenharmony_ci</bitset> 463bf215546Sopenharmony_ci 464bf215546Sopenharmony_ci</isa> 465