15ffd83dbSDimitry Andric//===-- SOPInstructions.td - SOP Instruction Definitions ------------------===// 20b57cec5SDimitry Andric// 30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric// 70b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 906c3fb27SDimitry Andricdef GPRIdxMode : CustomOperand<i32>; 100b57cec5SDimitry Andric 110b57cec5SDimitry Andricclass SOP_Pseudo<string opName, dag outs, dag ins, string asmOps, 120b57cec5SDimitry Andric list<dag> pattern=[]> : 130b57cec5SDimitry Andric InstSI<outs, ins, "", pattern>, 140b57cec5SDimitry Andric SIMCInstr<opName, SIEncodingFamily.NONE> { 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric let isPseudo = 1; 170b57cec5SDimitry Andric let isCodeGenOnly = 1; 185f757f3fSDimitry Andric let Size = 4; 190b57cec5SDimitry Andric 200b57cec5SDimitry Andric string Mnemonic = opName; 210b57cec5SDimitry Andric string AsmOperands = asmOps; 220b57cec5SDimitry Andric 230b57cec5SDimitry Andric bits<1> has_sdst = 0; 240b57cec5SDimitry Andric} 250b57cec5SDimitry Andric 260b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 270b57cec5SDimitry Andric// SOP1 Instructions 280b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 290b57cec5SDimitry Andric 300b57cec5SDimitry Andricclass SOP1_Pseudo <string opName, dag outs, dag ins, 310b57cec5SDimitry Andric string asmOps, list<dag> pattern=[]> : 32bdd1243dSDimitry Andric SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> { 330b57cec5SDimitry Andric 340b57cec5SDimitry Andric let mayLoad = 0; 350b57cec5SDimitry Andric let mayStore = 0; 360b57cec5SDimitry Andric let hasSideEffects = 0; 370b57cec5SDimitry Andric let SALU = 1; 380b57cec5SDimitry Andric let SOP1 = 1; 390b57cec5SDimitry Andric let SchedRW = [WriteSALU]; 400b57cec5SDimitry Andric let UseNamedOperandTable = 1; 410b57cec5SDimitry Andric 420b57cec5SDimitry Andric bits<1> has_src0 = 1; 43bdd1243dSDimitry Andric let has_sdst = 1; 440b57cec5SDimitry Andric} 450b57cec5SDimitry Andric 46e8d8bef9SDimitry Andricclass SOP1_Real<bits<8> op, SOP1_Pseudo ps, string real_name = ps.Mnemonic> : 470b57cec5SDimitry Andric InstSI <ps.OutOperandList, ps.InOperandList, 48bdd1243dSDimitry Andric real_name # ps.AsmOperands>, 490b57cec5SDimitry Andric Enc32 { 500b57cec5SDimitry Andric 51fe6060f1SDimitry Andric let SALU = 1; 52fe6060f1SDimitry Andric let SOP1 = 1; 530b57cec5SDimitry Andric let isPseudo = 0; 540b57cec5SDimitry Andric let isCodeGenOnly = 0; 550b57cec5SDimitry Andric let Size = 4; 560b57cec5SDimitry Andric 570b57cec5SDimitry Andric // copy relevant pseudo op flags 580b57cec5SDimitry Andric let SubtargetPredicate = ps.SubtargetPredicate; 590b57cec5SDimitry Andric let AsmMatchConverter = ps.AsmMatchConverter; 60fe6060f1SDimitry Andric let SchedRW = ps.SchedRW; 61fe6060f1SDimitry Andric let mayLoad = ps.mayLoad; 62fe6060f1SDimitry Andric let mayStore = ps.mayStore; 63*0fca6ea1SDimitry Andric let isTerminator = ps.isTerminator; 64*0fca6ea1SDimitry Andric let isReturn = ps.isReturn; 65*0fca6ea1SDimitry Andric let isCall = ps.isCall; 66*0fca6ea1SDimitry Andric let isBranch = ps.isBranch; 67*0fca6ea1SDimitry Andric let isBarrier = ps.isBarrier; 68*0fca6ea1SDimitry Andric let Uses = ps.Uses; 69*0fca6ea1SDimitry Andric let Defs = ps.Defs; 700b57cec5SDimitry Andric 710b57cec5SDimitry Andric // encoding 720b57cec5SDimitry Andric bits<7> sdst; 730b57cec5SDimitry Andric bits<8> src0; 740b57cec5SDimitry Andric 750b57cec5SDimitry Andric let Inst{7-0} = !if(ps.has_src0, src0, ?); 760b57cec5SDimitry Andric let Inst{15-8} = op; 770b57cec5SDimitry Andric let Inst{22-16} = !if(ps.has_sdst, sdst, ?); 780b57cec5SDimitry Andric let Inst{31-23} = 0x17d; //encoding; 790b57cec5SDimitry Andric} 800b57cec5SDimitry Andric 810b57cec5SDimitry Andricclass SOP1_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo < 820b57cec5SDimitry Andric opName, (outs SReg_32:$sdst), 830b57cec5SDimitry Andric !if(tied_in, (ins SSrc_b32:$src0, SReg_32:$sdst_in), 840b57cec5SDimitry Andric (ins SSrc_b32:$src0)), 850b57cec5SDimitry Andric "$sdst, $src0", pattern> { 860b57cec5SDimitry Andric let Constraints = !if(tied_in, "$sdst = $sdst_in", ""); 870b57cec5SDimitry Andric} 880b57cec5SDimitry Andric 89480093f4SDimitry Andric// Only register input allowed. 90480093f4SDimitry Andricclass SOP1_32R <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 91480093f4SDimitry Andric opName, (outs SReg_32:$sdst), (ins SReg_32:$src0), 92480093f4SDimitry Andric "$sdst, $src0", pattern>; 93480093f4SDimitry Andric 940b57cec5SDimitry Andric// 32-bit input, no output. 950b57cec5SDimitry Andricclass SOP1_0_32 <string opName, list<dag> pattern = []> : SOP1_Pseudo < 960b57cec5SDimitry Andric opName, (outs), (ins SSrc_b32:$src0), 970b57cec5SDimitry Andric "$src0", pattern> { 980b57cec5SDimitry Andric let has_sdst = 0; 990b57cec5SDimitry Andric} 1000b57cec5SDimitry Andric 1015ffd83dbSDimitry Andric// Special case for movreld where sdst is treated as a use operand. 1025ffd83dbSDimitry Andricclass SOP1_32_movreld <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 1035ffd83dbSDimitry Andric opName, (outs), (ins SReg_32:$sdst, SSrc_b32:$src0), 1045ffd83dbSDimitry Andric "$sdst, $src0", pattern>; 1055ffd83dbSDimitry Andric 1065ffd83dbSDimitry Andric// Special case for movreld where sdst is treated as a use operand. 1075ffd83dbSDimitry Andricclass SOP1_64_movreld <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 1085ffd83dbSDimitry Andric opName, (outs), (ins SReg_64:$sdst, SSrc_b64:$src0), 1095ffd83dbSDimitry Andric "$sdst, $src0", pattern 1105ffd83dbSDimitry Andric>; 1115ffd83dbSDimitry Andric 1120b57cec5SDimitry Andricclass SOP1_0_32R <string opName, list<dag> pattern = []> : SOP1_Pseudo < 1130b57cec5SDimitry Andric opName, (outs), (ins SReg_32:$src0), 1140b57cec5SDimitry Andric "$src0", pattern> { 1150b57cec5SDimitry Andric let has_sdst = 0; 1160b57cec5SDimitry Andric} 1170b57cec5SDimitry Andric 1180b57cec5SDimitry Andricclass SOP1_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 1190b57cec5SDimitry Andric opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0), 1200b57cec5SDimitry Andric "$sdst, $src0", pattern 1210b57cec5SDimitry Andric>; 1220b57cec5SDimitry Andric 123480093f4SDimitry Andric// Only register input allowed. 124480093f4SDimitry Andricclass SOP1_64R <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 125480093f4SDimitry Andric opName, (outs SReg_64:$sdst), (ins SReg_64:$src0), 126480093f4SDimitry Andric "$sdst, $src0", pattern 127480093f4SDimitry Andric>; 128480093f4SDimitry Andric 1290b57cec5SDimitry Andric// 64-bit input, 32-bit output. 1300b57cec5SDimitry Andricclass SOP1_32_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 1310b57cec5SDimitry Andric opName, (outs SReg_32:$sdst), (ins SSrc_b64:$src0), 1320b57cec5SDimitry Andric "$sdst, $src0", pattern 1330b57cec5SDimitry Andric>; 1340b57cec5SDimitry Andric 1350b57cec5SDimitry Andric// 32-bit input, 64-bit output. 1360b57cec5SDimitry Andricclass SOP1_64_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo < 1370b57cec5SDimitry Andric opName, (outs SReg_64:$sdst), 1380b57cec5SDimitry Andric !if(tied_in, (ins SSrc_b32:$src0, SReg_64:$sdst_in), 1390b57cec5SDimitry Andric (ins SSrc_b32:$src0)), 1400b57cec5SDimitry Andric "$sdst, $src0", pattern> { 1410b57cec5SDimitry Andric let Constraints = !if(tied_in, "$sdst = $sdst_in", ""); 1420b57cec5SDimitry Andric} 1430b57cec5SDimitry Andric 1440b57cec5SDimitry Andric// no input, 64-bit output. 1450b57cec5SDimitry Andricclass SOP1_64_0 <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 1460b57cec5SDimitry Andric opName, (outs SReg_64:$sdst), (ins), "$sdst", pattern> { 1470b57cec5SDimitry Andric let has_src0 = 0; 1480b57cec5SDimitry Andric} 1490b57cec5SDimitry Andric 1500b57cec5SDimitry Andric// 64-bit input, no output 15181ad6265SDimitry Andricclass SOP1_1 <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 15281ad6265SDimitry Andric opName, (outs), (ins SReg_64:$src0), "$src0", pattern> { 1530b57cec5SDimitry Andric let has_sdst = 0; 1540b57cec5SDimitry Andric} 1550b57cec5SDimitry Andric 156bdd1243dSDimitry Andric 1570eae32dcSDimitry Andricclass UniformUnaryFrag<SDPatternOperator Op> : PatFrag < 1580eae32dcSDimitry Andric (ops node:$src0), 1590eae32dcSDimitry Andric (Op $src0), 1600eae32dcSDimitry Andric [{ return !N->isDivergent(); }]> { 1610eae32dcSDimitry Andric // This check is unnecessary as it's captured by the result register 1620eae32dcSDimitry Andric // bank constraint. 1630eae32dcSDimitry Andric // 1640eae32dcSDimitry Andric // FIXME: Should add a way for the emitter to recognize this is a 1650eae32dcSDimitry Andric // trivially true predicate to eliminate the check. 1660eae32dcSDimitry Andric let GISelPredicateCode = [{return true;}]; 1670eae32dcSDimitry Andric} 1680eae32dcSDimitry Andric 1690eae32dcSDimitry Andricclass UniformBinFrag<SDPatternOperator Op> : PatFrag < 1700eae32dcSDimitry Andric (ops node:$src0, node:$src1), 1710eae32dcSDimitry Andric (Op $src0, $src1), 1720eae32dcSDimitry Andric [{ return !N->isDivergent(); }]> { 1730eae32dcSDimitry Andric // This check is unnecessary as it's captured by the result register 1740eae32dcSDimitry Andric // bank constraint. 1750eae32dcSDimitry Andric // 1760eae32dcSDimitry Andric // FIXME: Should add a way for the emitter to recognize this is a 1770eae32dcSDimitry Andric // trivially true predicate to eliminate the check. 1780eae32dcSDimitry Andric let GISelPredicateCode = [{return true;}]; 1790eae32dcSDimitry Andric} 1800eae32dcSDimitry Andric 181bdd1243dSDimitry Andricclass UniformTernaryFrag<SDPatternOperator Op> : PatFrag < 182bdd1243dSDimitry Andric (ops node:$src0, node:$src1, node:$src2), 183bdd1243dSDimitry Andric (Op $src0, $src1, $src2), 184bdd1243dSDimitry Andric [{ return !N->isDivergent(); }]> { 185bdd1243dSDimitry Andric // This check is unnecessary as it's captured by the result register 186bdd1243dSDimitry Andric // bank constraint. 187bdd1243dSDimitry Andric // 188bdd1243dSDimitry Andric // FIXME: Should add a way for the emitter to recognize this is a 189bdd1243dSDimitry Andric // trivially true predicate to eliminate the check. 190bdd1243dSDimitry Andric let GISelPredicateCode = [{return true;}]; 191bdd1243dSDimitry Andric} 192bdd1243dSDimitry Andric 1930eae32dcSDimitry Andricclass DivergentBinFrag<SDPatternOperator Op> : PatFrag < 1940eae32dcSDimitry Andric (ops node:$src0, node:$src1), 1950eae32dcSDimitry Andric (Op $src0, $src1), 1960eae32dcSDimitry Andric [{ return N->isDivergent(); }]> { 1970eae32dcSDimitry Andric // This check is unnecessary as it's captured by the result register 1980eae32dcSDimitry Andric // bank constraint. 1990eae32dcSDimitry Andric // 2000eae32dcSDimitry Andric // FIXME: Should add a way for the emitter to recognize this is a 2010eae32dcSDimitry Andric // trivially true predicate to eliminate the check. 2020eae32dcSDimitry Andric let GISelPredicateCode = [{return true;}]; 2030eae32dcSDimitry Andric} 2040eae32dcSDimitry Andric 2050b57cec5SDimitry Andric 2060b57cec5SDimitry Andriclet isMoveImm = 1 in { 2070b57cec5SDimitry Andric let isReMaterializable = 1, isAsCheapAsAMove = 1 in { 2080b57cec5SDimitry Andric def S_MOV_B32 : SOP1_32 <"s_mov_b32">; 2090b57cec5SDimitry Andric def S_MOV_B64 : SOP1_64 <"s_mov_b64">; 210fe6060f1SDimitry Andric } // End isReMaterializable = 1 2110b57cec5SDimitry Andric 2120b57cec5SDimitry Andric let Uses = [SCC] in { 2130b57cec5SDimitry Andric def S_CMOV_B32 : SOP1_32 <"s_cmov_b32">; 2140b57cec5SDimitry Andric def S_CMOV_B64 : SOP1_64 <"s_cmov_b64">; 2150b57cec5SDimitry Andric } // End Uses = [SCC] 2160b57cec5SDimitry Andric} // End isMoveImm = 1 2170b57cec5SDimitry Andric 218*0fca6ea1SDimitry Andric// Variant of S_MOV_B32 used for reading from volatile registers like 219*0fca6ea1SDimitry Andric// SRC_POPS_EXITING_WAVE_ID. 220*0fca6ea1SDimitry Andriclet hasSideEffects = 1 in 221*0fca6ea1SDimitry Andricdef S_MOV_B32_sideeffects : SOP1_32 <"s_mov_b32">; 222*0fca6ea1SDimitry Andric 2230b57cec5SDimitry Andriclet Defs = [SCC] in { 2240b57cec5SDimitry Andric def S_NOT_B32 : SOP1_32 <"s_not_b32", 2250eae32dcSDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<not> i32:$src0))] 2260b57cec5SDimitry Andric >; 2270b57cec5SDimitry Andric 2280b57cec5SDimitry Andric def S_NOT_B64 : SOP1_64 <"s_not_b64", 2290eae32dcSDimitry Andric [(set i64:$sdst, (UniformUnaryFrag<not> i64:$src0))] 2300b57cec5SDimitry Andric >; 2315f757f3fSDimitry Andric def S_WQM_B32 : SOP1_32 <"s_wqm_b32", 2325f757f3fSDimitry Andric [(set i32:$sdst, (int_amdgcn_s_wqm i32:$src0))]>; 2335f757f3fSDimitry Andric def S_WQM_B64 : SOP1_64 <"s_wqm_b64", 2345f757f3fSDimitry Andric [(set i64:$sdst, (int_amdgcn_s_wqm i64:$src0))]>; 2350b57cec5SDimitry Andric} // End Defs = [SCC] 2360b57cec5SDimitry Andric 2370b57cec5SDimitry Andric 2380b57cec5SDimitry Andriclet WaveSizePredicate = isWave32 in { 2390b57cec5SDimitry Andricdef : GCNPat < 2400b57cec5SDimitry Andric (int_amdgcn_wqm_vote i1:$src0), 241480093f4SDimitry Andric (S_WQM_B32 SSrc_b32:$src0) 2420b57cec5SDimitry Andric>; 2430b57cec5SDimitry Andric} 2440b57cec5SDimitry Andric 2450b57cec5SDimitry Andriclet WaveSizePredicate = isWave64 in { 2460b57cec5SDimitry Andricdef : GCNPat < 2470b57cec5SDimitry Andric (int_amdgcn_wqm_vote i1:$src0), 248480093f4SDimitry Andric (S_WQM_B64 SSrc_b64:$src0) 2490b57cec5SDimitry Andric>; 2500b57cec5SDimitry Andric} 2510b57cec5SDimitry Andric 252fe6060f1SDimitry Andriclet isReMaterializable = 1, isAsCheapAsAMove = 1 in { 2530b57cec5SDimitry Andricdef S_BREV_B32 : SOP1_32 <"s_brev_b32", 25481ad6265SDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<bitreverse> i32:$src0))] 2550b57cec5SDimitry Andric>; 256fe6060f1SDimitry Andricdef S_BREV_B64 : SOP1_64 <"s_brev_b64", 25781ad6265SDimitry Andric [(set i64:$sdst, (UniformUnaryFrag<bitreverse> i64:$src0))] 258fe6060f1SDimitry Andric>; 259fe6060f1SDimitry Andric} // End isReMaterializable = 1, isAsCheapAsAMove = 1 2600b57cec5SDimitry Andric 2610b57cec5SDimitry Andriclet Defs = [SCC] in { 2620b57cec5SDimitry Andricdef S_BCNT0_I32_B32 : SOP1_32 <"s_bcnt0_i32_b32">; 2630b57cec5SDimitry Andricdef S_BCNT0_I32_B64 : SOP1_32_64 <"s_bcnt0_i32_b64">; 2640b57cec5SDimitry Andricdef S_BCNT1_I32_B32 : SOP1_32 <"s_bcnt1_i32_b32", 26504eeddc0SDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<ctpop> i32:$src0))] 2660b57cec5SDimitry Andric>; 2678bcb0991SDimitry Andricdef S_BCNT1_I32_B64 : SOP1_32_64 <"s_bcnt1_i32_b64", 26804eeddc0SDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<ctpop> i64:$src0))] 2698bcb0991SDimitry Andric>; 2700b57cec5SDimitry Andric} // End Defs = [SCC] 2710b57cec5SDimitry Andric 272fe6060f1SDimitry Andriclet isReMaterializable = 1 in { 2730b57cec5SDimitry Andricdef S_FF0_I32_B32 : SOP1_32 <"s_ff0_i32_b32">; 2740b57cec5SDimitry Andricdef S_FF0_I32_B64 : SOP1_32_64 <"s_ff0_i32_b64">; 2755ffd83dbSDimitry Andricdef S_FF1_I32_B64 : SOP1_32_64 <"s_ff1_i32_b64", 2760eae32dcSDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbl_b32> i64:$src0))] 2775ffd83dbSDimitry Andric>; 2780b57cec5SDimitry Andric 2790b57cec5SDimitry Andricdef S_FF1_I32_B32 : SOP1_32 <"s_ff1_i32_b32", 2800eae32dcSDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbl_b32> i32:$src0))] 2810b57cec5SDimitry Andric>; 2820b57cec5SDimitry Andric 2830b57cec5SDimitry Andricdef S_FLBIT_I32_B32 : SOP1_32 <"s_flbit_i32_b32", 2840eae32dcSDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_u32> i32:$src0))] 2850b57cec5SDimitry Andric>; 2860b57cec5SDimitry Andric 2875ffd83dbSDimitry Andricdef S_FLBIT_I32_B64 : SOP1_32_64 <"s_flbit_i32_b64", 2880eae32dcSDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_u32> i64:$src0))] 2895ffd83dbSDimitry Andric>; 2900b57cec5SDimitry Andricdef S_FLBIT_I32 : SOP1_32 <"s_flbit_i32", 2910eae32dcSDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_i32> i32:$src0))] 2920b57cec5SDimitry Andric>; 2930b57cec5SDimitry Andricdef S_FLBIT_I32_I64 : SOP1_32_64 <"s_flbit_i32_i64">; 2940b57cec5SDimitry Andricdef S_SEXT_I32_I8 : SOP1_32 <"s_sext_i32_i8", 29581ad6265SDimitry Andric [(set i32:$sdst, (UniformSextInreg<i8> i32:$src0))] 2960b57cec5SDimitry Andric>; 2970b57cec5SDimitry Andricdef S_SEXT_I32_I16 : SOP1_32 <"s_sext_i32_i16", 29881ad6265SDimitry Andric [(set i32:$sdst, (UniformSextInreg<i16> i32:$src0))] 2990b57cec5SDimitry Andric>; 300fe6060f1SDimitry Andric} // End isReMaterializable = 1 3010b57cec5SDimitry Andric 3020b57cec5SDimitry Andricdef S_BITSET0_B32 : SOP1_32 <"s_bitset0_b32", [], 1>; 3030b57cec5SDimitry Andricdef S_BITSET0_B64 : SOP1_64_32 <"s_bitset0_b64", [], 1>; 3040b57cec5SDimitry Andricdef S_BITSET1_B32 : SOP1_32 <"s_bitset1_b32", [], 1>; 3050b57cec5SDimitry Andricdef S_BITSET1_B64 : SOP1_64_32 <"s_bitset1_b64", [], 1>; 306fe6060f1SDimitry Andric 3077a6dacacSDimitry Andricdef S_GETPC_B64 : SOP1_64_0 <"s_getpc_b64">; 3087a6dacacSDimitry Andric// PSEUDO includes a workaround for a hardware anomaly where some ASICs 3097a6dacacSDimitry Andric// zero-extend the result from 48 bits instead of sign-extending. 3105f757f3fSDimitry Andriclet isReMaterializable = 1 in 3117a6dacacSDimitry Andricdef S_GETPC_B64_pseudo : SOP1_64_0 <"s_getpc_b64", 3120b57cec5SDimitry Andric [(set i64:$sdst, (int_amdgcn_s_getpc))] 3130b57cec5SDimitry Andric>; 3140b57cec5SDimitry Andric 3150b57cec5SDimitry Andriclet isTerminator = 1, isBarrier = 1, SchedRW = [WriteBranch] in { 3160b57cec5SDimitry Andric 3170b57cec5SDimitry Andriclet isBranch = 1, isIndirectBranch = 1 in { 3180b57cec5SDimitry Andricdef S_SETPC_B64 : SOP1_1 <"s_setpc_b64">; 3190b57cec5SDimitry Andric} // End isBranch = 1, isIndirectBranch = 1 3200b57cec5SDimitry Andric 3210b57cec5SDimitry Andriclet isReturn = 1 in { 3220b57cec5SDimitry Andric// Define variant marked as return rather than branch. 32381ad6265SDimitry Andricdef S_SETPC_B64_return : SOP1_1<"">; 3240b57cec5SDimitry Andric} 3250b57cec5SDimitry Andric} // End isTerminator = 1, isBarrier = 1 3260b57cec5SDimitry Andric 3270b57cec5SDimitry Andriclet isCall = 1 in { 3280b57cec5SDimitry Andricdef S_SWAPPC_B64 : SOP1_64 <"s_swappc_b64" 3290b57cec5SDimitry Andric>; 3300b57cec5SDimitry Andric} 3310b57cec5SDimitry Andric 3320b57cec5SDimitry Andricdef S_RFE_B64 : SOP1_1 <"s_rfe_b64">; 3330b57cec5SDimitry Andric 3340b57cec5SDimitry Andriclet hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC] in { 3350b57cec5SDimitry Andric 3360b57cec5SDimitry Andricdef S_AND_SAVEEXEC_B64 : SOP1_64 <"s_and_saveexec_b64">; 3370b57cec5SDimitry Andricdef S_OR_SAVEEXEC_B64 : SOP1_64 <"s_or_saveexec_b64">; 3380b57cec5SDimitry Andricdef S_XOR_SAVEEXEC_B64 : SOP1_64 <"s_xor_saveexec_b64">; 3390b57cec5SDimitry Andricdef S_ANDN2_SAVEEXEC_B64 : SOP1_64 <"s_andn2_saveexec_b64">; 3400b57cec5SDimitry Andricdef S_ORN2_SAVEEXEC_B64 : SOP1_64 <"s_orn2_saveexec_b64">; 3410b57cec5SDimitry Andricdef S_NAND_SAVEEXEC_B64 : SOP1_64 <"s_nand_saveexec_b64">; 3420b57cec5SDimitry Andricdef S_NOR_SAVEEXEC_B64 : SOP1_64 <"s_nor_saveexec_b64">; 3430b57cec5SDimitry Andricdef S_XNOR_SAVEEXEC_B64 : SOP1_64 <"s_xnor_saveexec_b64">; 3440b57cec5SDimitry Andric 3450b57cec5SDimitry Andric} // End hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC] 3460b57cec5SDimitry Andric 3475f757f3fSDimitry Andricdef S_QUADMASK_B32 : SOP1_32 <"s_quadmask_b32", 3485f757f3fSDimitry Andric [(set i32:$sdst, (int_amdgcn_s_quadmask i32:$src0))]>; 3495f757f3fSDimitry Andricdef S_QUADMASK_B64 : SOP1_64 <"s_quadmask_b64", 3505f757f3fSDimitry Andric [(set i64:$sdst, (int_amdgcn_s_quadmask i64:$src0))]>; 3510b57cec5SDimitry Andric 3520b57cec5SDimitry Andriclet Uses = [M0] in { 353480093f4SDimitry Andricdef S_MOVRELS_B32 : SOP1_32R <"s_movrels_b32">; 354480093f4SDimitry Andricdef S_MOVRELS_B64 : SOP1_64R <"s_movrels_b64">; 3555ffd83dbSDimitry Andricdef S_MOVRELD_B32 : SOP1_32_movreld <"s_movreld_b32">; 3565ffd83dbSDimitry Andricdef S_MOVRELD_B64 : SOP1_64_movreld <"s_movreld_b64">; 3570b57cec5SDimitry Andric} // End Uses = [M0] 3580b57cec5SDimitry Andric 3590b57cec5SDimitry Andriclet SubtargetPredicate = isGFX6GFX7GFX8GFX9 in { 3600b57cec5SDimitry Andricdef S_CBRANCH_JOIN : SOP1_0_32R <"s_cbranch_join">; 3610b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX6GFX7GFX8GFX9 3620b57cec5SDimitry Andric 3630b57cec5SDimitry Andriclet Defs = [SCC] in { 364fe6060f1SDimitry Andricdef S_ABS_I32 : SOP1_32 <"s_abs_i32", 36581ad6265SDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<abs> i32:$src0))] 366fe6060f1SDimitry Andric >; 3670b57cec5SDimitry Andric} // End Defs = [SCC] 3680b57cec5SDimitry Andric 3690b57cec5SDimitry Andriclet SubtargetPredicate = HasVGPRIndexMode in { 3700b57cec5SDimitry Andricdef S_SET_GPR_IDX_IDX : SOP1_0_32<"s_set_gpr_idx_idx"> { 3715ffd83dbSDimitry Andric let Uses = [M0, MODE]; 3725ffd83dbSDimitry Andric let Defs = [M0, MODE]; 3730b57cec5SDimitry Andric} 3740b57cec5SDimitry Andric} 3750b57cec5SDimitry Andric 3760b57cec5SDimitry Andriclet SubtargetPredicate = isGFX9Plus in { 3770b57cec5SDimitry Andric let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in { 3780b57cec5SDimitry Andric def S_ANDN1_SAVEEXEC_B64 : SOP1_64<"s_andn1_saveexec_b64">; 3790b57cec5SDimitry Andric def S_ORN1_SAVEEXEC_B64 : SOP1_64<"s_orn1_saveexec_b64">; 3800b57cec5SDimitry Andric def S_ANDN1_WREXEC_B64 : SOP1_64<"s_andn1_wrexec_b64">; 3810b57cec5SDimitry Andric def S_ANDN2_WREXEC_B64 : SOP1_64<"s_andn2_wrexec_b64">; 3820b57cec5SDimitry Andric } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] 3830b57cec5SDimitry Andric 384fe6060f1SDimitry Andric let isReMaterializable = 1 in 3855f757f3fSDimitry Andric def S_BITREPLICATE_B64_B32 : SOP1_64_32<"s_bitreplicate_b64_b32", 3865f757f3fSDimitry Andric [(set i64:$sdst, (int_amdgcn_s_bitreplicate i32:$src0))]>; 3870b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX9Plus 3880b57cec5SDimitry Andric 3890b57cec5SDimitry Andriclet SubtargetPredicate = isGFX10Plus in { 3900b57cec5SDimitry Andric let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in { 3910b57cec5SDimitry Andric def S_AND_SAVEEXEC_B32 : SOP1_32<"s_and_saveexec_b32">; 3920b57cec5SDimitry Andric def S_OR_SAVEEXEC_B32 : SOP1_32<"s_or_saveexec_b32">; 3930b57cec5SDimitry Andric def S_XOR_SAVEEXEC_B32 : SOP1_32<"s_xor_saveexec_b32">; 3940b57cec5SDimitry Andric def S_ANDN2_SAVEEXEC_B32 : SOP1_32<"s_andn2_saveexec_b32">; 3950b57cec5SDimitry Andric def S_ORN2_SAVEEXEC_B32 : SOP1_32<"s_orn2_saveexec_b32">; 3960b57cec5SDimitry Andric def S_NAND_SAVEEXEC_B32 : SOP1_32<"s_nand_saveexec_b32">; 3970b57cec5SDimitry Andric def S_NOR_SAVEEXEC_B32 : SOP1_32<"s_nor_saveexec_b32">; 3980b57cec5SDimitry Andric def S_XNOR_SAVEEXEC_B32 : SOP1_32<"s_xnor_saveexec_b32">; 3990b57cec5SDimitry Andric def S_ANDN1_SAVEEXEC_B32 : SOP1_32<"s_andn1_saveexec_b32">; 4000b57cec5SDimitry Andric def S_ORN1_SAVEEXEC_B32 : SOP1_32<"s_orn1_saveexec_b32">; 4010b57cec5SDimitry Andric def S_ANDN1_WREXEC_B32 : SOP1_32<"s_andn1_wrexec_b32">; 4020b57cec5SDimitry Andric def S_ANDN2_WREXEC_B32 : SOP1_32<"s_andn2_wrexec_b32">; 4030b57cec5SDimitry Andric } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] 4040b57cec5SDimitry Andric 4050b57cec5SDimitry Andric let Uses = [M0] in { 4060b57cec5SDimitry Andric def S_MOVRELSD_2_B32 : SOP1_32<"s_movrelsd_2_b32">; 4070b57cec5SDimitry Andric } // End Uses = [M0] 4080b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX10Plus 4090b57cec5SDimitry Andric 41081ad6265SDimitry Andriclet SubtargetPredicate = isGFX11Plus in { 41181ad6265SDimitry Andric let hasSideEffects = 1 in { 41281ad6265SDimitry Andric // For s_sendmsg_rtn_* the src0 field encodes the message type directly; it 41381ad6265SDimitry Andric // is not an SGPR number. 41481ad6265SDimitry Andric def S_SENDMSG_RTN_B32 : SOP1_Pseudo< 41506c3fb27SDimitry Andric "s_sendmsg_rtn_b32", (outs SReg_32:$sdst), (ins SendMsg:$src0), 41681ad6265SDimitry Andric "$sdst, $src0", [(set i32:$sdst, (int_amdgcn_s_sendmsg_rtn timm:$src0))] 41781ad6265SDimitry Andric >; 41881ad6265SDimitry Andric def S_SENDMSG_RTN_B64 : SOP1_Pseudo< 41906c3fb27SDimitry Andric "s_sendmsg_rtn_b64", (outs SReg_64:$sdst), (ins SendMsg:$src0), 42081ad6265SDimitry Andric "$sdst, $src0", [(set i64:$sdst, (int_amdgcn_s_sendmsg_rtn timm:$src0))] 42181ad6265SDimitry Andric >; 42281ad6265SDimitry Andric } 42381ad6265SDimitry Andric} // End SubtargetPredicate = isGFX11Plus 42481ad6265SDimitry Andric 4255f757f3fSDimitry Andricclass SOP1_F32_Inst<string opName, SDPatternOperator Op, ValueType vt0=f32, 4265f757f3fSDimitry Andric ValueType vt1=vt0> : 4275f757f3fSDimitry Andric SOP1_32<opName, [(set vt0:$sdst, (UniformUnaryFrag<Op> vt1:$src0))]>; 4285f757f3fSDimitry Andric 4295f757f3fSDimitry Andriclet SubtargetPredicate = HasSALUFloatInsts, Uses = [MODE], 4305f757f3fSDimitry Andric SchedRW = [WriteSFPU], isReMaterializable = 1 in { 4315f757f3fSDimitry Andric def S_CVT_F32_I32 : SOP1_F32_Inst<"s_cvt_f32_i32", sint_to_fp, f32, i32>; 4325f757f3fSDimitry Andric def S_CVT_F32_U32 : SOP1_F32_Inst<"s_cvt_f32_u32", uint_to_fp, f32, i32>; 4335f757f3fSDimitry Andric 4345f757f3fSDimitry Andric let mayRaiseFPException = 1 in { 4355f757f3fSDimitry Andric def S_CVT_I32_F32 : SOP1_F32_Inst<"s_cvt_i32_f32", fp_to_sint, i32, f32>; 4365f757f3fSDimitry Andric def S_CVT_U32_F32 : SOP1_F32_Inst<"s_cvt_u32_f32", fp_to_uint, i32, f32>; 4375f757f3fSDimitry Andric def S_CVT_F32_F16 : SOP1_F32_Inst<"s_cvt_f32_f16", fpextend, f32, f16>; 4385f757f3fSDimitry Andric def S_CVT_HI_F32_F16 : SOP1_32<"s_cvt_hi_f32_f16">; 4395f757f3fSDimitry Andric 4405f757f3fSDimitry Andric def S_CEIL_F32 : SOP1_F32_Inst<"s_ceil_f32", fceil>; 4415f757f3fSDimitry Andric def S_FLOOR_F32 : SOP1_F32_Inst<"s_floor_f32", ffloor>; 4425f757f3fSDimitry Andric def S_TRUNC_F32 : SOP1_F32_Inst<"s_trunc_f32", ftrunc>; 4435f757f3fSDimitry Andric def S_RNDNE_F32 : SOP1_F32_Inst<"s_rndne_f32", froundeven>; 4445f757f3fSDimitry Andric 4455f757f3fSDimitry Andric let FPDPRounding = 1 in 4465f757f3fSDimitry Andric def S_CVT_F16_F32 : SOP1_F32_Inst<"s_cvt_f16_f32", fpround, f16, f32>; 4475f757f3fSDimitry Andric 4485f757f3fSDimitry Andric def S_CEIL_F16 : SOP1_F32_Inst<"s_ceil_f16", fceil, f16>; 4495f757f3fSDimitry Andric def S_FLOOR_F16 : SOP1_F32_Inst<"s_floor_f16", ffloor, f16>; 4505f757f3fSDimitry Andric def S_TRUNC_F16 : SOP1_F32_Inst<"s_trunc_f16", ftrunc, f16>; 4515f757f3fSDimitry Andric def S_RNDNE_F16 : SOP1_F32_Inst<"s_rndne_f16", froundeven, f16>; 4525f757f3fSDimitry Andric } // End mayRaiseFPException = 1 4535f757f3fSDimitry Andric} // End SubtargetPredicate = HasSALUFloatInsts, Uses = [MODE] 4545f757f3fSDimitry Andric // SchedRW = [WriteSFPU], isReMaterializable = 1 4555f757f3fSDimitry Andric 4565f757f3fSDimitry Andriclet hasSideEffects = 1 in { 4575f757f3fSDimitry Andriclet has_sdst = 0 in { 4585f757f3fSDimitry Andriclet Uses = [M0] in { 4595f757f3fSDimitry Andricdef S_BARRIER_SIGNAL_M0 : SOP1_Pseudo <"s_barrier_signal m0", (outs), (ins), 4605f757f3fSDimitry Andric "", [(int_amdgcn_s_barrier_signal_var M0)]>{ 4615f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 4625f757f3fSDimitry Andric let isConvergent = 1; 4635f757f3fSDimitry Andric} 4645f757f3fSDimitry Andric 4655f757f3fSDimitry Andricdef S_BARRIER_SIGNAL_ISFIRST_M0 : SOP1_Pseudo <"s_barrier_signal_isfirst m0", (outs), (ins), 4665f757f3fSDimitry Andric "", [(set SCC, (int_amdgcn_s_barrier_signal_isfirst_var M0))]>{ 4675f757f3fSDimitry Andric let Defs = [SCC]; 4685f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 4695f757f3fSDimitry Andric let isConvergent = 1; 4705f757f3fSDimitry Andric} 4715f757f3fSDimitry Andric 4725f757f3fSDimitry Andricdef S_BARRIER_INIT_M0 : SOP1_Pseudo <"s_barrier_init m0", (outs), (ins), 4735f757f3fSDimitry Andric "", []>{ 4745f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 4755f757f3fSDimitry Andric let isConvergent = 1; 4765f757f3fSDimitry Andric} 4775f757f3fSDimitry Andric 4785f757f3fSDimitry Andricdef S_BARRIER_INIT_IMM : SOP1_Pseudo <"s_barrier_init", (outs), 4795f757f3fSDimitry Andric (ins SplitBarrier:$src0), "$src0", []>{ 4805f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 4815f757f3fSDimitry Andric let isConvergent = 1; 4825f757f3fSDimitry Andric} 4835f757f3fSDimitry Andric 4845f757f3fSDimitry Andricdef S_BARRIER_JOIN_M0 : SOP1_Pseudo <"s_barrier_join m0", (outs), (ins), 4855f757f3fSDimitry Andric "", []>{ 4865f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 4875f757f3fSDimitry Andric let isConvergent = 1; 4885f757f3fSDimitry Andric} 4895f757f3fSDimitry Andric 4905f757f3fSDimitry Andricdef S_WAKEUP_BARRIER_M0 : SOP1_Pseudo <"s_wakeup_barrier m0", (outs), (ins), 4915f757f3fSDimitry Andric "", []>{ 4925f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 4935f757f3fSDimitry Andric let isConvergent = 1; 4945f757f3fSDimitry Andric} 4955f757f3fSDimitry Andric} // End Uses = [M0] 4965f757f3fSDimitry Andric 4975f757f3fSDimitry Andricdef S_BARRIER_SIGNAL_IMM : SOP1_Pseudo <"s_barrier_signal", (outs), 4985f757f3fSDimitry Andric (ins SplitBarrier:$src0), "$src0", [(int_amdgcn_s_barrier_signal timm:$src0)]>{ 4995f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 5005f757f3fSDimitry Andric let isConvergent = 1; 5015f757f3fSDimitry Andric} 5025f757f3fSDimitry Andric 5035f757f3fSDimitry Andricdef S_BARRIER_SIGNAL_ISFIRST_IMM : SOP1_Pseudo <"s_barrier_signal_isfirst", (outs), 5045f757f3fSDimitry Andric (ins SplitBarrier:$src0), "$src0", [(set SCC, (int_amdgcn_s_barrier_signal_isfirst timm:$src0))]>{ 5055f757f3fSDimitry Andric let Defs = [SCC]; 5065f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 5075f757f3fSDimitry Andric let isConvergent = 1; 5085f757f3fSDimitry Andric} 5095f757f3fSDimitry Andric 5105f757f3fSDimitry Andricdef S_BARRIER_JOIN_IMM : SOP1_Pseudo <"s_barrier_join", (outs), 5115f757f3fSDimitry Andric (ins SplitBarrier:$src0), "$src0", []>{ 5125f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 5135f757f3fSDimitry Andric let isConvergent = 1; 5145f757f3fSDimitry Andric} 5155f757f3fSDimitry Andric 5165f757f3fSDimitry Andricdef S_WAKEUP_BARRIER_IMM : SOP1_Pseudo <"s_wakeup_barrier", (outs), 5175f757f3fSDimitry Andric (ins SplitBarrier:$src0), "$src0", []>{ 5185f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 5195f757f3fSDimitry Andric let isConvergent = 1; 5205f757f3fSDimitry Andric} 5215f757f3fSDimitry Andric} // End has_sdst = 0 5225f757f3fSDimitry Andric 5235f757f3fSDimitry Andricdef S_GET_BARRIER_STATE_IMM : SOP1_Pseudo <"s_get_barrier_state", (outs SSrc_b32:$sdst), 5245f757f3fSDimitry Andric (ins SplitBarrier:$src0), "$sdst, $src0", []>{ 5255f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 5265f757f3fSDimitry Andric let isConvergent = 1; 5275f757f3fSDimitry Andric} 5285f757f3fSDimitry Andric 5295f757f3fSDimitry Andricdef S_GET_BARRIER_STATE_M0 : SOP1_Pseudo <"s_get_barrier_state $sdst, m0", (outs SSrc_b32:$sdst), 5305f757f3fSDimitry Andric (ins), "", []>{ 5315f757f3fSDimitry Andric let Uses = [M0]; 5325f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 5335f757f3fSDimitry Andric let isConvergent = 1; 5345f757f3fSDimitry Andric} 5355f757f3fSDimitry Andric} // End hasSideEffects = 1 5365f757f3fSDimitry Andric 5370b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 5380b57cec5SDimitry Andric// SOP2 Instructions 5390b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 5400b57cec5SDimitry Andric 5410b57cec5SDimitry Andricclass SOP2_Pseudo<string opName, dag outs, dag ins, 5420b57cec5SDimitry Andric string asmOps, list<dag> pattern=[]> : 543bdd1243dSDimitry Andric SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> { 5440b57cec5SDimitry Andric 5450b57cec5SDimitry Andric let mayLoad = 0; 5460b57cec5SDimitry Andric let mayStore = 0; 5470b57cec5SDimitry Andric let hasSideEffects = 0; 5480b57cec5SDimitry Andric let SALU = 1; 5490b57cec5SDimitry Andric let SOP2 = 1; 5500b57cec5SDimitry Andric let SchedRW = [WriteSALU]; 5510b57cec5SDimitry Andric let UseNamedOperandTable = 1; 5520b57cec5SDimitry Andric 5530b57cec5SDimitry Andric let has_sdst = 1; 5540b57cec5SDimitry Andric 5550b57cec5SDimitry Andric // Pseudo instructions have no encodings, but adding this field here allows 5560b57cec5SDimitry Andric // us to do: 5570b57cec5SDimitry Andric // let sdst = xxx in { 5580b57cec5SDimitry Andric // for multiclasses that include both real and pseudo instructions. 5590b57cec5SDimitry Andric // field bits<7> sdst = 0; 5600b57cec5SDimitry Andric} 5610b57cec5SDimitry Andric 562*0fca6ea1SDimitry Andricclass SOP2_Real<SOP_Pseudo ps, string name = ps.Mnemonic> : 5630b57cec5SDimitry Andric InstSI <ps.OutOperandList, ps.InOperandList, 564*0fca6ea1SDimitry Andric name # ps.AsmOperands> { 565fe6060f1SDimitry Andric let SALU = 1; 566fe6060f1SDimitry Andric let SOP2 = 1; 5670b57cec5SDimitry Andric let isPseudo = 0; 5680b57cec5SDimitry Andric let isCodeGenOnly = 0; 5690b57cec5SDimitry Andric 5700b57cec5SDimitry Andric // copy relevant pseudo op flags 5710b57cec5SDimitry Andric let SubtargetPredicate = ps.SubtargetPredicate; 5720b57cec5SDimitry Andric let AsmMatchConverter = ps.AsmMatchConverter; 5730b57cec5SDimitry Andric let UseNamedOperandTable = ps.UseNamedOperandTable; 5740b57cec5SDimitry Andric let TSFlags = ps.TSFlags; 575fe6060f1SDimitry Andric let SchedRW = ps.SchedRW; 576fe6060f1SDimitry Andric let mayLoad = ps.mayLoad; 577fe6060f1SDimitry Andric let mayStore = ps.mayStore; 5785f757f3fSDimitry Andric let Constraints = ps.Constraints; 5795f757f3fSDimitry Andric let DisableEncoding = ps.DisableEncoding; 580*0fca6ea1SDimitry Andric let Uses = ps.Uses; 581*0fca6ea1SDimitry Andric let Defs = ps.Defs; 5820b57cec5SDimitry Andric 5830b57cec5SDimitry Andric // encoding 5840b57cec5SDimitry Andric bits<7> sdst; 5850b57cec5SDimitry Andric bits<8> src0; 5860b57cec5SDimitry Andric bits<8> src1; 5875f757f3fSDimitry Andric bits<32> imm; 5885f757f3fSDimitry Andric} 5890b57cec5SDimitry Andric 590*0fca6ea1SDimitry Andricclass SOP2_Real32<bits<7> op, SOP_Pseudo ps, string name = ps.Mnemonic> : 591*0fca6ea1SDimitry Andric SOP2_Real<ps, name>, Enc32 { 5920b57cec5SDimitry Andric let Inst{7-0} = src0; 5930b57cec5SDimitry Andric let Inst{15-8} = src1; 5940b57cec5SDimitry Andric let Inst{22-16} = !if(ps.has_sdst, sdst, ?); 5950b57cec5SDimitry Andric let Inst{29-23} = op; 5960b57cec5SDimitry Andric let Inst{31-30} = 0x2; // encoding 5970b57cec5SDimitry Andric} 5980b57cec5SDimitry Andric 599*0fca6ea1SDimitry Andricclass SOP2_Real64<bits<7> op, SOP_Pseudo ps, string name = ps.Mnemonic> : 600*0fca6ea1SDimitry Andric SOP2_Real<ps, name>, Enc64 { 6015f757f3fSDimitry Andric let Inst{7-0} = src0; 6025f757f3fSDimitry Andric let Inst{15-8} = src1; 6035f757f3fSDimitry Andric let Inst{22-16} = !if(ps.has_sdst, sdst, ?); 6045f757f3fSDimitry Andric let Inst{29-23} = op; 6055f757f3fSDimitry Andric let Inst{31-30} = 0x2; // encoding 6065f757f3fSDimitry Andric let Inst{63-32} = imm; 6075f757f3fSDimitry Andric} 6085f757f3fSDimitry Andric 6095f757f3fSDimitry Andricclass SOP2_F16 <string opName, list<dag> pattern=[]> : SOP2_Pseudo < 6105f757f3fSDimitry Andric opName, (outs SReg_32:$sdst), (ins SSrc_f16:$src0, SSrc_f16:$src1), 6115f757f3fSDimitry Andric "$sdst, $src0, $src1", pattern 6125f757f3fSDimitry Andric>; 6130b57cec5SDimitry Andric 6140b57cec5SDimitry Andricclass SOP2_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo < 6150b57cec5SDimitry Andric opName, (outs SReg_32:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1), 6160b57cec5SDimitry Andric "$sdst, $src0, $src1", pattern 6170b57cec5SDimitry Andric>; 6180b57cec5SDimitry Andric 6195f757f3fSDimitry Andricclass SOP2_F32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo < 6205f757f3fSDimitry Andric opName, (outs SReg_32:$sdst), (ins SSrc_f32:$src0, SSrc_f32:$src1), 6215f757f3fSDimitry Andric "$sdst, $src0, $src1", pattern 6225f757f3fSDimitry Andric>; 6235f757f3fSDimitry Andric 6240b57cec5SDimitry Andricclass SOP2_64 <string opName, list<dag> pattern=[]> : SOP2_Pseudo < 6250b57cec5SDimitry Andric opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b64:$src1), 6260b57cec5SDimitry Andric "$sdst, $src0, $src1", pattern 6270b57cec5SDimitry Andric>; 6280b57cec5SDimitry Andric 6290b57cec5SDimitry Andricclass SOP2_64_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo < 6300b57cec5SDimitry Andric opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b32:$src1), 6310b57cec5SDimitry Andric "$sdst, $src0, $src1", pattern 6320b57cec5SDimitry Andric>; 6330b57cec5SDimitry Andric 6340b57cec5SDimitry Andricclass SOP2_64_32_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo < 6350b57cec5SDimitry Andric opName, (outs SReg_64:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1), 6360b57cec5SDimitry Andric "$sdst, $src0, $src1", pattern 6370b57cec5SDimitry Andric>; 6380b57cec5SDimitry Andric 639e8d8bef9SDimitry Andric 6400b57cec5SDimitry Andriclet Defs = [SCC] in { // Carry out goes to SCC 6410b57cec5SDimitry Andriclet isCommutable = 1 in { 6420b57cec5SDimitry Andricdef S_ADD_U32 : SOP2_32 <"s_add_u32">; 6430b57cec5SDimitry Andricdef S_ADD_I32 : SOP2_32 <"s_add_i32", 6440b57cec5SDimitry Andric [(set i32:$sdst, (UniformBinFrag<add> SSrc_b32:$src0, SSrc_b32:$src1))] 6450b57cec5SDimitry Andric>; 6460b57cec5SDimitry Andric} // End isCommutable = 1 6470b57cec5SDimitry Andric 6480b57cec5SDimitry Andricdef S_SUB_U32 : SOP2_32 <"s_sub_u32">; 6490b57cec5SDimitry Andricdef S_SUB_I32 : SOP2_32 <"s_sub_i32", 6500b57cec5SDimitry Andric [(set i32:$sdst, (UniformBinFrag<sub> SSrc_b32:$src0, SSrc_b32:$src1))] 6510b57cec5SDimitry Andric>; 6520b57cec5SDimitry Andric 6530b57cec5SDimitry Andriclet Uses = [SCC] in { // Carry in comes from SCC 6540b57cec5SDimitry Andriclet isCommutable = 1 in { 6550b57cec5SDimitry Andricdef S_ADDC_U32 : SOP2_32 <"s_addc_u32", 6560b57cec5SDimitry Andric [(set i32:$sdst, (UniformBinFrag<adde> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>; 6570b57cec5SDimitry Andric} // End isCommutable = 1 6580b57cec5SDimitry Andric 6590b57cec5SDimitry Andricdef S_SUBB_U32 : SOP2_32 <"s_subb_u32", 6600b57cec5SDimitry Andric [(set i32:$sdst, (UniformBinFrag<sube> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>; 6610b57cec5SDimitry Andric} // End Uses = [SCC] 6620b57cec5SDimitry Andric 6630b57cec5SDimitry Andriclet isCommutable = 1 in { 6640b57cec5SDimitry Andricdef S_MIN_I32 : SOP2_32 <"s_min_i32", 6650eae32dcSDimitry Andric [(set i32:$sdst, (UniformBinFrag<smin> i32:$src0, i32:$src1))] 6660b57cec5SDimitry Andric>; 6670b57cec5SDimitry Andricdef S_MIN_U32 : SOP2_32 <"s_min_u32", 6680eae32dcSDimitry Andric [(set i32:$sdst, (UniformBinFrag<umin> i32:$src0, i32:$src1))] 6690b57cec5SDimitry Andric>; 6700b57cec5SDimitry Andricdef S_MAX_I32 : SOP2_32 <"s_max_i32", 6710eae32dcSDimitry Andric [(set i32:$sdst, (UniformBinFrag<smax> i32:$src0, i32:$src1))] 6720b57cec5SDimitry Andric>; 6730b57cec5SDimitry Andricdef S_MAX_U32 : SOP2_32 <"s_max_u32", 6740eae32dcSDimitry Andric [(set i32:$sdst, (UniformBinFrag<umax> i32:$src0, i32:$src1))] 6750b57cec5SDimitry Andric>; 6760b57cec5SDimitry Andric} // End isCommutable = 1 6770b57cec5SDimitry Andric} // End Defs = [SCC] 6780b57cec5SDimitry Andric 6795f757f3fSDimitry Andriclet SubtargetPredicate = isGFX12Plus in { 6805f757f3fSDimitry Andric def S_ADD_U64 : SOP2_64<"s_add_u64">{ 6815f757f3fSDimitry Andric let isCommutable = 1; 6825ffd83dbSDimitry Andric } 68304eeddc0SDimitry Andric 6845f757f3fSDimitry Andric def S_SUB_U64 : SOP2_64<"s_sub_u64">; 6855f757f3fSDimitry Andric 6865f757f3fSDimitry Andric def S_MUL_U64 : SOP2_64 <"s_mul_u64", 6875f757f3fSDimitry Andric [(set i64:$sdst, (UniformBinFrag<mul> i64:$src0, i64:$src1))]> { 6885f757f3fSDimitry Andric let isCommutable = 1; 6895f757f3fSDimitry Andric } 6905f757f3fSDimitry Andric 6911db9f3b2SDimitry Andric // The higher 32-bits of the inputs contain the sign extension bits. 6921db9f3b2SDimitry Andric def S_MUL_I64_I32_PSEUDO : SPseudoInstSI < 6931db9f3b2SDimitry Andric (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b64:$src1) 6941db9f3b2SDimitry Andric >; 6951db9f3b2SDimitry Andric 6961db9f3b2SDimitry Andric // The higher 32-bits of the inputs are zero. 6971db9f3b2SDimitry Andric def S_MUL_U64_U32_PSEUDO : SPseudoInstSI < 6981db9f3b2SDimitry Andric (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b64:$src1) 6991db9f3b2SDimitry Andric >; 7001db9f3b2SDimitry Andric 7015f757f3fSDimitry Andric} // End SubtargetPredicate = isGFX12Plus 7025f757f3fSDimitry Andric 7035f757f3fSDimitry Andriclet Uses = [SCC] in { 7045f757f3fSDimitry Andric def S_CSELECT_B32 : SOP2_32 <"s_cselect_b32">; 70504eeddc0SDimitry Andric def S_CSELECT_B64 : SOP2_64 <"s_cselect_b64">; 7060b57cec5SDimitry Andric} // End Uses = [SCC] 7070b57cec5SDimitry Andric 7080b57cec5SDimitry Andriclet Defs = [SCC] in { 7090b57cec5SDimitry Andriclet isCommutable = 1 in { 7100b57cec5SDimitry Andricdef S_AND_B32 : SOP2_32 <"s_and_b32", 7110b57cec5SDimitry Andric [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, i32:$src1))] 7120b57cec5SDimitry Andric>; 7130b57cec5SDimitry Andric 7140b57cec5SDimitry Andricdef S_AND_B64 : SOP2_64 <"s_and_b64", 7150b57cec5SDimitry Andric [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, i64:$src1))] 7160b57cec5SDimitry Andric>; 7170b57cec5SDimitry Andric 7180b57cec5SDimitry Andricdef S_OR_B32 : SOP2_32 <"s_or_b32", 7190b57cec5SDimitry Andric [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, i32:$src1))] 7200b57cec5SDimitry Andric>; 7210b57cec5SDimitry Andric 7220b57cec5SDimitry Andricdef S_OR_B64 : SOP2_64 <"s_or_b64", 7230b57cec5SDimitry Andric [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, i64:$src1))] 7240b57cec5SDimitry Andric>; 7250b57cec5SDimitry Andric 7260b57cec5SDimitry Andricdef S_XOR_B32 : SOP2_32 <"s_xor_b32", 7270b57cec5SDimitry Andric [(set i32:$sdst, (UniformBinFrag<xor> i32:$src0, i32:$src1))] 7280b57cec5SDimitry Andric>; 7290b57cec5SDimitry Andric 7300b57cec5SDimitry Andricdef S_XOR_B64 : SOP2_64 <"s_xor_b64", 7310b57cec5SDimitry Andric [(set i64:$sdst, (UniformBinFrag<xor> i64:$src0, i64:$src1))] 7320b57cec5SDimitry Andric>; 7330b57cec5SDimitry Andric 7340b57cec5SDimitry Andricdef S_XNOR_B32 : SOP2_32 <"s_xnor_b32", 73504eeddc0SDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<not> (xor_oneuse i32:$src0, i32:$src1)))] 7360b57cec5SDimitry Andric>; 7370b57cec5SDimitry Andric 7380b57cec5SDimitry Andricdef S_XNOR_B64 : SOP2_64 <"s_xnor_b64", 73904eeddc0SDimitry Andric [(set i64:$sdst, (UniformUnaryFrag<not> (xor_oneuse i64:$src0, i64:$src1)))] 7400b57cec5SDimitry Andric>; 7410b57cec5SDimitry Andric 7420b57cec5SDimitry Andricdef S_NAND_B32 : SOP2_32 <"s_nand_b32", 743349cc55cSDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<not> (and_oneuse i32:$src0, i32:$src1)))] 7440b57cec5SDimitry Andric>; 7450b57cec5SDimitry Andric 7460b57cec5SDimitry Andricdef S_NAND_B64 : SOP2_64 <"s_nand_b64", 747349cc55cSDimitry Andric [(set i64:$sdst, (UniformUnaryFrag<not> (and_oneuse i64:$src0, i64:$src1)))] 7480b57cec5SDimitry Andric>; 7490b57cec5SDimitry Andric 7500b57cec5SDimitry Andricdef S_NOR_B32 : SOP2_32 <"s_nor_b32", 751349cc55cSDimitry Andric [(set i32:$sdst, (UniformUnaryFrag<not> (or_oneuse i32:$src0, i32:$src1)))] 7520b57cec5SDimitry Andric>; 7530b57cec5SDimitry Andric 7540b57cec5SDimitry Andricdef S_NOR_B64 : SOP2_64 <"s_nor_b64", 755349cc55cSDimitry Andric [(set i64:$sdst, (UniformUnaryFrag<not> (or_oneuse i64:$src0, i64:$src1)))] 7560b57cec5SDimitry Andric>; 7570b57cec5SDimitry Andric} // End isCommutable = 1 7580b57cec5SDimitry Andric 759e8d8bef9SDimitry Andric// There are also separate patterns for types other than i32 7600b57cec5SDimitry Andricdef S_ANDN2_B32 : SOP2_32 <"s_andn2_b32", 761*0fca6ea1SDimitry Andric [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, (not i32:$src1)))] 7620b57cec5SDimitry Andric>; 7630b57cec5SDimitry Andric 7640b57cec5SDimitry Andricdef S_ANDN2_B64 : SOP2_64 <"s_andn2_b64", 765*0fca6ea1SDimitry Andric [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, (not i64:$src1)))] 7660b57cec5SDimitry Andric>; 7670b57cec5SDimitry Andric 7680b57cec5SDimitry Andricdef S_ORN2_B32 : SOP2_32 <"s_orn2_b32", 769*0fca6ea1SDimitry Andric [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, (not i32:$src1)))] 7700b57cec5SDimitry Andric>; 7710b57cec5SDimitry Andric 7720b57cec5SDimitry Andricdef S_ORN2_B64 : SOP2_64 <"s_orn2_b64", 773*0fca6ea1SDimitry Andric [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, (not i64:$src1)))] 7740b57cec5SDimitry Andric>; 7750b57cec5SDimitry Andric} // End Defs = [SCC] 7760b57cec5SDimitry Andric 7770b57cec5SDimitry Andric// Use added complexity so these patterns are preferred to the VALU patterns. 7780b57cec5SDimitry Andriclet AddedComplexity = 1 in { 7790b57cec5SDimitry Andric 7800b57cec5SDimitry Andriclet Defs = [SCC] in { 7810b57cec5SDimitry Andric// TODO: b64 versions require VOP3 change since v_lshlrev_b64 is VOP3 7820b57cec5SDimitry Andricdef S_LSHL_B32 : SOP2_32 <"s_lshl_b32", 783349cc55cSDimitry Andric [(set SReg_32:$sdst, (UniformBinFrag<cshl_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))] 7840b57cec5SDimitry Andric>; 7850b57cec5SDimitry Andricdef S_LSHL_B64 : SOP2_64_32 <"s_lshl_b64", 786349cc55cSDimitry Andric [(set SReg_64:$sdst, (UniformBinFrag<cshl_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))] 7870b57cec5SDimitry Andric>; 7880b57cec5SDimitry Andricdef S_LSHR_B32 : SOP2_32 <"s_lshr_b32", 789349cc55cSDimitry Andric [(set SReg_32:$sdst, (UniformBinFrag<csrl_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))] 7900b57cec5SDimitry Andric>; 7910b57cec5SDimitry Andricdef S_LSHR_B64 : SOP2_64_32 <"s_lshr_b64", 792349cc55cSDimitry Andric [(set SReg_64:$sdst, (UniformBinFrag<csrl_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))] 7930b57cec5SDimitry Andric>; 7940b57cec5SDimitry Andricdef S_ASHR_I32 : SOP2_32 <"s_ashr_i32", 795349cc55cSDimitry Andric [(set SReg_32:$sdst, (UniformBinFrag<csra_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))] 7960b57cec5SDimitry Andric>; 7970b57cec5SDimitry Andricdef S_ASHR_I64 : SOP2_64_32 <"s_ashr_i64", 798349cc55cSDimitry Andric [(set SReg_64:$sdst, (UniformBinFrag<csra_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))] 7990b57cec5SDimitry Andric>; 8000b57cec5SDimitry Andric} // End Defs = [SCC] 8010b57cec5SDimitry Andric 802fe6060f1SDimitry Andriclet isReMaterializable = 1 in { 8030b57cec5SDimitry Andricdef S_BFM_B32 : SOP2_32 <"s_bfm_b32", 8040b57cec5SDimitry Andric [(set i32:$sdst, (UniformBinFrag<AMDGPUbfm> i32:$src0, i32:$src1))]>; 8050b57cec5SDimitry Andricdef S_BFM_B64 : SOP2_64_32_32 <"s_bfm_b64">; 8060b57cec5SDimitry Andric 8070b57cec5SDimitry Andricdef S_MUL_I32 : SOP2_32 <"s_mul_i32", 808349cc55cSDimitry Andric [(set i32:$sdst, (UniformBinFrag<mul> i32:$src0, i32:$src1))]> { 8090b57cec5SDimitry Andric let isCommutable = 1; 8100b57cec5SDimitry Andric} 811fe6060f1SDimitry Andric} // End isReMaterializable = 1 8120b57cec5SDimitry Andric} // End AddedComplexity = 1 8130b57cec5SDimitry Andric 8140b57cec5SDimitry Andriclet Defs = [SCC] in { 8150b57cec5SDimitry Andricdef S_BFE_U32 : SOP2_32 <"s_bfe_u32">; 8160b57cec5SDimitry Andricdef S_BFE_I32 : SOP2_32 <"s_bfe_i32">; 8170b57cec5SDimitry Andricdef S_BFE_U64 : SOP2_64_32 <"s_bfe_u64">; 8180b57cec5SDimitry Andricdef S_BFE_I64 : SOP2_64_32 <"s_bfe_i64">; 8190b57cec5SDimitry Andric} // End Defs = [SCC] 8200b57cec5SDimitry Andric 8210b57cec5SDimitry Andricdef S_CBRANCH_G_FORK : SOP2_Pseudo < 8220b57cec5SDimitry Andric "s_cbranch_g_fork", (outs), 8230b57cec5SDimitry Andric (ins SCSrc_b64:$src0, SCSrc_b64:$src1), 8240b57cec5SDimitry Andric "$src0, $src1" 8250b57cec5SDimitry Andric> { 8260b57cec5SDimitry Andric let has_sdst = 0; 8270b57cec5SDimitry Andric let SubtargetPredicate = isGFX6GFX7GFX8GFX9; 8280b57cec5SDimitry Andric} 8290b57cec5SDimitry Andric 8300b57cec5SDimitry Andriclet Defs = [SCC] in { 8310b57cec5SDimitry Andricdef S_ABSDIFF_I32 : SOP2_32 <"s_absdiff_i32">; 8320b57cec5SDimitry Andric} // End Defs = [SCC] 8330b57cec5SDimitry Andric 8340b57cec5SDimitry Andriclet SubtargetPredicate = isGFX8GFX9 in { 8350b57cec5SDimitry Andric def S_RFE_RESTORE_B64 : SOP2_Pseudo < 8360b57cec5SDimitry Andric "s_rfe_restore_b64", (outs), 8370b57cec5SDimitry Andric (ins SSrc_b64:$src0, SSrc_b32:$src1), 8380b57cec5SDimitry Andric "$src0, $src1" 8390b57cec5SDimitry Andric > { 8400b57cec5SDimitry Andric let hasSideEffects = 1; 8410b57cec5SDimitry Andric let has_sdst = 0; 8420b57cec5SDimitry Andric } 8430b57cec5SDimitry Andric} 8440b57cec5SDimitry Andric 8450b57cec5SDimitry Andriclet SubtargetPredicate = isGFX9Plus in { 846fe6060f1SDimitry Andric let isReMaterializable = 1 in { 8470b57cec5SDimitry Andric def S_PACK_LL_B32_B16 : SOP2_32<"s_pack_ll_b32_b16">; 8480b57cec5SDimitry Andric def S_PACK_LH_B32_B16 : SOP2_32<"s_pack_lh_b32_b16">; 8490b57cec5SDimitry Andric def S_PACK_HH_B32_B16 : SOP2_32<"s_pack_hh_b32_b16">; 850fe6060f1SDimitry Andric } // End isReMaterializable = 1 8510b57cec5SDimitry Andric 8520b57cec5SDimitry Andric let Defs = [SCC] in { 8535ffd83dbSDimitry Andric def S_LSHL1_ADD_U32 : SOP2_32<"s_lshl1_add_u32", 8545ffd83dbSDimitry Andric [(set i32:$sdst, (shl1_add SSrc_b32:$src0, SSrc_b32:$src1))] 8555ffd83dbSDimitry Andric >; 8565ffd83dbSDimitry Andric def S_LSHL2_ADD_U32 : SOP2_32<"s_lshl2_add_u32", 8575ffd83dbSDimitry Andric [(set i32:$sdst, (shl2_add SSrc_b32:$src0, SSrc_b32:$src1))] 8585ffd83dbSDimitry Andric >; 8595ffd83dbSDimitry Andric def S_LSHL3_ADD_U32 : SOP2_32<"s_lshl3_add_u32", 8605ffd83dbSDimitry Andric [(set i32:$sdst, (shl3_add SSrc_b32:$src0, SSrc_b32:$src1))] 8615ffd83dbSDimitry Andric >; 8625ffd83dbSDimitry Andric def S_LSHL4_ADD_U32 : SOP2_32<"s_lshl4_add_u32", 8635ffd83dbSDimitry Andric [(set i32:$sdst, (shl4_add SSrc_b32:$src0, SSrc_b32:$src1))] 8645ffd83dbSDimitry Andric >; 8650b57cec5SDimitry Andric } // End Defs = [SCC] 8660b57cec5SDimitry Andric 867fe6060f1SDimitry Andric let isCommutable = 1, isReMaterializable = 1 in { 8685ffd83dbSDimitry Andric def S_MUL_HI_U32 : SOP2_32<"s_mul_hi_u32", 8695ffd83dbSDimitry Andric [(set i32:$sdst, (UniformBinFrag<mulhu> SSrc_b32:$src0, SSrc_b32:$src1))]>; 8705ffd83dbSDimitry Andric def S_MUL_HI_I32 : SOP2_32<"s_mul_hi_i32", 8715ffd83dbSDimitry Andric [(set i32:$sdst, (UniformBinFrag<mulhs> SSrc_b32:$src0, SSrc_b32:$src1))]>; 872fe6060f1SDimitry Andric } // End isCommutable = 1, isReMaterializable = 1 8730b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX9Plus 8740b57cec5SDimitry Andric 87581ad6265SDimitry Andriclet SubtargetPredicate = isGFX11Plus in { 87681ad6265SDimitry Andric def S_PACK_HL_B32_B16 : SOP2_32<"s_pack_hl_b32_b16">; 87781ad6265SDimitry Andric} // End SubtargetPredicate = isGFX11Plus 87881ad6265SDimitry Andric 8795f757f3fSDimitry Andricclass SOP2_F32_Inst<string opName, SDPatternOperator Op, ValueType dstVt=f32> : 8805f757f3fSDimitry Andric SOP2_F32<opName, 8815f757f3fSDimitry Andric [(set dstVt:$sdst, (UniformBinFrag<Op> SSrc_f32:$src0, SSrc_f32:$src1))]>; 8825f757f3fSDimitry Andric 8835f757f3fSDimitry Andricclass SOP2_F16_Inst<string opName, SDPatternOperator Op> : 8845f757f3fSDimitry Andric SOP2_F16<opName, 8855f757f3fSDimitry Andric [(set f16:$sdst, (UniformBinFrag<Op> SSrc_f16:$src0, SSrc_f16:$src1))]>; 8865f757f3fSDimitry Andric 8875f757f3fSDimitry Andriclet SubtargetPredicate = HasSALUFloatInsts, mayRaiseFPException = 1, 8885f757f3fSDimitry Andric Uses = [MODE], SchedRW = [WriteSFPU] in { 8895f757f3fSDimitry Andric let isReMaterializable = 1 in { 8905f757f3fSDimitry Andric let isCommutable = 1 in { 8915f757f3fSDimitry Andric def S_ADD_F32 : SOP2_F32_Inst<"s_add_f32", any_fadd>; 8925f757f3fSDimitry Andric def S_MIN_F32 : SOP2_F32_Inst<"s_min_f32", fminnum_like>; 8935f757f3fSDimitry Andric def S_MAX_F32 : SOP2_F32_Inst<"s_max_f32", fmaxnum_like>; 8945f757f3fSDimitry Andric def S_MUL_F32 : SOP2_F32_Inst<"s_mul_f32", any_fmul>; 8955f757f3fSDimitry Andric 8965f757f3fSDimitry Andric let FixedSize = 1 in 8975f757f3fSDimitry Andric def S_FMAAK_F32 : SOP2_Pseudo< 8985f757f3fSDimitry Andric "s_fmaak_f32", (outs SReg_32:$sdst), 8995f757f3fSDimitry Andric (ins SSrc_f32_Deferred:$src0, SSrc_f32_Deferred:$src1, KImmFP32:$imm), 9005f757f3fSDimitry Andric "$sdst, $src0, $src1, $imm" 9015f757f3fSDimitry Andric >; 9025f757f3fSDimitry Andric 9035f757f3fSDimitry Andric let FPDPRounding = 1 in { 9045f757f3fSDimitry Andric def S_ADD_F16 : SOP2_F16_Inst<"s_add_f16", any_fadd>; 9055f757f3fSDimitry Andric def S_MUL_F16 : SOP2_F16_Inst<"s_mul_f16", any_fmul>; 9065f757f3fSDimitry Andric } // End FPDPRounding 9075f757f3fSDimitry Andric 9085f757f3fSDimitry Andric def S_MIN_F16 : SOP2_F16_Inst<"s_min_f16", fminnum_like>; 9095f757f3fSDimitry Andric def S_MAX_F16 : SOP2_F16_Inst<"s_max_f16", fmaxnum_like>; 9105f757f3fSDimitry Andric } // End isCommutable = 1 9115f757f3fSDimitry Andric 9125f757f3fSDimitry Andric let FPDPRounding = 1 in 9135f757f3fSDimitry Andric def S_SUB_F16 : SOP2_F16_Inst<"s_sub_f16", any_fsub>; 9145f757f3fSDimitry Andric 9155f757f3fSDimitry Andric def S_SUB_F32 : SOP2_F32_Inst<"s_sub_f32", any_fsub>; 9165f757f3fSDimitry Andric def S_CVT_PK_RTZ_F16_F32 : SOP2_F32_Inst<"s_cvt_pk_rtz_f16_f32", 9175f757f3fSDimitry Andric AMDGPUpkrtz_f16_f32, v2f16>; 9185f757f3fSDimitry Andric 9195f757f3fSDimitry Andric let FixedSize = 1 in 9205f757f3fSDimitry Andric def S_FMAMK_F32 : SOP2_Pseudo< 9215f757f3fSDimitry Andric "s_fmamk_f32", (outs SReg_32:$sdst), 9225f757f3fSDimitry Andric (ins SSrc_f32_Deferred:$src0, KImmFP32:$imm, SSrc_f32_Deferred:$src1), 9235f757f3fSDimitry Andric "$sdst, $src0, $imm, $src1" 9245f757f3fSDimitry Andric >; 9255f757f3fSDimitry Andric } // End isReMaterializable = 1 9265f757f3fSDimitry Andric 9275f757f3fSDimitry Andric let Constraints = "$sdst = $src2", DisableEncoding="$src2", 9285f757f3fSDimitry Andric isCommutable = 1, AddedComplexity = 20 in { 9295f757f3fSDimitry Andric def S_FMAC_F32 : SOP2_Pseudo< 9305f757f3fSDimitry Andric "s_fmac_f32", (outs SReg_32:$sdst), 9315f757f3fSDimitry Andric (ins SSrc_f32:$src0, SSrc_f32:$src1, SReg_32:$src2), 9325f757f3fSDimitry Andric "$sdst, $src0, $src1", 9335f757f3fSDimitry Andric [(set f32:$sdst, (UniformTernaryFrag<any_fma> SSrc_f32:$src0, SSrc_f32:$src1, SReg_32:$src2))] 9345f757f3fSDimitry Andric >; 9355f757f3fSDimitry Andric 9365f757f3fSDimitry Andric def S_FMAC_F16 : SOP2_Pseudo< 9375f757f3fSDimitry Andric "s_fmac_f16", (outs SReg_32:$sdst), 9385f757f3fSDimitry Andric (ins SSrc_f16:$src0, SSrc_f16:$src1, SReg_32:$src2), 9395f757f3fSDimitry Andric "$sdst, $src0, $src1", 9405f757f3fSDimitry Andric [(set f16:$sdst, (UniformTernaryFrag<any_fma> SSrc_f16:$src0, SSrc_f16:$src1, SReg_32:$src2))] 9415f757f3fSDimitry Andric >; 9425f757f3fSDimitry Andric } // End Constraints = "$sdst = $src2", DisableEncoding="$src2", 9435f757f3fSDimitry Andric // isCommutable = 1, AddedComplexity = 20 9445f757f3fSDimitry Andric} // End SubtargetPredicate = HasSALUFloatInsts, mayRaiseFPException = 1, 9455f757f3fSDimitry Andric // Uses = [MODE], SchedRW = [WriteSFPU] 9465f757f3fSDimitry Andric 9475f757f3fSDimitry Andric// On GFX12 MIN/MAX instructions do not read MODE register. 9485f757f3fSDimitry Andriclet SubtargetPredicate = isGFX12Plus, mayRaiseFPException = 1, isCommutable = 1, 9495f757f3fSDimitry Andric isReMaterializable = 1, SchedRW = [WriteSFPU] in { 9505f757f3fSDimitry Andric def S_MINIMUM_F32 : SOP2_F32_Inst<"s_minimum_f32", fminimum>; 9515f757f3fSDimitry Andric def S_MAXIMUM_F32 : SOP2_F32_Inst<"s_maximum_f32", fmaximum>; 9525f757f3fSDimitry Andric def S_MINIMUM_F16 : SOP2_F16_Inst<"s_minimum_f16", fminimum>; 9535f757f3fSDimitry Andric def S_MAXIMUM_F16 : SOP2_F16_Inst<"s_maximum_f16", fmaximum>; 9545f757f3fSDimitry Andric} 9555f757f3fSDimitry Andric 9560b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 9570b57cec5SDimitry Andric// SOPK Instructions 9580b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 9590b57cec5SDimitry Andric 9600b57cec5SDimitry Andricclass SOPK_Pseudo <string opName, dag outs, dag ins, 9610b57cec5SDimitry Andric string asmOps, list<dag> pattern=[]> : 962bdd1243dSDimitry Andric SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> { 9630b57cec5SDimitry Andric let mayLoad = 0; 9640b57cec5SDimitry Andric let mayStore = 0; 9650b57cec5SDimitry Andric let hasSideEffects = 0; 9660b57cec5SDimitry Andric let SALU = 1; 9670b57cec5SDimitry Andric let SOPK = 1; 968bdd1243dSDimitry Andric let FixedSize = 1; 9690b57cec5SDimitry Andric let SchedRW = [WriteSALU]; 9700b57cec5SDimitry Andric let UseNamedOperandTable = 1; 9710b57cec5SDimitry Andric 972bdd1243dSDimitry Andric let has_sdst = 1; 9730b57cec5SDimitry Andric} 9740b57cec5SDimitry Andric 975*0fca6ea1SDimitry Andricclass SOPK_Real<SOPK_Pseudo ps, string name = ps.Mnemonic> : 9760b57cec5SDimitry Andric InstSI <ps.OutOperandList, ps.InOperandList, 977*0fca6ea1SDimitry Andric name # ps.AsmOperands> { 978fe6060f1SDimitry Andric let SALU = 1; 979fe6060f1SDimitry Andric let SOPK = 1; 9800b57cec5SDimitry Andric let isPseudo = 0; 9810b57cec5SDimitry Andric let isCodeGenOnly = 0; 982bdd1243dSDimitry Andric let UseNamedOperandTable = 1; 9830b57cec5SDimitry Andric 9840b57cec5SDimitry Andric // copy relevant pseudo op flags 9850b57cec5SDimitry Andric let SubtargetPredicate = ps.SubtargetPredicate; 9860b57cec5SDimitry Andric let AsmMatchConverter = ps.AsmMatchConverter; 9870b57cec5SDimitry Andric let DisableEncoding = ps.DisableEncoding; 9880b57cec5SDimitry Andric let Constraints = ps.Constraints; 989fe6060f1SDimitry Andric let SchedRW = ps.SchedRW; 990fe6060f1SDimitry Andric let mayLoad = ps.mayLoad; 991fe6060f1SDimitry Andric let mayStore = ps.mayStore; 992fe6060f1SDimitry Andric let isBranch = ps.isBranch; 993fe6060f1SDimitry Andric let isCall = ps.isCall; 994*0fca6ea1SDimitry Andric let isTerminator = ps.isTerminator; 995*0fca6ea1SDimitry Andric let isReturn = ps.isReturn; 996*0fca6ea1SDimitry Andric let isBarrier = ps.isBarrier; 997*0fca6ea1SDimitry Andric let Uses = ps.Uses; 998*0fca6ea1SDimitry Andric let Defs = ps.Defs; 9990b57cec5SDimitry Andric 10000b57cec5SDimitry Andric // encoding 10010b57cec5SDimitry Andric bits<7> sdst; 10020b57cec5SDimitry Andric bits<16> simm16; 10030b57cec5SDimitry Andric bits<32> imm; 10040b57cec5SDimitry Andric} 10050b57cec5SDimitry Andric 1006*0fca6ea1SDimitry Andricclass SOPK_Real32<bits<5> op, SOPK_Pseudo ps, string name = ps.Mnemonic> : 1007*0fca6ea1SDimitry Andric SOPK_Real <ps, name>, 10080b57cec5SDimitry Andric Enc32 { 10090b57cec5SDimitry Andric let Inst{15-0} = simm16; 10100b57cec5SDimitry Andric let Inst{22-16} = !if(ps.has_sdst, sdst, ?); 10110b57cec5SDimitry Andric let Inst{27-23} = op; 10120b57cec5SDimitry Andric let Inst{31-28} = 0xb; //encoding 10130b57cec5SDimitry Andric} 10140b57cec5SDimitry Andric 10150b57cec5SDimitry Andricclass SOPK_Real64<bits<5> op, SOPK_Pseudo ps> : 1016349cc55cSDimitry Andric SOPK_Real<ps>, 10170b57cec5SDimitry Andric Enc64 { 10180b57cec5SDimitry Andric let Inst{15-0} = simm16; 10190b57cec5SDimitry Andric let Inst{22-16} = !if(ps.has_sdst, sdst, ?); 10200b57cec5SDimitry Andric let Inst{27-23} = op; 10210b57cec5SDimitry Andric let Inst{31-28} = 0xb; //encoding 10220b57cec5SDimitry Andric let Inst{63-32} = imm; 10230b57cec5SDimitry Andric} 10240b57cec5SDimitry Andric 10250b57cec5SDimitry Andricclass SOPKInstTable <bit is_sopk, string cmpOp = ""> { 10260b57cec5SDimitry Andric bit IsSOPK = is_sopk; 10270b57cec5SDimitry Andric string BaseCmpOp = cmpOp; 10280b57cec5SDimitry Andric} 10290b57cec5SDimitry Andric 10300b57cec5SDimitry Andricclass SOPK_32 <string opName, list<dag> pattern=[]> : SOPK_Pseudo < 10310b57cec5SDimitry Andric opName, 10320b57cec5SDimitry Andric (outs SReg_32:$sdst), 10330b57cec5SDimitry Andric (ins s16imm:$simm16), 10340b57cec5SDimitry Andric "$sdst, $simm16", 10350b57cec5SDimitry Andric pattern>; 10360b57cec5SDimitry Andric 10370b57cec5SDimitry Andricclass SOPK_32_BR <string opName, list<dag> pattern=[]> : SOPK_Pseudo < 10380b57cec5SDimitry Andric opName, 10390b57cec5SDimitry Andric (outs), 104006c3fb27SDimitry Andric (ins SOPPBrTarget:$simm16, SReg_32:$sdst), 10410b57cec5SDimitry Andric "$sdst, $simm16", 10420b57cec5SDimitry Andric pattern> { 10430b57cec5SDimitry Andric let Defs = [EXEC]; 10440b57cec5SDimitry Andric let Uses = [EXEC]; 10450b57cec5SDimitry Andric let isBranch = 1; 10460b57cec5SDimitry Andric let isTerminator = 1; 10470b57cec5SDimitry Andric let SchedRW = [WriteBranch]; 10480b57cec5SDimitry Andric} 10490b57cec5SDimitry Andric 10500b57cec5SDimitry Andricclass SOPK_SCC <string opName, string base_op, bit isSignExt> : SOPK_Pseudo < 10510b57cec5SDimitry Andric opName, 10520b57cec5SDimitry Andric (outs), 10530b57cec5SDimitry Andric !if(isSignExt, 10540b57cec5SDimitry Andric (ins SReg_32:$sdst, s16imm:$simm16), 10550b57cec5SDimitry Andric (ins SReg_32:$sdst, u16imm:$simm16)), 1056bdd1243dSDimitry Andric "$sdst, $simm16">, 10570b57cec5SDimitry Andric SOPKInstTable<1, base_op>{ 10580b57cec5SDimitry Andric let Defs = [SCC]; 10590b57cec5SDimitry Andric} 10600b57cec5SDimitry Andric 10610b57cec5SDimitry Andricclass SOPK_32TIE <string opName, list<dag> pattern=[]> : SOPK_Pseudo < 10620b57cec5SDimitry Andric opName, 10630b57cec5SDimitry Andric (outs SReg_32:$sdst), 10640b57cec5SDimitry Andric (ins SReg_32:$src0, s16imm:$simm16), 10650b57cec5SDimitry Andric "$sdst, $simm16", 10660b57cec5SDimitry Andric pattern 10670b57cec5SDimitry Andric>; 10680b57cec5SDimitry Andric 10690b57cec5SDimitry Andriclet isReMaterializable = 1, isMoveImm = 1 in { 10700b57cec5SDimitry Andricdef S_MOVK_I32 : SOPK_32 <"s_movk_i32">; 10710b57cec5SDimitry Andric} // End isReMaterializable = 1 10720b57cec5SDimitry Andriclet Uses = [SCC] in { 10730b57cec5SDimitry Andricdef S_CMOVK_I32 : SOPK_32 <"s_cmovk_i32">; 10740b57cec5SDimitry Andric} 10750b57cec5SDimitry Andric 10760b57cec5SDimitry Andriclet isCompare = 1 in { 10770b57cec5SDimitry Andric 10780b57cec5SDimitry Andric// This instruction is disabled for now until we can figure out how to teach 10790b57cec5SDimitry Andric// the instruction selector to correctly use the S_CMP* vs V_CMP* 10800b57cec5SDimitry Andric// instructions. 10810b57cec5SDimitry Andric// 10820b57cec5SDimitry Andric// When this instruction is enabled the code generator sometimes produces this 10830b57cec5SDimitry Andric// invalid sequence: 10840b57cec5SDimitry Andric// 10850b57cec5SDimitry Andric// SCC = S_CMPK_EQ_I32 SGPR0, imm 10860b57cec5SDimitry Andric// VCC = COPY SCC 10870b57cec5SDimitry Andric// VGPR0 = V_CNDMASK VCC, VGPR0, VGPR1 10880b57cec5SDimitry Andric// 10890b57cec5SDimitry Andric// def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32", 10900b57cec5SDimitry Andric// [(set i1:$dst, (setcc i32:$src0, imm:$src1, SETEQ))] 10910b57cec5SDimitry Andric// >; 10920b57cec5SDimitry Andric 10930b57cec5SDimitry Andricdef S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32", "s_cmp_eq_i32", 1>; 10940b57cec5SDimitry Andricdef S_CMPK_LG_I32 : SOPK_SCC <"s_cmpk_lg_i32", "s_cmp_lg_i32", 1>; 10950b57cec5SDimitry Andricdef S_CMPK_GT_I32 : SOPK_SCC <"s_cmpk_gt_i32", "s_cmp_gt_i32", 1>; 10960b57cec5SDimitry Andricdef S_CMPK_GE_I32 : SOPK_SCC <"s_cmpk_ge_i32", "s_cmp_ge_i32", 1>; 10970b57cec5SDimitry Andricdef S_CMPK_LT_I32 : SOPK_SCC <"s_cmpk_lt_i32", "s_cmp_lt_i32", 1>; 10980b57cec5SDimitry Andricdef S_CMPK_LE_I32 : SOPK_SCC <"s_cmpk_le_i32", "s_cmp_le_i32", 1>; 10990b57cec5SDimitry Andric 11000b57cec5SDimitry Andricdef S_CMPK_EQ_U32 : SOPK_SCC <"s_cmpk_eq_u32", "s_cmp_eq_u32", 0>; 11010b57cec5SDimitry Andricdef S_CMPK_LG_U32 : SOPK_SCC <"s_cmpk_lg_u32", "s_cmp_lg_u32", 0>; 11020b57cec5SDimitry Andricdef S_CMPK_GT_U32 : SOPK_SCC <"s_cmpk_gt_u32", "s_cmp_gt_u32", 0>; 11030b57cec5SDimitry Andricdef S_CMPK_GE_U32 : SOPK_SCC <"s_cmpk_ge_u32", "s_cmp_ge_u32", 0>; 11040b57cec5SDimitry Andricdef S_CMPK_LT_U32 : SOPK_SCC <"s_cmpk_lt_u32", "s_cmp_lt_u32", 0>; 11050b57cec5SDimitry Andricdef S_CMPK_LE_U32 : SOPK_SCC <"s_cmpk_le_u32", "s_cmp_le_u32", 0>; 11060b57cec5SDimitry Andric} // End isCompare = 1 11070b57cec5SDimitry Andric 1108bdd1243dSDimitry Andriclet isCommutable = 1, DisableEncoding = "$src0", 11090b57cec5SDimitry Andric Constraints = "$sdst = $src0" in { 1110bdd1243dSDimitry Andric let Defs = [SCC] in 11110b57cec5SDimitry Andric def S_ADDK_I32 : SOPK_32TIE <"s_addk_i32">; 11120b57cec5SDimitry Andric def S_MULK_I32 : SOPK_32TIE <"s_mulk_i32">; 11130b57cec5SDimitry Andric} 11140b57cec5SDimitry Andric 11150b57cec5SDimitry Andriclet SubtargetPredicate = isGFX6GFX7GFX8GFX9 in 11160b57cec5SDimitry Andricdef S_CBRANCH_I_FORK : SOPK_Pseudo < 11170b57cec5SDimitry Andric "s_cbranch_i_fork", 111806c3fb27SDimitry Andric (outs), (ins SReg_64:$sdst, SOPPBrTarget:$simm16), 11190b57cec5SDimitry Andric "$sdst, $simm16" 11200b57cec5SDimitry Andric>; 11210b57cec5SDimitry Andric 112281ad6265SDimitry Andric// This is hasSideEffects to allow its use in readcyclecounter selection. 1123e8d8bef9SDimitry Andric// FIXME: Need to truncate immediate to 16-bits. 1124*0fca6ea1SDimitry Andric// FIXME: Should have separate pseudos for known may read MODE and 1125*0fca6ea1SDimitry Andric// only read MODE. 11260b57cec5SDimitry Andricdef S_GETREG_B32 : SOPK_Pseudo < 11270b57cec5SDimitry Andric "s_getreg_b32", 11280b57cec5SDimitry Andric (outs SReg_32:$sdst), (ins hwreg:$simm16), 1129e8d8bef9SDimitry Andric "$sdst, $simm16", 1130e8d8bef9SDimitry Andric [(set i32:$sdst, (int_amdgcn_s_getreg (i32 timm:$simm16)))]> { 1131e8d8bef9SDimitry Andric let hasSideEffects = 1; 1132*0fca6ea1SDimitry Andric let Uses = [MODE]; 11330b57cec5SDimitry Andric} 11340b57cec5SDimitry Andric 11350eae32dcSDimitry Andriclet Defs = [MODE], Uses = [MODE] in { 11360b57cec5SDimitry Andric 1137e8d8bef9SDimitry Andric// FIXME: Need to truncate immediate to 16-bits. 1138e8d8bef9SDimitry Andricclass S_SETREG_B32_Pseudo <list<dag> pattern=[]> : SOPK_Pseudo < 11390b57cec5SDimitry Andric "s_setreg_b32", 11400b57cec5SDimitry Andric (outs), (ins SReg_32:$sdst, hwreg:$simm16), 11410b57cec5SDimitry Andric "$simm16, $sdst", 1142e8d8bef9SDimitry Andric pattern>; 11435ffd83dbSDimitry Andric 1144e8d8bef9SDimitry Andricdef S_SETREG_B32 : S_SETREG_B32_Pseudo < 11457a6dacacSDimitry Andric [(int_amdgcn_s_setreg (i32 SIMM16bit:$simm16), i32:$sdst)]> { 11465ffd83dbSDimitry Andric // Use custom inserter to optimize some cases to 1147e8d8bef9SDimitry Andric // S_DENORM_MODE/S_ROUND_MODE/S_SETREG_B32_mode. 11485ffd83dbSDimitry Andric let usesCustomInserter = 1; 1149e8d8bef9SDimitry Andric let hasSideEffects = 1; 1150e8d8bef9SDimitry Andric} 1151e8d8bef9SDimitry Andric 1152e8d8bef9SDimitry Andric// Variant of SETREG that is guaranteed to only touch FP bits in the MODE 1153e8d8bef9SDimitry Andric// register, so doesn't have unmodeled side effects. 1154e8d8bef9SDimitry Andricdef S_SETREG_B32_mode : S_SETREG_B32_Pseudo { 1155e8d8bef9SDimitry Andric let hasSideEffects = 0; 11565ffd83dbSDimitry Andric} 11570b57cec5SDimitry Andric 11580b57cec5SDimitry Andric// FIXME: Not on SI? 11590b57cec5SDimitry Andric//def S_GETREG_REGRD_B32 : SOPK_32 <sopk<0x14, 0x13>, "s_getreg_regrd_b32">; 11600b57cec5SDimitry Andric 1161e8d8bef9SDimitry Andricclass S_SETREG_IMM32_B32_Pseudo : SOPK_Pseudo < 11620b57cec5SDimitry Andric "s_setreg_imm32_b32", 11630b57cec5SDimitry Andric (outs), (ins i32imm:$imm, hwreg:$simm16), 11640b57cec5SDimitry Andric "$simm16, $imm"> { 11650b57cec5SDimitry Andric let Size = 8; // Unlike every other SOPK instruction. 11660b57cec5SDimitry Andric let has_sdst = 0; 11670b57cec5SDimitry Andric} 11680b57cec5SDimitry Andric 1169e8d8bef9SDimitry Andricdef S_SETREG_IMM32_B32 : S_SETREG_IMM32_B32_Pseudo { 1170e8d8bef9SDimitry Andric let hasSideEffects = 1; 11715ffd83dbSDimitry Andric} 1172e8d8bef9SDimitry Andric 1173e8d8bef9SDimitry Andric// Variant of SETREG_IMM32 that is guaranteed to only touch FP bits in the MODE 1174e8d8bef9SDimitry Andric// register, so doesn't have unmodeled side effects. 1175e8d8bef9SDimitry Andricdef S_SETREG_IMM32_B32_mode : S_SETREG_IMM32_B32_Pseudo { 1176e8d8bef9SDimitry Andric let hasSideEffects = 0; 1177e8d8bef9SDimitry Andric} 1178e8d8bef9SDimitry Andric 11790eae32dcSDimitry Andric} // End Defs = [MODE], Uses = [MODE] 11800b57cec5SDimitry Andric 11810b57cec5SDimitry Andricclass SOPK_WAITCNT<string opName, list<dag> pat=[]> : 11820b57cec5SDimitry Andric SOPK_Pseudo< 11830b57cec5SDimitry Andric opName, 11840b57cec5SDimitry Andric (outs), 11850b57cec5SDimitry Andric (ins SReg_32:$sdst, s16imm:$simm16), 11860b57cec5SDimitry Andric "$sdst, $simm16", 11870b57cec5SDimitry Andric pat> { 11880b57cec5SDimitry Andric let hasSideEffects = 1; 11890b57cec5SDimitry Andric let mayLoad = 1; 11900b57cec5SDimitry Andric let mayStore = 1; 11910b57cec5SDimitry Andric let has_sdst = 1; // First source takes place of sdst in encoding 11920b57cec5SDimitry Andric} 11930b57cec5SDimitry Andric 11940b57cec5SDimitry Andriclet SubtargetPredicate = isGFX9Plus in { 11950b57cec5SDimitry Andric def S_CALL_B64 : SOPK_Pseudo< 11960b57cec5SDimitry Andric "s_call_b64", 11970b57cec5SDimitry Andric (outs SReg_64:$sdst), 119806c3fb27SDimitry Andric (ins SOPPBrTarget:$simm16), 11990b57cec5SDimitry Andric "$sdst, $simm16"> { 12000b57cec5SDimitry Andric let isCall = 1; 12010b57cec5SDimitry Andric } 12020b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX9Plus 12030b57cec5SDimitry Andric 1204*0fca6ea1SDimitry Andricdef VersionImm : S16ImmOperand { 1205*0fca6ea1SDimitry Andric let DecoderMethod = "decodeVersionImm"; 1206*0fca6ea1SDimitry Andric} 1207*0fca6ea1SDimitry Andric 12080b57cec5SDimitry Andriclet SubtargetPredicate = isGFX10Plus in { 12090b57cec5SDimitry Andric def S_VERSION : SOPK_Pseudo< 12100b57cec5SDimitry Andric "s_version", 12110b57cec5SDimitry Andric (outs), 1212*0fca6ea1SDimitry Andric (ins VersionImm:$simm16), 12130b57cec5SDimitry Andric "$simm16"> { 12140b57cec5SDimitry Andric let has_sdst = 0; 12150b57cec5SDimitry Andric } 12165f757f3fSDimitry Andric} // End SubtargetPredicate = isGFX10Plus 12170b57cec5SDimitry Andric 12185f757f3fSDimitry Andriclet SubtargetPredicate = isGFX10GFX11 in { 12190b57cec5SDimitry Andric def S_SUBVECTOR_LOOP_BEGIN : SOPK_32_BR<"s_subvector_loop_begin">; 12200b57cec5SDimitry Andric def S_SUBVECTOR_LOOP_END : SOPK_32_BR<"s_subvector_loop_end">; 12210b57cec5SDimitry Andric 12220b57cec5SDimitry Andric def S_WAITCNT_VSCNT : SOPK_WAITCNT<"s_waitcnt_vscnt">; 12230b57cec5SDimitry Andric def S_WAITCNT_VMCNT : SOPK_WAITCNT<"s_waitcnt_vmcnt">; 12240b57cec5SDimitry Andric def S_WAITCNT_EXPCNT : SOPK_WAITCNT<"s_waitcnt_expcnt">; 12250b57cec5SDimitry Andric def S_WAITCNT_LGKMCNT : SOPK_WAITCNT<"s_waitcnt_lgkmcnt">; 12261db9f3b2SDimitry Andric} // End SubtargetPredicate = isGFX10GFX11 12270b57cec5SDimitry Andric 12280b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 12290b57cec5SDimitry Andric// SOPC Instructions 12300b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 12310b57cec5SDimitry Andric 1232e8d8bef9SDimitry Andricclass SOPC_Pseudo<string opName, dag outs, dag ins, 1233e8d8bef9SDimitry Andric string asmOps, list<dag> pattern=[]> : 1234bdd1243dSDimitry Andric SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> { 1235e8d8bef9SDimitry Andric let mayLoad = 0; 1236e8d8bef9SDimitry Andric let mayStore = 0; 1237e8d8bef9SDimitry Andric let hasSideEffects = 0; 1238e8d8bef9SDimitry Andric let SALU = 1; 1239e8d8bef9SDimitry Andric let SOPC = 1; 1240e8d8bef9SDimitry Andric let Defs = [SCC]; 1241e8d8bef9SDimitry Andric let SchedRW = [WriteSALU]; 1242e8d8bef9SDimitry Andric let UseNamedOperandTable = 1; 1243e8d8bef9SDimitry Andric} 1244e8d8bef9SDimitry Andric 1245bdd1243dSDimitry Andricclass SOPC_Real<bits<7> op, SOPC_Pseudo ps> : 1246e8d8bef9SDimitry Andric InstSI <ps.OutOperandList, ps.InOperandList, 1247bdd1243dSDimitry Andric ps.Mnemonic # ps.AsmOperands>, 1248e8d8bef9SDimitry Andric Enc32 { 1249fe6060f1SDimitry Andric let SALU = 1; 1250fe6060f1SDimitry Andric let SOPC = 1; 1251e8d8bef9SDimitry Andric let isPseudo = 0; 1252e8d8bef9SDimitry Andric let isCodeGenOnly = 0; 1253e8d8bef9SDimitry Andric 1254e8d8bef9SDimitry Andric // copy relevant pseudo op flags 1255e8d8bef9SDimitry Andric let SubtargetPredicate = ps.SubtargetPredicate; 1256e8d8bef9SDimitry Andric let OtherPredicates = ps.OtherPredicates; 1257e8d8bef9SDimitry Andric let AsmMatchConverter = ps.AsmMatchConverter; 1258e8d8bef9SDimitry Andric let UseNamedOperandTable = ps.UseNamedOperandTable; 1259e8d8bef9SDimitry Andric let TSFlags = ps.TSFlags; 1260fe6060f1SDimitry Andric let SchedRW = ps.SchedRW; 1261fe6060f1SDimitry Andric let mayLoad = ps.mayLoad; 1262fe6060f1SDimitry Andric let mayStore = ps.mayStore; 1263*0fca6ea1SDimitry Andric let Uses = ps.Uses; 1264*0fca6ea1SDimitry Andric let Defs = ps.Defs; 1265e8d8bef9SDimitry Andric 1266e8d8bef9SDimitry Andric // encoding 12670b57cec5SDimitry Andric bits<8> src0; 12680b57cec5SDimitry Andric bits<8> src1; 12690b57cec5SDimitry Andric 12700b57cec5SDimitry Andric let Inst{7-0} = src0; 12710b57cec5SDimitry Andric let Inst{15-8} = src1; 12720b57cec5SDimitry Andric let Inst{22-16} = op; 12730b57cec5SDimitry Andric let Inst{31-23} = 0x17e; 12740b57cec5SDimitry Andric} 12750b57cec5SDimitry Andric 1276e8d8bef9SDimitry Andricclass SOPC_Base <RegisterOperand rc0, RegisterOperand rc1, 1277e8d8bef9SDimitry Andric string opName, list<dag> pattern = []> : SOPC_Pseudo < 1278e8d8bef9SDimitry Andric opName, (outs), (ins rc0:$src0, rc1:$src1), 1279e8d8bef9SDimitry Andric "$src0, $src1", pattern > { 12800b57cec5SDimitry Andric} 12810b57cec5SDimitry Andric 1282e8d8bef9SDimitry Andricclass SOPC_Helper <RegisterOperand rc, ValueType vt, 12838bcb0991SDimitry Andric string opName, SDPatternOperator cond> : SOPC_Base < 1284e8d8bef9SDimitry Andric rc, rc, opName, 1285bdd1243dSDimitry Andric [(set SCC, (UniformTernaryFrag<setcc> vt:$src0, vt:$src1, cond))] > { 12860b57cec5SDimitry Andric} 12870b57cec5SDimitry Andric 1288e8d8bef9SDimitry Andricclass SOPC_CMP_32<string opName, 12898bcb0991SDimitry Andric SDPatternOperator cond = COND_NULL, string revOp = opName> 1290e8d8bef9SDimitry Andric : SOPC_Helper<SSrc_b32, i32, opName, cond>, 12910b57cec5SDimitry Andric Commutable_REV<revOp, !eq(revOp, opName)>, 12920b57cec5SDimitry Andric SOPKInstTable<0, opName> { 12930b57cec5SDimitry Andric let isCompare = 1; 12940b57cec5SDimitry Andric let isCommutable = 1; 12950b57cec5SDimitry Andric} 12960b57cec5SDimitry Andric 12975f757f3fSDimitry Andricclass SOPC_CMP_F32<string opName, 12985f757f3fSDimitry Andric SDPatternOperator cond = COND_NULL, string revOp = opName> 12995f757f3fSDimitry Andric : SOPC_Helper<SSrc_b32, f32, opName, cond>, 13005f757f3fSDimitry Andric Commutable_REV<revOp, !eq(revOp, opName)>, 13015f757f3fSDimitry Andric SOPKInstTable<0, opName> { 13025f757f3fSDimitry Andric let isCompare = 1; 13035f757f3fSDimitry Andric let isCommutable = 1; 13045f757f3fSDimitry Andric let mayRaiseFPException = 1; 13055f757f3fSDimitry Andric let Uses = [MODE]; 13065f757f3fSDimitry Andric let SchedRW = [WriteSFPU]; 13075f757f3fSDimitry Andric} 13085f757f3fSDimitry Andric 13095f757f3fSDimitry Andricclass SOPC_CMP_F16<string opName, 13105f757f3fSDimitry Andric SDPatternOperator cond = COND_NULL, string revOp = opName> 13115f757f3fSDimitry Andric : SOPC_Helper<SSrc_b16, f16, opName, cond>, 13125f757f3fSDimitry Andric Commutable_REV<revOp, !eq(revOp, opName)>, 13135f757f3fSDimitry Andric SOPKInstTable<0, opName> { 13145f757f3fSDimitry Andric let isCompare = 1; 13155f757f3fSDimitry Andric let isCommutable = 1; 13165f757f3fSDimitry Andric let mayRaiseFPException = 1; 13175f757f3fSDimitry Andric let Uses = [MODE]; 13185f757f3fSDimitry Andric let SchedRW = [WriteSFPU]; 13195f757f3fSDimitry Andric} 13205f757f3fSDimitry Andric 1321e8d8bef9SDimitry Andricclass SOPC_CMP_64<string opName, 13228bcb0991SDimitry Andric SDPatternOperator cond = COND_NULL, string revOp = opName> 1323e8d8bef9SDimitry Andric : SOPC_Helper<SSrc_b64, i64, opName, cond>, 13240b57cec5SDimitry Andric Commutable_REV<revOp, !eq(revOp, opName)> { 13250b57cec5SDimitry Andric let isCompare = 1; 13260b57cec5SDimitry Andric let isCommutable = 1; 13270b57cec5SDimitry Andric} 13280b57cec5SDimitry Andric 1329e8d8bef9SDimitry Andricclass SOPC_32<string opName, list<dag> pattern = []> 1330e8d8bef9SDimitry Andric : SOPC_Base<SSrc_b32, SSrc_b32, opName, pattern>; 13310b57cec5SDimitry Andric 1332e8d8bef9SDimitry Andricclass SOPC_64_32<string opName, list<dag> pattern = []> 1333e8d8bef9SDimitry Andric : SOPC_Base<SSrc_b64, SSrc_b32, opName, pattern>; 13340b57cec5SDimitry Andric 1335e8d8bef9SDimitry Andricdef S_CMP_EQ_I32 : SOPC_CMP_32 <"s_cmp_eq_i32">; 1336e8d8bef9SDimitry Andricdef S_CMP_LG_I32 : SOPC_CMP_32 <"s_cmp_lg_i32">; 1337e8d8bef9SDimitry Andricdef S_CMP_GT_I32 : SOPC_CMP_32 <"s_cmp_gt_i32", COND_SGT>; 1338e8d8bef9SDimitry Andricdef S_CMP_GE_I32 : SOPC_CMP_32 <"s_cmp_ge_i32", COND_SGE>; 1339e8d8bef9SDimitry Andricdef S_CMP_LT_I32 : SOPC_CMP_32 <"s_cmp_lt_i32", COND_SLT, "s_cmp_gt_i32">; 1340e8d8bef9SDimitry Andricdef S_CMP_LE_I32 : SOPC_CMP_32 <"s_cmp_le_i32", COND_SLE, "s_cmp_ge_i32">; 1341e8d8bef9SDimitry Andricdef S_CMP_EQ_U32 : SOPC_CMP_32 <"s_cmp_eq_u32", COND_EQ>; 1342e8d8bef9SDimitry Andricdef S_CMP_LG_U32 : SOPC_CMP_32 <"s_cmp_lg_u32", COND_NE>; 1343e8d8bef9SDimitry Andricdef S_CMP_GT_U32 : SOPC_CMP_32 <"s_cmp_gt_u32", COND_UGT>; 1344e8d8bef9SDimitry Andricdef S_CMP_GE_U32 : SOPC_CMP_32 <"s_cmp_ge_u32", COND_UGE>; 1345e8d8bef9SDimitry Andricdef S_CMP_LT_U32 : SOPC_CMP_32 <"s_cmp_lt_u32", COND_ULT, "s_cmp_gt_u32">; 1346e8d8bef9SDimitry Andricdef S_CMP_LE_U32 : SOPC_CMP_32 <"s_cmp_le_u32", COND_ULE, "s_cmp_ge_u32">; 13470b57cec5SDimitry Andric 1348e8d8bef9SDimitry Andricdef S_BITCMP0_B32 : SOPC_32 <"s_bitcmp0_b32">; 1349e8d8bef9SDimitry Andricdef S_BITCMP1_B32 : SOPC_32 <"s_bitcmp1_b32">; 1350e8d8bef9SDimitry Andricdef S_BITCMP0_B64 : SOPC_64_32 <"s_bitcmp0_b64">; 1351e8d8bef9SDimitry Andricdef S_BITCMP1_B64 : SOPC_64_32 <"s_bitcmp1_b64">; 13520b57cec5SDimitry Andriclet SubtargetPredicate = isGFX6GFX7GFX8GFX9 in 1353e8d8bef9SDimitry Andricdef S_SETVSKIP : SOPC_32 <"s_setvskip">; 13540b57cec5SDimitry Andric 13550b57cec5SDimitry Andriclet SubtargetPredicate = isGFX8Plus in { 1356e8d8bef9SDimitry Andricdef S_CMP_EQ_U64 : SOPC_CMP_64 <"s_cmp_eq_u64", COND_EQ>; 1357e8d8bef9SDimitry Andricdef S_CMP_LG_U64 : SOPC_CMP_64 <"s_cmp_lg_u64", COND_NE>; 13580b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX8Plus 13590b57cec5SDimitry Andric 13600b57cec5SDimitry Andriclet SubtargetPredicate = HasVGPRIndexMode in { 13615ffd83dbSDimitry Andric// Setting the GPR index mode is really writing the fields in the mode 13625ffd83dbSDimitry Andric// register. We don't want to add mode register uses to every 13635ffd83dbSDimitry Andric// instruction, and it's too complicated to deal with anyway. This is 13645ffd83dbSDimitry Andric// modeled just as a side effect. 1365e8d8bef9SDimitry Andricdef S_SET_GPR_IDX_ON : SOPC_Pseudo < 1366e8d8bef9SDimitry Andric "s_set_gpr_idx_on" , 13670b57cec5SDimitry Andric (outs), 13680b57cec5SDimitry Andric (ins SSrc_b32:$src0, GPRIdxMode:$src1), 1369e8d8bef9SDimitry Andric "$src0, $src1"> { 13705ffd83dbSDimitry Andric let Defs = [M0, MODE]; // No scc def 13715ffd83dbSDimitry Andric let Uses = [M0, MODE]; // Other bits of mode, m0 unmodified. 13720b57cec5SDimitry Andric let hasSideEffects = 1; // Sets mode.gpr_idx_en 13730b57cec5SDimitry Andric let FixedSize = 1; 13740b57cec5SDimitry Andric} 13750b57cec5SDimitry Andric} 13760b57cec5SDimitry Andric 13775f757f3fSDimitry Andriclet SubtargetPredicate = HasSALUFloatInsts in { 13785f757f3fSDimitry Andric 13795f757f3fSDimitry Andricdef S_CMP_LT_F32 : SOPC_CMP_F32<"s_cmp_lt_f32", COND_OLT, "s_cmp_gt_f32">; 13805f757f3fSDimitry Andricdef S_CMP_EQ_F32 : SOPC_CMP_F32<"s_cmp_eq_f32", COND_OEQ>; 13815f757f3fSDimitry Andricdef S_CMP_LE_F32 : SOPC_CMP_F32<"s_cmp_le_f32", COND_OLE, "s_cmp_ge_f32">; 13825f757f3fSDimitry Andricdef S_CMP_GT_F32 : SOPC_CMP_F32<"s_cmp_gt_f32", COND_OGT>; 13835f757f3fSDimitry Andricdef S_CMP_LG_F32 : SOPC_CMP_F32<"s_cmp_lg_f32", COND_ONE>; 13845f757f3fSDimitry Andricdef S_CMP_GE_F32 : SOPC_CMP_F32<"s_cmp_ge_f32", COND_OGE>; 13855f757f3fSDimitry Andricdef S_CMP_O_F32 : SOPC_CMP_F32<"s_cmp_o_f32", COND_O>; 13865f757f3fSDimitry Andricdef S_CMP_U_F32 : SOPC_CMP_F32<"s_cmp_u_f32", COND_UO>; 13875f757f3fSDimitry Andricdef S_CMP_NGE_F32 : SOPC_CMP_F32<"s_cmp_nge_f32", COND_ULT, "s_cmp_nle_f32">; 13885f757f3fSDimitry Andricdef S_CMP_NLG_F32 : SOPC_CMP_F32<"s_cmp_nlg_f32", COND_UEQ>; 13895f757f3fSDimitry Andricdef S_CMP_NGT_F32 : SOPC_CMP_F32<"s_cmp_ngt_f32", COND_ULE, "s_cmp_nlt_f32">; 13905f757f3fSDimitry Andricdef S_CMP_NLE_F32 : SOPC_CMP_F32<"s_cmp_nle_f32", COND_UGT>; 13915f757f3fSDimitry Andricdef S_CMP_NEQ_F32 : SOPC_CMP_F32<"s_cmp_neq_f32", COND_UNE>; 13925f757f3fSDimitry Andricdef S_CMP_NLT_F32 : SOPC_CMP_F32<"s_cmp_nlt_f32", COND_UGE>; 13935f757f3fSDimitry Andric 13945f757f3fSDimitry Andricdef S_CMP_LT_F16 : SOPC_CMP_F16<"s_cmp_lt_f16", COND_OLT, "s_cmp_gt_f16">; 13955f757f3fSDimitry Andricdef S_CMP_EQ_F16 : SOPC_CMP_F16<"s_cmp_eq_f16", COND_OEQ>; 13965f757f3fSDimitry Andricdef S_CMP_LE_F16 : SOPC_CMP_F16<"s_cmp_le_f16", COND_OLE, "s_cmp_ge_f16">; 13975f757f3fSDimitry Andricdef S_CMP_GT_F16 : SOPC_CMP_F16<"s_cmp_gt_f16", COND_OGT>; 13985f757f3fSDimitry Andricdef S_CMP_LG_F16 : SOPC_CMP_F16<"s_cmp_lg_f16", COND_ONE>; 13995f757f3fSDimitry Andricdef S_CMP_GE_F16 : SOPC_CMP_F16<"s_cmp_ge_f16", COND_OGE>; 14005f757f3fSDimitry Andricdef S_CMP_O_F16 : SOPC_CMP_F16<"s_cmp_o_f16", COND_O>; 14015f757f3fSDimitry Andricdef S_CMP_U_F16 : SOPC_CMP_F16<"s_cmp_u_f16", COND_UO>; 14025f757f3fSDimitry Andricdef S_CMP_NGE_F16 : SOPC_CMP_F16<"s_cmp_nge_f16", COND_ULT, "s_cmp_nle_f16">; 14035f757f3fSDimitry Andricdef S_CMP_NLG_F16 : SOPC_CMP_F16<"s_cmp_nlg_f16", COND_UEQ>; 14045f757f3fSDimitry Andricdef S_CMP_NGT_F16 : SOPC_CMP_F16<"s_cmp_ngt_f16", COND_ULE, "s_cmp_nlt_f16">; 14055f757f3fSDimitry Andricdef S_CMP_NLE_F16 : SOPC_CMP_F16<"s_cmp_nle_f16", COND_UGT>; 14065f757f3fSDimitry Andricdef S_CMP_NEQ_F16 : SOPC_CMP_F16<"s_cmp_neq_f16", COND_UNE>; 14075f757f3fSDimitry Andricdef S_CMP_NLT_F16 : SOPC_CMP_F16<"s_cmp_nlt_f16", COND_UGE>; 14085f757f3fSDimitry Andric 14095f757f3fSDimitry Andric} // End SubtargetPredicate = HasSALUFloatInsts 14105f757f3fSDimitry Andric 14110b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 14120b57cec5SDimitry Andric// SOPP Instructions 14130b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 14140b57cec5SDimitry Andric 1415e8d8bef9SDimitry Andricclass SOPP_Pseudo<string opName, dag ins, 1416bdd1243dSDimitry Andric string asmOps = "", list<dag> pattern=[], 1417bdd1243dSDimitry Andric string sep = !if(!empty(asmOps), "", " "), 1418bdd1243dSDimitry Andric string keyName = opName> : 1419bdd1243dSDimitry Andric SOP_Pseudo<opName, (outs), ins, sep # asmOps, pattern> { 14200b57cec5SDimitry Andric let mayLoad = 0; 14210b57cec5SDimitry Andric let mayStore = 0; 14220b57cec5SDimitry Andric let hasSideEffects = 0; 14230b57cec5SDimitry Andric let SALU = 1; 14240b57cec5SDimitry Andric let SOPP = 1; 1425e8d8bef9SDimitry Andric let FixedSize = 1; 14260b57cec5SDimitry Andric let SchedRW = [WriteSALU]; 14270b57cec5SDimitry Andric let UseNamedOperandTable = 1; 1428e8d8bef9SDimitry Andric bits <16> simm16; 1429e8d8bef9SDimitry Andric bits <1> fixed_imm = 0; 1430e8d8bef9SDimitry Andric string KeyName = keyName; 14310b57cec5SDimitry Andric} 14320b57cec5SDimitry Andric 1433e8d8bef9SDimitry Andricclass SOPPRelaxTable <bit isRelaxed, string keyName, string gfxip> { 1434e8d8bef9SDimitry Andric bit IsRelaxed = isRelaxed; 1435e8d8bef9SDimitry Andric string KeyName = keyName # gfxip; 1436e8d8bef9SDimitry Andric} 14370b57cec5SDimitry Andric 1438*0fca6ea1SDimitry Andricclass SOPP_Real<SOPP_Pseudo ps, string name = ps.Mnemonic> : 1439e8d8bef9SDimitry Andric InstSI <ps.OutOperandList, ps.InOperandList, 1440*0fca6ea1SDimitry Andric name # ps.AsmOperands> { 1441fe6060f1SDimitry Andric let SALU = 1; 1442fe6060f1SDimitry Andric let SOPP = 1; 1443e8d8bef9SDimitry Andric let isPseudo = 0; 1444e8d8bef9SDimitry Andric let isCodeGenOnly = 0; 1445e8d8bef9SDimitry Andric 1446e8d8bef9SDimitry Andric // copy relevant pseudo op flags 1447e8d8bef9SDimitry Andric let SubtargetPredicate = ps.SubtargetPredicate; 1448e8d8bef9SDimitry Andric let OtherPredicates = ps.OtherPredicates; 1449e8d8bef9SDimitry Andric let AsmMatchConverter = ps.AsmMatchConverter; 1450e8d8bef9SDimitry Andric let UseNamedOperandTable = ps.UseNamedOperandTable; 1451e8d8bef9SDimitry Andric let TSFlags = ps.TSFlags; 1452fe6060f1SDimitry Andric let SchedRW = ps.SchedRW; 1453fe6060f1SDimitry Andric let mayLoad = ps.mayLoad; 1454fe6060f1SDimitry Andric let mayStore = ps.mayStore; 1455*0fca6ea1SDimitry Andric let isTerminator = ps.isTerminator; 1456*0fca6ea1SDimitry Andric let isReturn = ps.isReturn; 1457*0fca6ea1SDimitry Andric let isCall = ps.isCall; 1458*0fca6ea1SDimitry Andric let isBranch = ps.isBranch; 1459*0fca6ea1SDimitry Andric let isBarrier = ps.isBarrier; 1460*0fca6ea1SDimitry Andric let Uses = ps.Uses; 1461*0fca6ea1SDimitry Andric let Defs = ps.Defs; 14620b57cec5SDimitry Andric bits <16> simm16; 1463e8d8bef9SDimitry Andric} 14640b57cec5SDimitry Andric 1465*0fca6ea1SDimitry Andricclass SOPP_Real_32 <bits<7> op, SOPP_Pseudo ps, string name = ps.Mnemonic> : SOPP_Real<ps, name>, 1466e8d8bef9SDimitry AndricEnc32 { 1467e8d8bef9SDimitry Andric let Inst{15-0} = !if(ps.fixed_imm, ps.simm16, simm16); 14680b57cec5SDimitry Andric let Inst{22-16} = op; 1469e8d8bef9SDimitry Andric let Inst{31-23} = 0x17f; 1470e8d8bef9SDimitry Andric} 1471e8d8bef9SDimitry Andric 1472*0fca6ea1SDimitry Andricclass SOPP_Real_64 <bits<7> op, SOPP_Pseudo ps, string name = ps.Mnemonic> : SOPP_Real<ps, name>, 1473e8d8bef9SDimitry AndricEnc64 { 1474e8d8bef9SDimitry Andric // encoding 1475e8d8bef9SDimitry Andric let Inst{15-0} = !if(ps.fixed_imm, ps.simm16, simm16); 1476e8d8bef9SDimitry Andric let Inst{22-16} = op; 1477e8d8bef9SDimitry Andric let Inst{31-23} = 0x17f; 1478e8d8bef9SDimitry Andric //effectively a nop 14790b57cec5SDimitry Andric let Inst{47-32} = 0x0; 1480e8d8bef9SDimitry Andric let Inst{54-48} = 0x0; 1481e8d8bef9SDimitry Andric let Inst{63-55} = 0x17f; 14820b57cec5SDimitry Andric} 14830b57cec5SDimitry Andric 1484e8d8bef9SDimitry Andricmulticlass SOPP_With_Relaxation <string opName, dag ins, 1485e8d8bef9SDimitry Andric string asmOps, list<dag> pattern=[]> { 1486e8d8bef9SDimitry Andric def "" : SOPP_Pseudo <opName, ins, asmOps, pattern>; 1487bdd1243dSDimitry Andric def _pad_s_nop : SOPP_Pseudo <opName # "_pad_s_nop", ins, asmOps, pattern, " ", opName>; 14880b57cec5SDimitry Andric} 14890b57cec5SDimitry Andric 14905f757f3fSDimitry Andricdef S_NOP : SOPP_Pseudo<"s_nop" , (ins i16imm:$simm16), "$simm16", 14915f757f3fSDimitry Andric [(int_amdgcn_s_nop timm:$simm16)]> { 14925f757f3fSDimitry Andric let hasSideEffects = 1; 14935f757f3fSDimitry Andric} 14940b57cec5SDimitry Andric 14950b57cec5SDimitry Andriclet isTerminator = 1 in { 149606c3fb27SDimitry Andricdef S_ENDPGM : SOPP_Pseudo<"s_endpgm", (ins Endpgm:$simm16), "$simm16", [], ""> { 14970b57cec5SDimitry Andric let isBarrier = 1; 14980b57cec5SDimitry Andric let isReturn = 1; 1499e8d8bef9SDimitry Andric let hasSideEffects = 1; 15000b57cec5SDimitry Andric} 15010b57cec5SDimitry Andric 1502e8d8bef9SDimitry Andricdef S_ENDPGM_SAVED : SOPP_Pseudo<"s_endpgm_saved", (ins)> { 15030b57cec5SDimitry Andric let SubtargetPredicate = isGFX8Plus; 15040b57cec5SDimitry Andric let simm16 = 0; 1505e8d8bef9SDimitry Andric let fixed_imm = 1; 15060b57cec5SDimitry Andric let isBarrier = 1; 15070b57cec5SDimitry Andric let isReturn = 1; 15080b57cec5SDimitry Andric} 15090b57cec5SDimitry Andric 151081ad6265SDimitry Andriclet SubtargetPredicate = isGFX9GFX10 in { 1511e8d8bef9SDimitry Andric let isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 in { 15120b57cec5SDimitry Andric def S_ENDPGM_ORDERED_PS_DONE : 1513e8d8bef9SDimitry Andric SOPP_Pseudo<"s_endpgm_ordered_ps_done", (ins)>; 1514e8d8bef9SDimitry Andric } // End isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 151581ad6265SDimitry Andric} // End SubtargetPredicate = isGFX9GFX10 15160b57cec5SDimitry Andric 15170b57cec5SDimitry Andriclet SubtargetPredicate = isGFX10Plus in { 1518e8d8bef9SDimitry Andric let isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 in { 15190b57cec5SDimitry Andric def S_CODE_END : 1520e8d8bef9SDimitry Andric SOPP_Pseudo<"s_code_end", (ins)>; 1521e8d8bef9SDimitry Andric } // End isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 15220b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX10Plus 15230b57cec5SDimitry Andric 15240b57cec5SDimitry Andriclet isBranch = 1, SchedRW = [WriteBranch] in { 15250b57cec5SDimitry Andriclet isBarrier = 1 in { 15260b57cec5SDimitry Andricdefm S_BRANCH : SOPP_With_Relaxation< 152706c3fb27SDimitry Andric "s_branch" , (ins SOPPBrTarget:$simm16), "$simm16", 15280b57cec5SDimitry Andric [(br bb:$simm16)]>; 15290b57cec5SDimitry Andric} 15300b57cec5SDimitry Andric 15310b57cec5SDimitry Andriclet Uses = [SCC] in { 15320b57cec5SDimitry Andricdefm S_CBRANCH_SCC0 : SOPP_With_Relaxation< 153306c3fb27SDimitry Andric "s_cbranch_scc0" , (ins SOPPBrTarget:$simm16), 1534e8d8bef9SDimitry Andric "$simm16" 15350b57cec5SDimitry Andric>; 15360b57cec5SDimitry Andricdefm S_CBRANCH_SCC1 : SOPP_With_Relaxation < 153706c3fb27SDimitry Andric "s_cbranch_scc1" , (ins SOPPBrTarget:$simm16), 1538e8d8bef9SDimitry Andric "$simm16" 15390b57cec5SDimitry Andric>; 15400b57cec5SDimitry Andric} // End Uses = [SCC] 15410b57cec5SDimitry Andric 15420b57cec5SDimitry Andriclet Uses = [VCC] in { 15430b57cec5SDimitry Andricdefm S_CBRANCH_VCCZ : SOPP_With_Relaxation < 154406c3fb27SDimitry Andric "s_cbranch_vccz" , (ins SOPPBrTarget:$simm16), 1545e8d8bef9SDimitry Andric "$simm16" 15460b57cec5SDimitry Andric>; 15470b57cec5SDimitry Andricdefm S_CBRANCH_VCCNZ : SOPP_With_Relaxation < 154806c3fb27SDimitry Andric "s_cbranch_vccnz" , (ins SOPPBrTarget:$simm16), 1549e8d8bef9SDimitry Andric "$simm16" 15500b57cec5SDimitry Andric>; 15510b57cec5SDimitry Andric} // End Uses = [VCC] 15520b57cec5SDimitry Andric 15530b57cec5SDimitry Andriclet Uses = [EXEC] in { 15540b57cec5SDimitry Andricdefm S_CBRANCH_EXECZ : SOPP_With_Relaxation < 155506c3fb27SDimitry Andric "s_cbranch_execz" , (ins SOPPBrTarget:$simm16), 1556e8d8bef9SDimitry Andric "$simm16" 15570b57cec5SDimitry Andric>; 15580b57cec5SDimitry Andricdefm S_CBRANCH_EXECNZ : SOPP_With_Relaxation < 155906c3fb27SDimitry Andric "s_cbranch_execnz" , (ins SOPPBrTarget:$simm16), 1560e8d8bef9SDimitry Andric "$simm16" 15610b57cec5SDimitry Andric>; 15620b57cec5SDimitry Andric} // End Uses = [EXEC] 15630b57cec5SDimitry Andric 15640b57cec5SDimitry Andricdefm S_CBRANCH_CDBGSYS : SOPP_With_Relaxation < 156506c3fb27SDimitry Andric "s_cbranch_cdbgsys" , (ins SOPPBrTarget:$simm16), 1566e8d8bef9SDimitry Andric "$simm16" 15670b57cec5SDimitry Andric>; 15680b57cec5SDimitry Andric 15690b57cec5SDimitry Andricdefm S_CBRANCH_CDBGSYS_AND_USER : SOPP_With_Relaxation < 157006c3fb27SDimitry Andric "s_cbranch_cdbgsys_and_user" , (ins SOPPBrTarget:$simm16), 1571e8d8bef9SDimitry Andric "$simm16" 15720b57cec5SDimitry Andric>; 15730b57cec5SDimitry Andric 15740b57cec5SDimitry Andricdefm S_CBRANCH_CDBGSYS_OR_USER : SOPP_With_Relaxation < 157506c3fb27SDimitry Andric "s_cbranch_cdbgsys_or_user" , (ins SOPPBrTarget:$simm16), 1576e8d8bef9SDimitry Andric "$simm16" 15770b57cec5SDimitry Andric>; 15780b57cec5SDimitry Andric 15790b57cec5SDimitry Andricdefm S_CBRANCH_CDBGUSER : SOPP_With_Relaxation < 158006c3fb27SDimitry Andric "s_cbranch_cdbguser" , (ins SOPPBrTarget:$simm16), 1581e8d8bef9SDimitry Andric "$simm16" 15820b57cec5SDimitry Andric>; 15830b57cec5SDimitry Andric 15840b57cec5SDimitry Andric} // End isBranch = 1 15850b57cec5SDimitry Andric} // End isTerminator = 1 15860b57cec5SDimitry Andric 15870b57cec5SDimitry Andriclet hasSideEffects = 1 in { 1588e8d8bef9SDimitry Andricdef S_BARRIER : SOPP_Pseudo <"s_barrier", (ins), "", 15890b57cec5SDimitry Andric [(int_amdgcn_s_barrier)]> { 15900b57cec5SDimitry Andric let SchedRW = [WriteBarrier]; 15910b57cec5SDimitry Andric let simm16 = 0; 1592e8d8bef9SDimitry Andric let fixed_imm = 1; 15930b57cec5SDimitry Andric let isConvergent = 1; 15940b57cec5SDimitry Andric} 15950b57cec5SDimitry Andric 15965f757f3fSDimitry Andricdef S_BARRIER_WAIT : SOPP_Pseudo <"s_barrier_wait", (ins i16imm:$simm16), "$simm16", 15975f757f3fSDimitry Andric [(int_amdgcn_s_barrier_wait timm:$simm16)]> { 15985f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 15995f757f3fSDimitry Andric let isConvergent = 1; 16005f757f3fSDimitry Andric} 16015f757f3fSDimitry Andric 16025f757f3fSDimitry Andricdef S_BARRIER_LEAVE : SOPP_Pseudo <"s_barrier_leave", (ins), "", 16035f757f3fSDimitry Andric [(set SCC, (int_amdgcn_s_barrier_leave))]> { 16045f757f3fSDimitry Andric let SchedRW = [WriteBarrier]; 16055f757f3fSDimitry Andric let simm16 = 0; 16065f757f3fSDimitry Andric let fixed_imm = 1; 16075f757f3fSDimitry Andric let isConvergent = 1; 16085f757f3fSDimitry Andric let Defs = [SCC]; 16095f757f3fSDimitry Andric} 16105f757f3fSDimitry Andric 1611e8d8bef9SDimitry Andricdef S_WAKEUP : SOPP_Pseudo <"s_wakeup", (ins) > { 16120b57cec5SDimitry Andric let SubtargetPredicate = isGFX8Plus; 16130b57cec5SDimitry Andric let simm16 = 0; 1614e8d8bef9SDimitry Andric let fixed_imm = 1; 16150b57cec5SDimitry Andric let mayLoad = 1; 16160b57cec5SDimitry Andric let mayStore = 1; 16170b57cec5SDimitry Andric} 16180b57cec5SDimitry Andric 161906c3fb27SDimitry Andricdef S_WAITCNT : SOPP_Pseudo <"s_waitcnt" , (ins SWaitCnt:$simm16), "$simm16", 16208bcb0991SDimitry Andric [(int_amdgcn_s_waitcnt timm:$simm16)]>; 16215f757f3fSDimitry Andric 16225f757f3fSDimitry Andric// "_soft" waitcnts are waitcnts that are either relaxed into their non-soft 16235f757f3fSDimitry Andric// counterpart, or completely removed. 16245f757f3fSDimitry Andric// 16255f757f3fSDimitry Andric// These are inserted by SIMemoryLegalizer to resolve memory dependencies 16265f757f3fSDimitry Andric// and later optimized by SIInsertWaitcnts 16275f757f3fSDimitry Andric// For example, a S_WAITCNT_soft 0 can be completely removed in a function 16285f757f3fSDimitry Andric// that doesn't access memory. 16295f757f3fSDimitry Andricdef S_WAITCNT_soft : SOPP_Pseudo <"s_soft_waitcnt" , (ins SWaitCnt:$simm16), "$simm16">; 16305f757f3fSDimitry Andricdef S_WAITCNT_VSCNT_soft : SOPK_WAITCNT<"s_soft_waitcnt_vscnt">; 16317a6dacacSDimitry Andriclet SubtargetPredicate = isGFX12Plus in { 16327a6dacacSDimitry Andric def S_WAIT_LOADCNT_soft : SOPP_Pseudo <"s_soft_wait_loadcnt", (ins s16imm:$simm16), "$simm16">; 16337a6dacacSDimitry Andric def S_WAIT_STORECNT_soft : SOPP_Pseudo <"s_soft_wait_storecnt", (ins s16imm:$simm16), "$simm16">; 1634*0fca6ea1SDimitry Andriclet OtherPredicates = [HasImageInsts] in { 16357a6dacacSDimitry Andric def S_WAIT_SAMPLECNT_soft : SOPP_Pseudo <"s_soft_wait_samplecnt", (ins s16imm:$simm16), "$simm16">; 16367a6dacacSDimitry Andric def S_WAIT_BVHCNT_soft : SOPP_Pseudo <"s_soft_wait_bvhcnt", (ins s16imm:$simm16), "$simm16">; 1637*0fca6ea1SDimitry Andric} // End OtherPredicates = [HasImageInsts]. 16387a6dacacSDimitry Andric def S_WAIT_DSCNT_soft : SOPP_Pseudo <"s_soft_wait_dscnt", (ins s16imm:$simm16), "$simm16">; 1639*0fca6ea1SDimitry Andric def S_WAIT_KMCNT_soft : SOPP_Pseudo <"s_soft_wait_kmcnt", (ins s16imm:$simm16), "$simm16">; 16407a6dacacSDimitry Andric} 16415f757f3fSDimitry Andric 1642fe6060f1SDimitry Andricdef S_SETHALT : SOPP_Pseudo <"s_sethalt" , (ins i32imm:$simm16), "$simm16", 1643fe6060f1SDimitry Andric [(int_amdgcn_s_sethalt timm:$simm16)]>; 1644e8d8bef9SDimitry Andricdef S_SETKILL : SOPP_Pseudo <"s_setkill" , (ins i16imm:$simm16), "$simm16">; 16450b57cec5SDimitry Andric 16460b57cec5SDimitry Andric// On SI the documentation says sleep for approximately 64 * low 2 16470b57cec5SDimitry Andric// bits, consistent with the reported maximum of 448. On VI the 16480b57cec5SDimitry Andric// maximum reported is 960 cycles, so 960 / 64 = 15 max, so is the 16490b57cec5SDimitry Andric// maximum really 15 on VI? 1650e8d8bef9SDimitry Andricdef S_SLEEP : SOPP_Pseudo <"s_sleep", (ins i32imm:$simm16), 1651e8d8bef9SDimitry Andric "$simm16", [(int_amdgcn_s_sleep timm:$simm16)]> { 16525f757f3fSDimitry Andric} 16535f757f3fSDimitry Andric 16545f757f3fSDimitry Andricdef S_SLEEP_VAR : SOP1_0_32 <"s_sleep_var", [(int_amdgcn_s_sleep_var SSrc_b32:$src0)]> { 16550b57cec5SDimitry Andric let hasSideEffects = 1; 16560b57cec5SDimitry Andric} 16570b57cec5SDimitry Andric 165881ad6265SDimitry Andricdef S_SETPRIO : SOPP_Pseudo <"s_setprio", (ins i16imm:$simm16), "$simm16", 165981ad6265SDimitry Andric [(int_amdgcn_s_setprio timm:$simm16)]> { 166081ad6265SDimitry Andric} 16610b57cec5SDimitry Andric 16620b57cec5SDimitry Andriclet Uses = [EXEC, M0] in { 166306c3fb27SDimitry Andricdef S_SENDMSG : SOPP_Pseudo <"s_sendmsg" , (ins SendMsg:$simm16), "$simm16", 166481ad6265SDimitry Andric [(int_amdgcn_s_sendmsg (i32 timm:$simm16), M0)]> { 166581ad6265SDimitry Andric} 16660b57cec5SDimitry Andric 166706c3fb27SDimitry Andricdef S_SENDMSGHALT : SOPP_Pseudo <"s_sendmsghalt" , (ins SendMsg:$simm16), "$simm16", 166881ad6265SDimitry Andric [(int_amdgcn_s_sendmsghalt (i32 timm:$simm16), M0)]> { 166981ad6265SDimitry Andric} 16708bcb0991SDimitry Andric 16710b57cec5SDimitry Andric} // End Uses = [EXEC, M0] 16720b57cec5SDimitry Andric 1673e8d8bef9SDimitry Andricdef S_TRAP : SOPP_Pseudo <"s_trap" , (ins i16imm:$simm16), "$simm16"> { 16740b57cec5SDimitry Andric let isTrap = 1; 16750b57cec5SDimitry Andric} 16760b57cec5SDimitry Andric 1677e8d8bef9SDimitry Andricdef S_ICACHE_INV : SOPP_Pseudo <"s_icache_inv", (ins)> { 16780b57cec5SDimitry Andric let simm16 = 0; 1679e8d8bef9SDimitry Andric let fixed_imm = 1; 16800b57cec5SDimitry Andric} 1681e8d8bef9SDimitry Andricdef S_INCPERFLEVEL : SOPP_Pseudo <"s_incperflevel", (ins i32imm:$simm16), "$simm16", 16828bcb0991SDimitry Andric [(int_amdgcn_s_incperflevel timm:$simm16)]> { 16830b57cec5SDimitry Andric} 1684e8d8bef9SDimitry Andricdef S_DECPERFLEVEL : SOPP_Pseudo <"s_decperflevel", (ins i32imm:$simm16), "$simm16", 16858bcb0991SDimitry Andric [(int_amdgcn_s_decperflevel timm:$simm16)]> { 16860b57cec5SDimitry Andric} 16875f757f3fSDimitry Andric 16885f757f3fSDimitry Andriclet Uses = [M0] in 16895f757f3fSDimitry Andricdef S_TTRACEDATA : SOPP_Pseudo <"s_ttracedata", (ins), "", 16905f757f3fSDimitry Andric [(int_amdgcn_s_ttracedata M0)]> { 16910b57cec5SDimitry Andric let simm16 = 0; 1692e8d8bef9SDimitry Andric let fixed_imm = 1; 16930b57cec5SDimitry Andric} 16940b57cec5SDimitry Andric 16950b57cec5SDimitry Andriclet SubtargetPredicate = HasVGPRIndexMode in { 1696e8d8bef9SDimitry Andricdef S_SET_GPR_IDX_OFF : SOPP_Pseudo<"s_set_gpr_idx_off", (ins) > { 16970b57cec5SDimitry Andric let simm16 = 0; 1698e8d8bef9SDimitry Andric let fixed_imm = 1; 16995ffd83dbSDimitry Andric let Defs = [MODE]; 17005ffd83dbSDimitry Andric let Uses = [MODE]; 17010b57cec5SDimitry Andric} 17020b57cec5SDimitry Andric} 17030b57cec5SDimitry Andric} // End hasSideEffects 17040b57cec5SDimitry Andric 17050b57cec5SDimitry Andriclet SubtargetPredicate = HasVGPRIndexMode in { 1706e8d8bef9SDimitry Andricdef S_SET_GPR_IDX_MODE : SOPP_Pseudo<"s_set_gpr_idx_mode", (ins GPRIdxMode:$simm16), 1707e8d8bef9SDimitry Andric "$simm16"> { 17085ffd83dbSDimitry Andric let Defs = [M0, MODE]; 17095ffd83dbSDimitry Andric let Uses = [MODE]; 17100b57cec5SDimitry Andric} 17110b57cec5SDimitry Andric} 17120b57cec5SDimitry Andric 17130b57cec5SDimitry Andriclet SubtargetPredicate = isGFX10Plus in { 17140b57cec5SDimitry Andric def S_INST_PREFETCH : 1715e8d8bef9SDimitry Andric SOPP_Pseudo<"s_inst_prefetch", (ins s16imm:$simm16), "$simm16">; 17160b57cec5SDimitry Andric def S_CLAUSE : 1717e8d8bef9SDimitry Andric SOPP_Pseudo<"s_clause", (ins s16imm:$simm16), "$simm16">; 1718e8d8bef9SDimitry Andric def S_WAIT_IDLE : 1719bdd1243dSDimitry Andric SOPP_Pseudo <"s_wait_idle", (ins)> { 17200b57cec5SDimitry Andric let simm16 = 0; 1721e8d8bef9SDimitry Andric let fixed_imm = 1; 17220b57cec5SDimitry Andric } 17230b57cec5SDimitry Andric def S_WAITCNT_DEPCTR : 172406c3fb27SDimitry Andric SOPP_Pseudo <"s_waitcnt_depctr" , (ins DepCtr:$simm16), "$simm16">; 17255ffd83dbSDimitry Andric 17265ffd83dbSDimitry Andric let hasSideEffects = 0, Uses = [MODE], Defs = [MODE] in { 17270b57cec5SDimitry Andric def S_ROUND_MODE : 1728e8d8bef9SDimitry Andric SOPP_Pseudo<"s_round_mode", (ins s16imm:$simm16), "$simm16">; 17290b57cec5SDimitry Andric def S_DENORM_MODE : 1730e8d8bef9SDimitry Andric SOPP_Pseudo<"s_denorm_mode", (ins i32imm:$simm16), "$simm16", 17315ffd83dbSDimitry Andric [(SIdenorm_mode (i32 timm:$simm16))]>; 17328bcb0991SDimitry Andric } 17335ffd83dbSDimitry Andric 17345f757f3fSDimitry Andric let hasSideEffects = 1 in 17350b57cec5SDimitry Andric def S_TTRACEDATA_IMM : 17365f757f3fSDimitry Andric SOPP_Pseudo<"s_ttracedata_imm", (ins s16imm:$simm16), "$simm16", 17375f757f3fSDimitry Andric [(int_amdgcn_s_ttracedata_imm timm:$simm16)]>; 17380b57cec5SDimitry Andric} // End SubtargetPredicate = isGFX10Plus 17390b57cec5SDimitry Andric 174081ad6265SDimitry Andriclet SubtargetPredicate = isGFX11Plus in { 1741*0fca6ea1SDimitry Andriclet OtherPredicates = [HasExportInsts] in 174281ad6265SDimitry Andric def S_WAIT_EVENT : SOPP_Pseudo<"s_wait_event", (ins s16imm:$simm16), 1743bdd1243dSDimitry Andric "$simm16"> { 1744bdd1243dSDimitry Andric let hasSideEffects = 1; 1745bdd1243dSDimitry Andric } 174606c3fb27SDimitry Andric def S_DELAY_ALU : SOPP_Pseudo<"s_delay_alu", (ins SDelayALU:$simm16), 174781ad6265SDimitry Andric "$simm16">; 174881ad6265SDimitry Andric} // End SubtargetPredicate = isGFX11Plus 174981ad6265SDimitry Andric 17505f757f3fSDimitry Andriclet SubtargetPredicate = HasVGPRSingleUseHintInsts in { 17515f757f3fSDimitry Andric def S_SINGLEUSE_VDST : 17525f757f3fSDimitry Andric SOPP_Pseudo<"s_singleuse_vdst", (ins s16imm:$simm16), "$simm16">; 17535f757f3fSDimitry Andric} // End SubtargetPredicate = HasVGPRSingeUseHintInsts 17545f757f3fSDimitry Andric 17551db9f3b2SDimitry Andriclet SubtargetPredicate = isGFX12Plus, hasSideEffects = 1 in { 17561db9f3b2SDimitry Andric def S_WAIT_LOADCNT : 17577a6dacacSDimitry Andric SOPP_Pseudo<"s_wait_loadcnt", (ins s16imm:$simm16), "$simm16", 17587a6dacacSDimitry Andric [(int_amdgcn_s_wait_loadcnt timm:$simm16)]>; 17591db9f3b2SDimitry Andric def S_WAIT_LOADCNT_DSCNT : 17601db9f3b2SDimitry Andric SOPP_Pseudo<"s_wait_loadcnt_dscnt", (ins s16imm:$simm16), "$simm16">; 17611db9f3b2SDimitry Andric def S_WAIT_STORECNT : 17627a6dacacSDimitry Andric SOPP_Pseudo<"s_wait_storecnt", (ins s16imm:$simm16), "$simm16", 17637a6dacacSDimitry Andric [(int_amdgcn_s_wait_storecnt timm:$simm16)]>; 17641db9f3b2SDimitry Andric def S_WAIT_STORECNT_DSCNT : 17651db9f3b2SDimitry Andric SOPP_Pseudo<"s_wait_storecnt_dscnt", (ins s16imm:$simm16), "$simm16">; 1766*0fca6ea1SDimitry Andriclet OtherPredicates = [HasImageInsts] in { 17671db9f3b2SDimitry Andric def S_WAIT_SAMPLECNT : 17687a6dacacSDimitry Andric SOPP_Pseudo<"s_wait_samplecnt", (ins s16imm:$simm16), "$simm16", 17697a6dacacSDimitry Andric [(int_amdgcn_s_wait_samplecnt timm:$simm16)]>; 17701db9f3b2SDimitry Andric def S_WAIT_BVHCNT : 17717a6dacacSDimitry Andric SOPP_Pseudo<"s_wait_bvhcnt", (ins s16imm:$simm16), "$simm16", 17727a6dacacSDimitry Andric [(int_amdgcn_s_wait_bvhcnt timm:$simm16)]>; 1773*0fca6ea1SDimitry Andric} // End OtherPredicates = [HasImageInsts]. 1774*0fca6ea1SDimitry Andriclet OtherPredicates = [HasExportInsts] in 17751db9f3b2SDimitry Andric def S_WAIT_EXPCNT : 17767a6dacacSDimitry Andric SOPP_Pseudo<"s_wait_expcnt", (ins s16imm:$simm16), "$simm16", 17777a6dacacSDimitry Andric [(int_amdgcn_s_wait_expcnt timm:$simm16)]>; 17781db9f3b2SDimitry Andric def S_WAIT_DSCNT : 17797a6dacacSDimitry Andric SOPP_Pseudo<"s_wait_dscnt", (ins s16imm:$simm16), "$simm16", 17807a6dacacSDimitry Andric [(int_amdgcn_s_wait_dscnt timm:$simm16)]>; 17811db9f3b2SDimitry Andric def S_WAIT_KMCNT : 17827a6dacacSDimitry Andric SOPP_Pseudo<"s_wait_kmcnt", (ins s16imm:$simm16), "$simm16", 17837a6dacacSDimitry Andric [(int_amdgcn_s_wait_kmcnt timm:$simm16)]>; 17841db9f3b2SDimitry Andric} // End SubtargetPredicate = isGFX12Plus, hasSideEffects = 1 17851db9f3b2SDimitry Andric 17860b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 17870b57cec5SDimitry Andric// SOP1 Patterns 17880b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 17890b57cec5SDimitry Andric 17900b57cec5SDimitry Andricdef : GCNPat < 17910b57cec5SDimitry Andric (AMDGPUendpgm), 17920b57cec5SDimitry Andric (S_ENDPGM (i16 0)) 17930b57cec5SDimitry Andric>; 17940b57cec5SDimitry Andric 17950b57cec5SDimitry Andricdef : GCNPat < 1796e8d8bef9SDimitry Andric (int_amdgcn_endpgm), 1797e8d8bef9SDimitry Andric (S_ENDPGM (i16 0)) 1798e8d8bef9SDimitry Andric>; 1799e8d8bef9SDimitry Andric 1800e8d8bef9SDimitry Andricdef : GCNPat < 180104eeddc0SDimitry Andric (i64 (UniformUnaryFrag<ctpop> i64:$src)), 18020b57cec5SDimitry Andric (i64 (REG_SEQUENCE SReg_64, 18030b57cec5SDimitry Andric (i32 (COPY_TO_REGCLASS (S_BCNT1_I32_B64 $src), SReg_32)), sub0, 18040b57cec5SDimitry Andric (S_MOV_B32 (i32 0)), sub1)) 18050b57cec5SDimitry Andric>; 18060b57cec5SDimitry Andric 18070b57cec5SDimitry Andricdef : GCNPat < 180881ad6265SDimitry Andric (i32 (UniformBinFrag<smax> i32:$x, (i32 (ineg i32:$x)))), 1809480093f4SDimitry Andric (S_ABS_I32 SReg_32:$x) 18100b57cec5SDimitry Andric>; 18110b57cec5SDimitry Andric 18120b57cec5SDimitry Andricdef : GCNPat < 18130b57cec5SDimitry Andric (i16 imm:$imm), 18140b57cec5SDimitry Andric (S_MOV_B32 imm:$imm) 18150b57cec5SDimitry Andric>; 18160b57cec5SDimitry Andric 18170b57cec5SDimitry Andric// Same as a 32-bit inreg 18180b57cec5SDimitry Andricdef : GCNPat< 18195ffd83dbSDimitry Andric (i32 (UniformUnaryFrag<sext> i16:$src)), 18200b57cec5SDimitry Andric (S_SEXT_I32_I16 $src) 18210b57cec5SDimitry Andric>; 18220b57cec5SDimitry Andric 18237a6dacacSDimitry Andriclet SubtargetPredicate = isNotGFX12Plus in 18247a6dacacSDimitry Andric def : GCNPat <(int_amdgcn_s_wait_event_export_ready), (S_WAIT_EVENT (i16 0))>; 18257a6dacacSDimitry Andriclet SubtargetPredicate = isGFX12Plus in 18263a079333SDimitry Andric def : GCNPat <(int_amdgcn_s_wait_event_export_ready), (S_WAIT_EVENT (i16 2))>; 18270b57cec5SDimitry Andric 18285f757f3fSDimitry Andric// The first 10 bits of the mode register are the core FP mode on all 18295f757f3fSDimitry Andric// subtargets. 18305f757f3fSDimitry Andric// 18315f757f3fSDimitry Andric// The high bits include additional fields, intermixed with some 18325f757f3fSDimitry Andric// non-floating point environment information. We extract the full 18335f757f3fSDimitry Andric// register and clear non-relevant bits. 18345f757f3fSDimitry Andric// 18355f757f3fSDimitry Andric// EXCP_EN covers floating point exceptions, but also some other 18365f757f3fSDimitry Andric// non-FP exceptions. 18375f757f3fSDimitry Andric// 18385f757f3fSDimitry Andric// Bits 12-18 cover the relevant exception mask on all subtargets. 18395f757f3fSDimitry Andric// 18405f757f3fSDimitry Andric// FIXME: Bit 18 is int_div0, should this be in the FP environment? I 18415f757f3fSDimitry Andric// think the only source is v_rcp_iflag_i32. 18425f757f3fSDimitry Andric// 18435f757f3fSDimitry Andric// On GFX9+: 18445f757f3fSDimitry Andric// Bit 23 is the additional FP16_OVFL mode. 18455f757f3fSDimitry Andric// 18465f757f3fSDimitry Andric// Bits 19, 20, and 21 cover non-FP exceptions and differ between 18475f757f3fSDimitry Andric// gfx9/10/11, so we ignore them here. 18485f757f3fSDimitry Andric 18495f757f3fSDimitry Andric// TODO: Would it be cheaper to emit multiple s_getreg_b32 calls for 18505f757f3fSDimitry Andric// the ranges and combine the results? 18515f757f3fSDimitry Andric 18525f757f3fSDimitry Andricdefvar fp_round_mask = !add(!shl(1, 4), -1); 18535f757f3fSDimitry Andricdefvar fp_denorm_mask = !shl(!add(!shl(1, 4), -1), 4); 18545f757f3fSDimitry Andricdefvar dx10_clamp_mask = !shl(1, 8); 18555f757f3fSDimitry Andricdefvar ieee_mode_mask = !shl(1, 9); 18565f757f3fSDimitry Andric 18575f757f3fSDimitry Andric// Covers fp_round, fp_denorm, dx10_clamp, and IEEE bit. 18585f757f3fSDimitry Andricdefvar fpmode_mask = 18595f757f3fSDimitry Andric !or(fp_round_mask, fp_denorm_mask, dx10_clamp_mask, ieee_mode_mask); 18605f757f3fSDimitry Andric 18615f757f3fSDimitry Andricdefvar fp_excp_en_mask = !shl(!add(!shl(1, 7), -1), 12); 18625f757f3fSDimitry Andricdefvar fp16_ovfl = !shl(1, 23); 18635f757f3fSDimitry Andricdefvar fpmode_mask_gfx6plus = !or(fpmode_mask, fp_excp_en_mask); 18645f757f3fSDimitry Andricdefvar fpmode_mask_gfx9plus = !or(fpmode_mask_gfx6plus, fp16_ovfl); 18655f757f3fSDimitry Andric 18665f757f3fSDimitry Andricclass GetFPModePat<int fpmode_mask> : GCNPat< 18675f757f3fSDimitry Andric (i32 get_fpmode), 18685f757f3fSDimitry Andric (S_AND_B32 (i32 fpmode_mask), 18695f757f3fSDimitry Andric (S_GETREG_B32 getHwRegImm< 18705f757f3fSDimitry Andric HWREG.MODE, 0, 18715f757f3fSDimitry Andric !add(!logtwo(fpmode_mask), 1)>.ret)) 18725f757f3fSDimitry Andric>; 18735f757f3fSDimitry Andric 18745f757f3fSDimitry Andric// TODO: Might be worth moving to custom lowering so the and is 18755f757f3fSDimitry Andric// exposed to demanded bits optimizations. Most users probably only 18765f757f3fSDimitry Andric// care about the rounding or denorm mode bits. We also can reduce the 18775f757f3fSDimitry Andric// demanded read from the getreg immediate. 18785f757f3fSDimitry Andriclet SubtargetPredicate = isGFX9Plus in { 18795f757f3fSDimitry Andric// Last bit = FP16_OVFL 18805f757f3fSDimitry Andricdef : GetFPModePat<fpmode_mask_gfx9plus>; 18815f757f3fSDimitry Andric} 18825f757f3fSDimitry Andric 18835f757f3fSDimitry Andric// Last bit = EXCP_EN.int_div0 18845f757f3fSDimitry Andriclet SubtargetPredicate = isNotGFX9Plus in { 18855f757f3fSDimitry Andricdef : GetFPModePat<fpmode_mask_gfx6plus>; 18865f757f3fSDimitry Andric} 18875f757f3fSDimitry Andric 1888*0fca6ea1SDimitry Andriclet SubtargetPredicate = isGFX9GFX10 in 1889*0fca6ea1SDimitry Andricdef : GCNPat< 1890*0fca6ea1SDimitry Andric (int_amdgcn_pops_exiting_wave_id), 1891*0fca6ea1SDimitry Andric (S_MOV_B32_sideeffects (i32 SRC_POPS_EXITING_WAVE_ID)) 1892*0fca6ea1SDimitry Andric>; 1893*0fca6ea1SDimitry Andric 18940b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 18950b57cec5SDimitry Andric// SOP2 Patterns 18960b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 18970b57cec5SDimitry Andric 18985f757f3fSDimitry Andricdef UniformSelect : PatFrag< 18995f757f3fSDimitry Andric (ops node:$src0, node:$src1), 19005f757f3fSDimitry Andric (select SCC, $src0, $src1), 19015f757f3fSDimitry Andric [{ return !N->isDivergent(); }] 19025f757f3fSDimitry Andric>; 19035f757f3fSDimitry Andric 19045f757f3fSDimitry Andriclet AddedComplexity = 20 in { 19055f757f3fSDimitry Andric def : GCNPat< 19065f757f3fSDimitry Andric (i32 (UniformSelect i32:$src0, i32:$src1)), 19075f757f3fSDimitry Andric (S_CSELECT_B32 SSrc_b32:$src0, SSrc_b32:$src1) 19085f757f3fSDimitry Andric >; 19095f757f3fSDimitry Andric 19105f757f3fSDimitry Andric // TODO: The predicate should not be necessary, but enabling this pattern for 19115f757f3fSDimitry Andric // all subtargets generates worse code in some cases. 19125f757f3fSDimitry Andric let OtherPredicates = [HasPseudoScalarTrans] in 19135f757f3fSDimitry Andric def : GCNPat< 19145f757f3fSDimitry Andric (f32 (UniformSelect f32:$src0, f32:$src1)), 19155f757f3fSDimitry Andric (S_CSELECT_B32 SSrc_b32:$src0, SSrc_b32:$src1) 19165f757f3fSDimitry Andric >; 19175f757f3fSDimitry Andric} 19185f757f3fSDimitry Andric 19190b57cec5SDimitry Andric// V_ADD_I32_e32/S_ADD_U32 produces carry in VCC/SCC. For the vector 19200b57cec5SDimitry Andric// case, the sgpr-copies pass will fix this to use the vector version. 19210b57cec5SDimitry Andricdef : GCNPat < 19220b57cec5SDimitry Andric (i32 (addc i32:$src0, i32:$src1)), 19230b57cec5SDimitry Andric (S_ADD_U32 $src0, $src1) 19240b57cec5SDimitry Andric>; 19250b57cec5SDimitry Andric 19260b57cec5SDimitry Andric// FIXME: We need to use COPY_TO_REGCLASS to work-around the fact that 19270b57cec5SDimitry Andric// REG_SEQUENCE patterns don't support instructions with multiple 19280b57cec5SDimitry Andric// outputs. 19290b57cec5SDimitry Andricdef : GCNPat< 193081ad6265SDimitry Andric (i64 (UniformUnaryFrag<zext> i16:$src)), 19310b57cec5SDimitry Andric (REG_SEQUENCE SReg_64, 19320b57cec5SDimitry Andric (i32 (COPY_TO_REGCLASS (S_AND_B32 $src, (S_MOV_B32 (i32 0xffff))), SGPR_32)), sub0, 19330b57cec5SDimitry Andric (S_MOV_B32 (i32 0)), sub1) 19340b57cec5SDimitry Andric>; 19350b57cec5SDimitry Andric 19360b57cec5SDimitry Andricdef : GCNPat < 19375ffd83dbSDimitry Andric (i64 (UniformUnaryFrag<sext> i16:$src)), 19380b57cec5SDimitry Andric (REG_SEQUENCE SReg_64, (i32 (S_SEXT_I32_I16 $src)), sub0, 19390b57cec5SDimitry Andric (i32 (COPY_TO_REGCLASS (S_ASHR_I32 (i32 (S_SEXT_I32_I16 $src)), (S_MOV_B32 (i32 31))), SGPR_32)), sub1) 19400b57cec5SDimitry Andric>; 19410b57cec5SDimitry Andric 19420b57cec5SDimitry Andricdef : GCNPat< 194381ad6265SDimitry Andric (i32 (UniformUnaryFrag<zext> i16:$src)), 19440b57cec5SDimitry Andric (S_AND_B32 (S_MOV_B32 (i32 0xffff)), $src) 19450b57cec5SDimitry Andric>; 19460b57cec5SDimitry Andric 1947e8d8bef9SDimitry Andricclass ScalarNot2Pat<Instruction inst, SDPatternOperator op, ValueType vt, 1948*0fca6ea1SDimitry Andric SDPatternOperator notnode = !if(vt.isVector, vnot, not)> : GCNPat< 1949*0fca6ea1SDimitry Andric (UniformBinFrag<op> vt:$src0, (notnode vt:$src1)), 1950e8d8bef9SDimitry Andric (inst getSOPSrcForVT<vt>.ret:$src0, getSOPSrcForVT<vt>.ret:$src1) 1951e8d8bef9SDimitry Andric>; 1952e8d8bef9SDimitry Andric 1953e8d8bef9SDimitry Andric// Match these for some more types 1954e8d8bef9SDimitry Andric// TODO: i1 1955*0fca6ea1SDimitry Andricdef : ScalarNot2Pat<S_ANDN2_B32, and, i16>; 1956e8d8bef9SDimitry Andricdef : ScalarNot2Pat<S_ANDN2_B32, and, v2i16>; 1957e8d8bef9SDimitry Andricdef : ScalarNot2Pat<S_ANDN2_B64, and, v4i16>; 1958e8d8bef9SDimitry Andricdef : ScalarNot2Pat<S_ANDN2_B64, and, v2i32>; 1959e8d8bef9SDimitry Andric 1960*0fca6ea1SDimitry Andricdef : ScalarNot2Pat<S_ORN2_B32, or, i16>; 1961e8d8bef9SDimitry Andricdef : ScalarNot2Pat<S_ORN2_B32, or, v2i16>; 1962e8d8bef9SDimitry Andricdef : ScalarNot2Pat<S_ORN2_B64, or, v4i16>; 1963e8d8bef9SDimitry Andricdef : ScalarNot2Pat<S_ORN2_B64, or, v2i32>; 19640b57cec5SDimitry Andric 19650b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 19660b57cec5SDimitry Andric// Target-specific instruction encodings. 19670b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 19680b57cec5SDimitry Andric 1969*0fca6ea1SDimitry Andricclass Select<GFXGen Gen, string opName> : SIMCInstr<opName, Gen.Subtarget> { 1970*0fca6ea1SDimitry Andric Predicate AssemblerPredicate = Gen.AssemblerPredicate; 1971*0fca6ea1SDimitry Andric string DecoderNamespace = Gen.DecoderNamespace; 19720b57cec5SDimitry Andric} 19730b57cec5SDimitry Andric 1974e8d8bef9SDimitry Andricclass Select_vi<string opName> : SIMCInstr<opName, SIEncodingFamily.VI> { 1975e8d8bef9SDimitry Andric Predicate AssemblerPredicate = isGFX8GFX9; 1976e8d8bef9SDimitry Andric string DecoderNamespace = "GFX8"; 1977e8d8bef9SDimitry Andric} 1978e8d8bef9SDimitry Andric 1979e8d8bef9SDimitry Andricclass Select_gfx6_gfx7<string opName> : SIMCInstr<opName, SIEncodingFamily.SI> { 1980e8d8bef9SDimitry Andric Predicate AssemblerPredicate = isGFX6GFX7; 1981e8d8bef9SDimitry Andric string DecoderNamespace = "GFX6GFX7"; 1982e8d8bef9SDimitry Andric} 1983e8d8bef9SDimitry Andric 1984e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 19855f757f3fSDimitry Andric// SOP1 - GFX11, GFX12 198681ad6265SDimitry Andric//===----------------------------------------------------------------------===// 198781ad6265SDimitry Andric 1988*0fca6ea1SDimitry Andricmulticlass SOP1_Real_gfx11<bits<8> op, string name = !tolower(NAME)> { 1989*0fca6ea1SDimitry Andric defvar ps = !cast<SOP1_Pseudo>(NAME); 1990*0fca6ea1SDimitry Andric def _gfx11 : SOP1_Real<op, ps, name>, 1991*0fca6ea1SDimitry Andric Select<GFX11Gen, ps.PseudoInstr>; 1992*0fca6ea1SDimitry Andric if !ne(ps.Mnemonic, name) then 1993*0fca6ea1SDimitry Andric def : AMDGPUMnemonicAlias<ps.Mnemonic, name> { 1994*0fca6ea1SDimitry Andric let AssemblerPredicate = isGFX11Only; 1995*0fca6ea1SDimitry Andric } 1996*0fca6ea1SDimitry Andric} 1997*0fca6ea1SDimitry Andric 1998*0fca6ea1SDimitry Andricmulticlass SOP1_Real_gfx12<bits<8> op, string name = !tolower(NAME)> { 1999*0fca6ea1SDimitry Andric defvar ps = !cast<SOP1_Pseudo>(NAME); 2000*0fca6ea1SDimitry Andric def _gfx12 : SOP1_Real<op, ps, name>, 2001*0fca6ea1SDimitry Andric Select<GFX12Gen, ps.PseudoInstr>; 2002*0fca6ea1SDimitry Andric if !ne(ps.Mnemonic, name) then 2003*0fca6ea1SDimitry Andric def : AMDGPUMnemonicAlias<ps.Mnemonic, name> { 2004*0fca6ea1SDimitry Andric let AssemblerPredicate = isGFX12Plus; 2005*0fca6ea1SDimitry Andric } 20065f757f3fSDimitry Andric} 20075f757f3fSDimitry Andric 20085f757f3fSDimitry Andricmulticlass SOP1_M0_Real_gfx12<bits<8> op> { 20095f757f3fSDimitry Andric def _gfx12 : SOP1_Real<op, !cast<SOP1_Pseudo>(NAME)>, 2010*0fca6ea1SDimitry Andric Select<GFX12Gen, !cast<SOP1_Pseudo>(NAME).PseudoInstr> { 20115f757f3fSDimitry Andric let Inst{7-0} = M0_gfx11plus.HWEncoding{7-0}; // Set Src0 encoding to M0 20125f757f3fSDimitry Andric } 20135f757f3fSDimitry Andric} 20145f757f3fSDimitry Andric 2015*0fca6ea1SDimitry Andricmulticlass SOP1_IMM_Real_gfx12<bits<8> op> { 2016*0fca6ea1SDimitry Andric defvar ps = !cast<SOP1_Pseudo>(NAME); 2017*0fca6ea1SDimitry Andric def _gfx12 : SOP1_Real<op, ps>, 2018*0fca6ea1SDimitry Andric Select<GFX12Gen, ps.PseudoInstr>; 201981ad6265SDimitry Andric} 202081ad6265SDimitry Andric 2021*0fca6ea1SDimitry Andricmulticlass SOP1_Real_gfx11_gfx12<bits<8> op, string name = !tolower(NAME)> : 2022*0fca6ea1SDimitry Andric SOP1_Real_gfx11<op, name>, SOP1_Real_gfx12<op, name>; 20235f757f3fSDimitry Andric 20245f757f3fSDimitry Andricdefm S_MOV_B32 : SOP1_Real_gfx11_gfx12<0x000>; 20255f757f3fSDimitry Andricdefm S_MOV_B64 : SOP1_Real_gfx11_gfx12<0x001>; 20265f757f3fSDimitry Andricdefm S_CMOV_B32 : SOP1_Real_gfx11_gfx12<0x002>; 20275f757f3fSDimitry Andricdefm S_CMOV_B64 : SOP1_Real_gfx11_gfx12<0x003>; 20285f757f3fSDimitry Andricdefm S_BREV_B32 : SOP1_Real_gfx11_gfx12<0x004>; 20295f757f3fSDimitry Andricdefm S_BREV_B64 : SOP1_Real_gfx11_gfx12<0x005>; 2030*0fca6ea1SDimitry Andricdefm S_FF1_I32_B32 : SOP1_Real_gfx11_gfx12<0x008, "s_ctz_i32_b32">; 2031*0fca6ea1SDimitry Andricdefm S_FF1_I32_B64 : SOP1_Real_gfx11_gfx12<0x009, "s_ctz_i32_b64">; 2032*0fca6ea1SDimitry Andricdefm S_FLBIT_I32_B32 : SOP1_Real_gfx11_gfx12<0x00a, "s_clz_i32_u32">; 2033*0fca6ea1SDimitry Andricdefm S_FLBIT_I32_B64 : SOP1_Real_gfx11_gfx12<0x00b, "s_clz_i32_u64">; 2034*0fca6ea1SDimitry Andricdefm S_FLBIT_I32 : SOP1_Real_gfx11_gfx12<0x00c, "s_cls_i32">; 2035*0fca6ea1SDimitry Andricdefm S_FLBIT_I32_I64 : SOP1_Real_gfx11_gfx12<0x00d, "s_cls_i32_i64">; 20365f757f3fSDimitry Andricdefm S_SEXT_I32_I8 : SOP1_Real_gfx11_gfx12<0x00e>; 20375f757f3fSDimitry Andricdefm S_SEXT_I32_I16 : SOP1_Real_gfx11_gfx12<0x00f>; 20385f757f3fSDimitry Andricdefm S_BITSET0_B32 : SOP1_Real_gfx11_gfx12<0x010>; 20395f757f3fSDimitry Andricdefm S_BITSET0_B64 : SOP1_Real_gfx11_gfx12<0x011>; 20405f757f3fSDimitry Andricdefm S_BITSET1_B32 : SOP1_Real_gfx11_gfx12<0x012>; 20415f757f3fSDimitry Andricdefm S_BITSET1_B64 : SOP1_Real_gfx11_gfx12<0x013>; 20425f757f3fSDimitry Andricdefm S_BITREPLICATE_B64_B32 : SOP1_Real_gfx11_gfx12<0x014>; 20435f757f3fSDimitry Andricdefm S_ABS_I32 : SOP1_Real_gfx11_gfx12<0x015>; 20445f757f3fSDimitry Andricdefm S_BCNT0_I32_B32 : SOP1_Real_gfx11_gfx12<0x016>; 20455f757f3fSDimitry Andricdefm S_BCNT0_I32_B64 : SOP1_Real_gfx11_gfx12<0x017>; 20465f757f3fSDimitry Andricdefm S_BCNT1_I32_B32 : SOP1_Real_gfx11_gfx12<0x018>; 20475f757f3fSDimitry Andricdefm S_BCNT1_I32_B64 : SOP1_Real_gfx11_gfx12<0x019>; 20485f757f3fSDimitry Andricdefm S_QUADMASK_B32 : SOP1_Real_gfx11_gfx12<0x01a>; 20495f757f3fSDimitry Andricdefm S_QUADMASK_B64 : SOP1_Real_gfx11_gfx12<0x01b>; 20505f757f3fSDimitry Andricdefm S_WQM_B32 : SOP1_Real_gfx11_gfx12<0x01c>; 20515f757f3fSDimitry Andricdefm S_WQM_B64 : SOP1_Real_gfx11_gfx12<0x01d>; 20525f757f3fSDimitry Andricdefm S_NOT_B32 : SOP1_Real_gfx11_gfx12<0x01e>; 20535f757f3fSDimitry Andricdefm S_NOT_B64 : SOP1_Real_gfx11_gfx12<0x01f>; 20545f757f3fSDimitry Andricdefm S_AND_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x020>; 20555f757f3fSDimitry Andricdefm S_AND_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x021>; 20565f757f3fSDimitry Andricdefm S_OR_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x022>; 20575f757f3fSDimitry Andricdefm S_OR_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x023>; 20585f757f3fSDimitry Andricdefm S_XOR_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x024>; 20595f757f3fSDimitry Andricdefm S_XOR_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x025>; 20605f757f3fSDimitry Andricdefm S_NAND_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x026>; 20615f757f3fSDimitry Andricdefm S_NAND_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x027>; 20625f757f3fSDimitry Andricdefm S_NOR_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x028>; 20635f757f3fSDimitry Andricdefm S_NOR_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x029>; 20645f757f3fSDimitry Andricdefm S_XNOR_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x02a>; 2065*0fca6ea1SDimitry Andricdefm S_ANDN1_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x02c, "s_and_not0_saveexec_b32">; 2066*0fca6ea1SDimitry Andricdefm S_ANDN1_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x02d, "s_and_not0_saveexec_b64">; 2067*0fca6ea1SDimitry Andricdefm S_ORN1_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x02e, "s_or_not0_saveexec_b32">; 2068*0fca6ea1SDimitry Andricdefm S_ORN1_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x02f, "s_or_not0_saveexec_b64">; 2069*0fca6ea1SDimitry Andricdefm S_ANDN2_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x030, "s_and_not1_saveexec_b32">; 2070*0fca6ea1SDimitry Andricdefm S_ANDN2_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x031, "s_and_not1_saveexec_b64">; 2071*0fca6ea1SDimitry Andricdefm S_ORN2_SAVEEXEC_B32 : SOP1_Real_gfx11_gfx12<0x032, "s_or_not1_saveexec_b32">; 2072*0fca6ea1SDimitry Andricdefm S_ORN2_SAVEEXEC_B64 : SOP1_Real_gfx11_gfx12<0x033, "s_or_not1_saveexec_b64">; 2073*0fca6ea1SDimitry Andricdefm S_ANDN1_WREXEC_B32 : SOP1_Real_gfx11_gfx12<0x034, "s_and_not0_wrexec_b32">; 2074*0fca6ea1SDimitry Andricdefm S_ANDN1_WREXEC_B64 : SOP1_Real_gfx11_gfx12<0x035, "s_and_not0_wrexec_b64">; 2075*0fca6ea1SDimitry Andricdefm S_ANDN2_WREXEC_B32 : SOP1_Real_gfx11_gfx12<0x036, "s_and_not1_wrexec_b32">; 2076*0fca6ea1SDimitry Andricdefm S_ANDN2_WREXEC_B64 : SOP1_Real_gfx11_gfx12<0x037, "s_and_not1_wrexec_b64">; 20775f757f3fSDimitry Andricdefm S_MOVRELS_B32 : SOP1_Real_gfx11_gfx12<0x040>; 20785f757f3fSDimitry Andricdefm S_MOVRELS_B64 : SOP1_Real_gfx11_gfx12<0x041>; 20795f757f3fSDimitry Andricdefm S_MOVRELD_B32 : SOP1_Real_gfx11_gfx12<0x042>; 20805f757f3fSDimitry Andricdefm S_MOVRELD_B64 : SOP1_Real_gfx11_gfx12<0x043>; 20815f757f3fSDimitry Andricdefm S_MOVRELSD_2_B32 : SOP1_Real_gfx11_gfx12<0x044>; 20825f757f3fSDimitry Andricdefm S_GETPC_B64 : SOP1_Real_gfx11_gfx12<0x047>; 20835f757f3fSDimitry Andricdefm S_SETPC_B64 : SOP1_Real_gfx11_gfx12<0x048>; 20845f757f3fSDimitry Andricdefm S_SWAPPC_B64 : SOP1_Real_gfx11_gfx12<0x049>; 20855f757f3fSDimitry Andricdefm S_RFE_B64 : SOP1_Real_gfx11_gfx12<0x04a>; 20865f757f3fSDimitry Andricdefm S_SENDMSG_RTN_B32 : SOP1_Real_gfx11_gfx12<0x04c>; 20875f757f3fSDimitry Andricdefm S_SENDMSG_RTN_B64 : SOP1_Real_gfx11_gfx12<0x04d>; 20885f757f3fSDimitry Andricdefm S_BARRIER_SIGNAL_M0 : SOP1_M0_Real_gfx12<0x04e>; 20895f757f3fSDimitry Andricdefm S_BARRIER_SIGNAL_ISFIRST_M0 : SOP1_M0_Real_gfx12<0x04f>; 20905f757f3fSDimitry Andricdefm S_GET_BARRIER_STATE_M0 : SOP1_M0_Real_gfx12<0x050>; 20915f757f3fSDimitry Andricdefm S_BARRIER_INIT_M0 : SOP1_M0_Real_gfx12<0x051>; 20925f757f3fSDimitry Andricdefm S_BARRIER_JOIN_M0 : SOP1_M0_Real_gfx12<0x052>; 20935f757f3fSDimitry Andricdefm S_WAKEUP_BARRIER_M0 : SOP1_M0_Real_gfx12<0x057>; 2094*0fca6ea1SDimitry Andricdefm S_BARRIER_SIGNAL_IMM : SOP1_IMM_Real_gfx12<0x04e>; 2095*0fca6ea1SDimitry Andricdefm S_BARRIER_SIGNAL_ISFIRST_IMM : SOP1_IMM_Real_gfx12<0x04f>; 2096*0fca6ea1SDimitry Andricdefm S_GET_BARRIER_STATE_IMM : SOP1_IMM_Real_gfx12<0x050>; 2097*0fca6ea1SDimitry Andricdefm S_BARRIER_INIT_IMM : SOP1_IMM_Real_gfx12<0x051>; 2098*0fca6ea1SDimitry Andricdefm S_BARRIER_JOIN_IMM : SOP1_IMM_Real_gfx12<0x052>; 2099*0fca6ea1SDimitry Andricdefm S_WAKEUP_BARRIER_IMM : SOP1_IMM_Real_gfx12<0x057>; 2100*0fca6ea1SDimitry Andricdefm S_SLEEP_VAR : SOP1_IMM_Real_gfx12<0x058>; 21015f757f3fSDimitry Andric 21025f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 21035f757f3fSDimitry Andric// SOP1 - GFX1150, GFX12 21045f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 21055f757f3fSDimitry Andric 21065f757f3fSDimitry Andricdefm S_CEIL_F32 : SOP1_Real_gfx11_gfx12<0x060>; 21075f757f3fSDimitry Andricdefm S_FLOOR_F32 : SOP1_Real_gfx11_gfx12<0x061>; 21085f757f3fSDimitry Andricdefm S_TRUNC_F32 : SOP1_Real_gfx11_gfx12<0x062>; 21095f757f3fSDimitry Andricdefm S_RNDNE_F32 : SOP1_Real_gfx11_gfx12<0x063>; 21105f757f3fSDimitry Andricdefm S_CVT_F32_I32 : SOP1_Real_gfx11_gfx12<0x064>; 21115f757f3fSDimitry Andricdefm S_CVT_F32_U32 : SOP1_Real_gfx11_gfx12<0x065>; 21125f757f3fSDimitry Andricdefm S_CVT_I32_F32 : SOP1_Real_gfx11_gfx12<0x066>; 21135f757f3fSDimitry Andricdefm S_CVT_U32_F32 : SOP1_Real_gfx11_gfx12<0x067>; 21145f757f3fSDimitry Andricdefm S_CVT_F16_F32 : SOP1_Real_gfx11_gfx12<0x068>; 21155f757f3fSDimitry Andricdefm S_CVT_F32_F16 : SOP1_Real_gfx11_gfx12<0x069>; 21165f757f3fSDimitry Andricdefm S_CVT_HI_F32_F16 : SOP1_Real_gfx11_gfx12<0x06a>; 21175f757f3fSDimitry Andricdefm S_CEIL_F16 : SOP1_Real_gfx11_gfx12<0x06b>; 21185f757f3fSDimitry Andricdefm S_FLOOR_F16 : SOP1_Real_gfx11_gfx12<0x06c>; 21195f757f3fSDimitry Andricdefm S_TRUNC_F16 : SOP1_Real_gfx11_gfx12<0x06d>; 21205f757f3fSDimitry Andricdefm S_RNDNE_F16 : SOP1_Real_gfx11_gfx12<0x06e>; 212181ad6265SDimitry Andric 212281ad6265SDimitry Andric//===----------------------------------------------------------------------===// 2123e8d8bef9SDimitry Andric// SOP1 - GFX10. 2124e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 2125e8d8bef9SDimitry Andric 21260b57cec5SDimitry Andricmulticlass SOP1_Real_gfx10<bits<8> op> { 2127fe6060f1SDimitry Andric defvar ps = !cast<SOP1_Pseudo>(NAME); 2128fe6060f1SDimitry Andric def _gfx10 : SOP1_Real<op, ps>, 2129*0fca6ea1SDimitry Andric Select<GFX10Gen, ps.PseudoInstr>; 21300b57cec5SDimitry Andric} 21310b57cec5SDimitry Andric 21325f757f3fSDimitry Andricmulticlass SOP1_Real_gfx10_gfx11_gfx12<bits<8> op> : 21335f757f3fSDimitry Andric SOP1_Real_gfx10<op>, SOP1_Real_gfx11_gfx12<op>; 213481ad6265SDimitry Andric 21350b57cec5SDimitry Andricdefm S_ANDN1_SAVEEXEC_B64 : SOP1_Real_gfx10<0x037>; 21360b57cec5SDimitry Andricdefm S_ORN1_SAVEEXEC_B64 : SOP1_Real_gfx10<0x038>; 21370b57cec5SDimitry Andricdefm S_ANDN1_WREXEC_B64 : SOP1_Real_gfx10<0x039>; 21380b57cec5SDimitry Andricdefm S_ANDN2_WREXEC_B64 : SOP1_Real_gfx10<0x03a>; 21390b57cec5SDimitry Andricdefm S_BITREPLICATE_B64_B32 : SOP1_Real_gfx10<0x03b>; 21400b57cec5SDimitry Andricdefm S_AND_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03c>; 21410b57cec5SDimitry Andricdefm S_OR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03d>; 21420b57cec5SDimitry Andricdefm S_XOR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03e>; 21430b57cec5SDimitry Andricdefm S_ANDN2_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03f>; 21440b57cec5SDimitry Andricdefm S_ORN2_SAVEEXEC_B32 : SOP1_Real_gfx10<0x040>; 21450b57cec5SDimitry Andricdefm S_NAND_SAVEEXEC_B32 : SOP1_Real_gfx10<0x041>; 21460b57cec5SDimitry Andricdefm S_NOR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x042>; 21470b57cec5SDimitry Andricdefm S_XNOR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x043>; 21480b57cec5SDimitry Andricdefm S_ANDN1_SAVEEXEC_B32 : SOP1_Real_gfx10<0x044>; 21490b57cec5SDimitry Andricdefm S_ORN1_SAVEEXEC_B32 : SOP1_Real_gfx10<0x045>; 21500b57cec5SDimitry Andricdefm S_ANDN1_WREXEC_B32 : SOP1_Real_gfx10<0x046>; 21510b57cec5SDimitry Andricdefm S_ANDN2_WREXEC_B32 : SOP1_Real_gfx10<0x047>; 21520b57cec5SDimitry Andricdefm S_MOVRELSD_2_B32 : SOP1_Real_gfx10<0x049>; 21530b57cec5SDimitry Andric 21540b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 215581ad6265SDimitry Andric// SOP1 - GFX6, GFX7, GFX10, GFX11. 21560b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 21570b57cec5SDimitry Andric 21580b57cec5SDimitry Andric 21590b57cec5SDimitry Andricmulticlass SOP1_Real_gfx6_gfx7<bits<8> op> { 2160fe6060f1SDimitry Andric defvar ps = !cast<SOP1_Pseudo>(NAME); 2161fe6060f1SDimitry Andric def _gfx6_gfx7 : SOP1_Real<op, ps>, 2162*0fca6ea1SDimitry Andric Select_gfx6_gfx7<ps.PseudoInstr>; 21630b57cec5SDimitry Andric} 21640b57cec5SDimitry Andric 21650b57cec5SDimitry Andricmulticlass SOP1_Real_gfx6_gfx7_gfx10<bits<8> op> : 21660b57cec5SDimitry Andric SOP1_Real_gfx6_gfx7<op>, SOP1_Real_gfx10<op>; 21670b57cec5SDimitry Andric 21685f757f3fSDimitry Andricmulticlass SOP1_Real_gfx6_gfx7_gfx10_gfx11_gfx12<bits<8> op> : 21695f757f3fSDimitry Andric SOP1_Real_gfx6_gfx7<op>, SOP1_Real_gfx10_gfx11_gfx12<op>; 217081ad6265SDimitry Andric 21710b57cec5SDimitry Andricdefm S_CBRANCH_JOIN : SOP1_Real_gfx6_gfx7<0x032>; 21720b57cec5SDimitry Andric 21730b57cec5SDimitry Andricdefm S_MOV_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x003>; 21740b57cec5SDimitry Andricdefm S_MOV_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x004>; 21750b57cec5SDimitry Andricdefm S_CMOV_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x005>; 21760b57cec5SDimitry Andricdefm S_CMOV_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x006>; 21770b57cec5SDimitry Andricdefm S_NOT_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x007>; 21780b57cec5SDimitry Andricdefm S_NOT_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x008>; 21790b57cec5SDimitry Andricdefm S_WQM_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x009>; 21800b57cec5SDimitry Andricdefm S_WQM_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x00a>; 21810b57cec5SDimitry Andricdefm S_BREV_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x00b>; 21820b57cec5SDimitry Andricdefm S_BREV_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x00c>; 21830b57cec5SDimitry Andricdefm S_BCNT0_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x00d>; 21840b57cec5SDimitry Andricdefm S_BCNT0_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x00e>; 21850b57cec5SDimitry Andricdefm S_BCNT1_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x00f>; 21860b57cec5SDimitry Andricdefm S_BCNT1_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x010>; 21870b57cec5SDimitry Andricdefm S_FF0_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x011>; 21880b57cec5SDimitry Andricdefm S_FF0_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x012>; 21890b57cec5SDimitry Andricdefm S_FF1_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x013>; 21900b57cec5SDimitry Andricdefm S_FF1_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x014>; 21910b57cec5SDimitry Andricdefm S_FLBIT_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x015>; 21920b57cec5SDimitry Andricdefm S_FLBIT_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x016>; 21930b57cec5SDimitry Andricdefm S_FLBIT_I32 : SOP1_Real_gfx6_gfx7_gfx10<0x017>; 21940b57cec5SDimitry Andricdefm S_FLBIT_I32_I64 : SOP1_Real_gfx6_gfx7_gfx10<0x018>; 21950b57cec5SDimitry Andricdefm S_SEXT_I32_I8 : SOP1_Real_gfx6_gfx7_gfx10<0x019>; 21960b57cec5SDimitry Andricdefm S_SEXT_I32_I16 : SOP1_Real_gfx6_gfx7_gfx10<0x01a>; 21970b57cec5SDimitry Andricdefm S_BITSET0_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x01b>; 21980b57cec5SDimitry Andricdefm S_BITSET0_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x01c>; 21990b57cec5SDimitry Andricdefm S_BITSET1_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x01d>; 22000b57cec5SDimitry Andricdefm S_BITSET1_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x01e>; 22010b57cec5SDimitry Andricdefm S_GETPC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x01f>; 22020b57cec5SDimitry Andricdefm S_SETPC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x020>; 22030b57cec5SDimitry Andricdefm S_SWAPPC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x021>; 22040b57cec5SDimitry Andricdefm S_RFE_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x022>; 22050b57cec5SDimitry Andricdefm S_AND_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x024>; 22060b57cec5SDimitry Andricdefm S_OR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x025>; 22070b57cec5SDimitry Andricdefm S_XOR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x026>; 22080b57cec5SDimitry Andricdefm S_ANDN2_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x027>; 22090b57cec5SDimitry Andricdefm S_ORN2_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x028>; 22100b57cec5SDimitry Andricdefm S_NAND_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x029>; 22110b57cec5SDimitry Andricdefm S_NOR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x02a>; 22125f757f3fSDimitry Andricdefm S_XNOR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10_gfx11_gfx12<0x02b>; 22130b57cec5SDimitry Andricdefm S_QUADMASK_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x02c>; 22140b57cec5SDimitry Andricdefm S_QUADMASK_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x02d>; 22150b57cec5SDimitry Andricdefm S_MOVRELS_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x02e>; 22160b57cec5SDimitry Andricdefm S_MOVRELS_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x02f>; 22170b57cec5SDimitry Andricdefm S_MOVRELD_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x030>; 22180b57cec5SDimitry Andricdefm S_MOVRELD_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x031>; 22190b57cec5SDimitry Andricdefm S_ABS_I32 : SOP1_Real_gfx6_gfx7_gfx10<0x034>; 22200b57cec5SDimitry Andric 22210b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 22225f757f3fSDimitry Andric// SOP2 - GFX12 22235f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 22245f757f3fSDimitry Andric 2225*0fca6ea1SDimitry Andricmulticlass SOP2_Real_gfx12<bits<7> op, string name = !tolower(NAME)> { 2226*0fca6ea1SDimitry Andric defvar ps = !cast<SOP2_Pseudo>(NAME); 2227*0fca6ea1SDimitry Andric def _gfx12 : SOP2_Real32<op, ps, name>, 2228*0fca6ea1SDimitry Andric Select<GFX12Gen, ps.PseudoInstr>; 2229*0fca6ea1SDimitry Andric if !ne(ps.Mnemonic, name) then 2230*0fca6ea1SDimitry Andric def : AMDGPUMnemonicAlias<ps.Mnemonic, name> { 2231*0fca6ea1SDimitry Andric let AssemblerPredicate = isGFX12Plus; 2232*0fca6ea1SDimitry Andric } 22335f757f3fSDimitry Andric} 22345f757f3fSDimitry Andric 22355f757f3fSDimitry Andricdefm S_MINIMUM_F32 : SOP2_Real_gfx12<0x04f>; 22365f757f3fSDimitry Andricdefm S_MAXIMUM_F32 : SOP2_Real_gfx12<0x050>; 22375f757f3fSDimitry Andricdefm S_MINIMUM_F16 : SOP2_Real_gfx12<0x051>; 22385f757f3fSDimitry Andricdefm S_MAXIMUM_F16 : SOP2_Real_gfx12<0x052>; 22395f757f3fSDimitry Andric 22405f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 22415f757f3fSDimitry Andric// SOP2 - GFX11, GFX12. 224281ad6265SDimitry Andric//===----------------------------------------------------------------------===// 224381ad6265SDimitry Andric 2244*0fca6ea1SDimitry Andricmulticlass SOP2_Real_gfx11<bits<7> op, string name = !tolower(NAME)> { 2245*0fca6ea1SDimitry Andric defvar ps = !cast<SOP2_Pseudo>(NAME); 2246*0fca6ea1SDimitry Andric def _gfx11 : SOP2_Real32<op, ps, name>, 2247*0fca6ea1SDimitry Andric Select<GFX11Gen, ps.PseudoInstr>; 2248*0fca6ea1SDimitry Andric if !ne(ps.Mnemonic, name) then 2249*0fca6ea1SDimitry Andric def : AMDGPUMnemonicAlias<ps.Mnemonic, name> { 2250*0fca6ea1SDimitry Andric let AssemblerPredicate = isGFX11Only; 2251*0fca6ea1SDimitry Andric } 225281ad6265SDimitry Andric} 225381ad6265SDimitry Andric 2254*0fca6ea1SDimitry Andricmulticlass SOP2_Real_gfx11_gfx12<bits<7> op, string name = !tolower(NAME)> : 2255*0fca6ea1SDimitry Andric SOP2_Real_gfx11<op, name>, SOP2_Real_gfx12<op, name>; 22565f757f3fSDimitry Andric 22575f757f3fSDimitry Andricdefm S_ABSDIFF_I32 : SOP2_Real_gfx11_gfx12<0x006>; 22585f757f3fSDimitry Andricdefm S_LSHL_B32 : SOP2_Real_gfx11_gfx12<0x008>; 22595f757f3fSDimitry Andricdefm S_LSHL_B64 : SOP2_Real_gfx11_gfx12<0x009>; 22605f757f3fSDimitry Andricdefm S_LSHR_B32 : SOP2_Real_gfx11_gfx12<0x00a>; 22615f757f3fSDimitry Andricdefm S_LSHR_B64 : SOP2_Real_gfx11_gfx12<0x00b>; 22625f757f3fSDimitry Andricdefm S_ASHR_I32 : SOP2_Real_gfx11_gfx12<0x00c>; 22635f757f3fSDimitry Andricdefm S_ASHR_I64 : SOP2_Real_gfx11_gfx12<0x00d>; 22645f757f3fSDimitry Andricdefm S_LSHL1_ADD_U32 : SOP2_Real_gfx11_gfx12<0x00e>; 22655f757f3fSDimitry Andricdefm S_LSHL2_ADD_U32 : SOP2_Real_gfx11_gfx12<0x00f>; 22665f757f3fSDimitry Andricdefm S_LSHL3_ADD_U32 : SOP2_Real_gfx11_gfx12<0x010>; 22675f757f3fSDimitry Andricdefm S_LSHL4_ADD_U32 : SOP2_Real_gfx11_gfx12<0x011>; 22685f757f3fSDimitry Andricdefm S_MIN_I32 : SOP2_Real_gfx11_gfx12<0x012>; 22695f757f3fSDimitry Andricdefm S_MIN_U32 : SOP2_Real_gfx11_gfx12<0x013>; 22705f757f3fSDimitry Andricdefm S_MAX_I32 : SOP2_Real_gfx11_gfx12<0x014>; 22715f757f3fSDimitry Andricdefm S_MAX_U32 : SOP2_Real_gfx11_gfx12<0x015>; 22725f757f3fSDimitry Andricdefm S_AND_B32 : SOP2_Real_gfx11_gfx12<0x016>; 22735f757f3fSDimitry Andricdefm S_AND_B64 : SOP2_Real_gfx11_gfx12<0x017>; 22745f757f3fSDimitry Andricdefm S_OR_B32 : SOP2_Real_gfx11_gfx12<0x018>; 22755f757f3fSDimitry Andricdefm S_OR_B64 : SOP2_Real_gfx11_gfx12<0x019>; 22765f757f3fSDimitry Andricdefm S_XOR_B32 : SOP2_Real_gfx11_gfx12<0x01a>; 22775f757f3fSDimitry Andricdefm S_XOR_B64 : SOP2_Real_gfx11_gfx12<0x01b>; 22785f757f3fSDimitry Andricdefm S_NAND_B32 : SOP2_Real_gfx11_gfx12<0x01c>; 22795f757f3fSDimitry Andricdefm S_NAND_B64 : SOP2_Real_gfx11_gfx12<0x01d>; 22805f757f3fSDimitry Andricdefm S_NOR_B32 : SOP2_Real_gfx11_gfx12<0x01e>; 22815f757f3fSDimitry Andricdefm S_NOR_B64 : SOP2_Real_gfx11_gfx12<0x01f>; 22825f757f3fSDimitry Andricdefm S_XNOR_B32 : SOP2_Real_gfx11_gfx12<0x020>; 22835f757f3fSDimitry Andricdefm S_XNOR_B64 : SOP2_Real_gfx11_gfx12<0x021>; 2284*0fca6ea1SDimitry Andricdefm S_ANDN2_B32 : SOP2_Real_gfx11_gfx12<0x022, "s_and_not1_b32">; 2285*0fca6ea1SDimitry Andricdefm S_ANDN2_B64 : SOP2_Real_gfx11_gfx12<0x023, "s_and_not1_b64">; 2286*0fca6ea1SDimitry Andricdefm S_ORN2_B32 : SOP2_Real_gfx11_gfx12<0x024, "s_or_not1_b32">; 2287*0fca6ea1SDimitry Andricdefm S_ORN2_B64 : SOP2_Real_gfx11_gfx12<0x025, "s_or_not1_b64">; 22885f757f3fSDimitry Andricdefm S_BFE_U32 : SOP2_Real_gfx11_gfx12<0x026>; 22895f757f3fSDimitry Andricdefm S_BFE_I32 : SOP2_Real_gfx11_gfx12<0x027>; 22905f757f3fSDimitry Andricdefm S_BFE_U64 : SOP2_Real_gfx11_gfx12<0x028>; 22915f757f3fSDimitry Andricdefm S_BFE_I64 : SOP2_Real_gfx11_gfx12<0x029>; 22925f757f3fSDimitry Andricdefm S_BFM_B32 : SOP2_Real_gfx11_gfx12<0x02a>; 22935f757f3fSDimitry Andricdefm S_BFM_B64 : SOP2_Real_gfx11_gfx12<0x02b>; 22945f757f3fSDimitry Andricdefm S_MUL_I32 : SOP2_Real_gfx11_gfx12<0x02c>; 22955f757f3fSDimitry Andricdefm S_MUL_HI_U32 : SOP2_Real_gfx11_gfx12<0x02d>; 22965f757f3fSDimitry Andricdefm S_MUL_HI_I32 : SOP2_Real_gfx11_gfx12<0x02e>; 22975f757f3fSDimitry Andricdefm S_CSELECT_B32 : SOP2_Real_gfx11_gfx12<0x030>; 22985f757f3fSDimitry Andricdefm S_CSELECT_B64 : SOP2_Real_gfx11_gfx12<0x031>; 22995f757f3fSDimitry Andricdefm S_PACK_HL_B32_B16 : SOP2_Real_gfx11_gfx12<0x035>; 2300*0fca6ea1SDimitry Andricdefm S_ADD_U64 : SOP2_Real_gfx12<0x053, "s_add_nc_u64">; 2301*0fca6ea1SDimitry Andricdefm S_SUB_U64 : SOP2_Real_gfx12<0x054, "s_sub_nc_u64">; 23025f757f3fSDimitry Andricdefm S_MUL_U64 : SOP2_Real_gfx12<0x055>; 23035f757f3fSDimitry Andric 23045f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 23055f757f3fSDimitry Andric// SOP2 - GFX1150, GFX12 23065f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 23075f757f3fSDimitry Andric 23085f757f3fSDimitry Andricmulticlass SOP2_Real_FMAK_gfx12<bits<7> op> { 23095f757f3fSDimitry Andric def _gfx12 : SOP2_Real64<op, !cast<SOP2_Pseudo>(NAME)>, 2310*0fca6ea1SDimitry Andric Select<GFX12Gen, !cast<SOP2_Pseudo>(NAME).PseudoInstr>; 23115f757f3fSDimitry Andric} 23125f757f3fSDimitry Andric 23135f757f3fSDimitry Andricmulticlass SOP2_Real_FMAK_gfx11<bits<7> op> { 23145f757f3fSDimitry Andric def _gfx11 : SOP2_Real64<op, !cast<SOP2_Pseudo>(NAME)>, 2315*0fca6ea1SDimitry Andric Select<GFX11Gen, !cast<SOP2_Pseudo>(NAME).PseudoInstr>; 23165f757f3fSDimitry Andric} 23175f757f3fSDimitry Andric 23185f757f3fSDimitry Andricmulticlass SOP2_Real_FMAK_gfx11_gfx12<bits<7> op> : 23195f757f3fSDimitry Andric SOP2_Real_FMAK_gfx11<op>, SOP2_Real_FMAK_gfx12<op>; 23205f757f3fSDimitry Andric 23215f757f3fSDimitry Andricdefm S_ADD_F32 : SOP2_Real_gfx11_gfx12<0x040>; 23225f757f3fSDimitry Andricdefm S_SUB_F32 : SOP2_Real_gfx11_gfx12<0x041>; 23235f757f3fSDimitry Andricdefm S_MUL_F32 : SOP2_Real_gfx11_gfx12<0x044>; 23245f757f3fSDimitry Andricdefm S_FMAAK_F32 : SOP2_Real_FMAK_gfx11_gfx12<0x045>; 23255f757f3fSDimitry Andricdefm S_FMAMK_F32 : SOP2_Real_FMAK_gfx11_gfx12<0x046>; 23265f757f3fSDimitry Andricdefm S_FMAC_F32 : SOP2_Real_gfx11_gfx12<0x047>; 23275f757f3fSDimitry Andricdefm S_CVT_PK_RTZ_F16_F32 : SOP2_Real_gfx11_gfx12<0x048>; 23285f757f3fSDimitry Andricdefm S_ADD_F16 : SOP2_Real_gfx11_gfx12<0x049>; 23295f757f3fSDimitry Andricdefm S_SUB_F16 : SOP2_Real_gfx11_gfx12<0x04a>; 23305f757f3fSDimitry Andricdefm S_MUL_F16 : SOP2_Real_gfx11_gfx12<0x04d>; 23315f757f3fSDimitry Andricdefm S_FMAC_F16 : SOP2_Real_gfx11_gfx12<0x04e>; 23325f757f3fSDimitry Andric 23335f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 23345f757f3fSDimitry Andric// SOP2 - GFX1150 23355f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 23365f757f3fSDimitry Andric 2337*0fca6ea1SDimitry Andricmulticlass SOP2_Real_gfx11_Renamed_gfx12<bits<7> op, string gfx12_name> : 2338*0fca6ea1SDimitry Andric SOP2_Real_gfx11<op>, SOP2_Real_gfx12<op, gfx12_name>; 2339*0fca6ea1SDimitry Andric 2340*0fca6ea1SDimitry Andricdefm S_MIN_F32 : SOP2_Real_gfx11_Renamed_gfx12<0x042, "s_min_num_f32">; 2341*0fca6ea1SDimitry Andricdefm S_MAX_F32 : SOP2_Real_gfx11_Renamed_gfx12<0x043, "s_max_num_f32">; 2342*0fca6ea1SDimitry Andricdefm S_MIN_F16 : SOP2_Real_gfx11_Renamed_gfx12<0x04b, "s_min_num_f16">; 2343*0fca6ea1SDimitry Andricdefm S_MAX_F16 : SOP2_Real_gfx11_Renamed_gfx12<0x04c, "s_max_num_f16">; 234481ad6265SDimitry Andric 234581ad6265SDimitry Andric//===----------------------------------------------------------------------===// 23460b57cec5SDimitry Andric// SOP2 - GFX10. 23470b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 23480b57cec5SDimitry Andric 23490b57cec5SDimitry Andricmulticlass SOP2_Real_gfx10<bits<7> op> { 2350fe6060f1SDimitry Andric defvar ps = !cast<SOP2_Pseudo>(NAME); 23515f757f3fSDimitry Andric def _gfx10 : SOP2_Real32<op, ps>, 2352*0fca6ea1SDimitry Andric Select<GFX10Gen, ps.PseudoInstr>; 23530b57cec5SDimitry Andric} 23540b57cec5SDimitry Andric 23555f757f3fSDimitry Andricmulticlass SOP2_Real_gfx10_gfx11_gfx12<bits<7> op> : 23565f757f3fSDimitry Andric SOP2_Real_gfx10<op>, SOP2_Real_gfx11_gfx12<op>; 235781ad6265SDimitry Andric 23580b57cec5SDimitry Andricdefm S_LSHL1_ADD_U32 : SOP2_Real_gfx10<0x02e>; 23590b57cec5SDimitry Andricdefm S_LSHL2_ADD_U32 : SOP2_Real_gfx10<0x02f>; 23600b57cec5SDimitry Andricdefm S_LSHL3_ADD_U32 : SOP2_Real_gfx10<0x030>; 23610b57cec5SDimitry Andricdefm S_LSHL4_ADD_U32 : SOP2_Real_gfx10<0x031>; 23625f757f3fSDimitry Andricdefm S_PACK_LL_B32_B16 : SOP2_Real_gfx10_gfx11_gfx12<0x032>; 23635f757f3fSDimitry Andricdefm S_PACK_LH_B32_B16 : SOP2_Real_gfx10_gfx11_gfx12<0x033>; 23645f757f3fSDimitry Andricdefm S_PACK_HH_B32_B16 : SOP2_Real_gfx10_gfx11_gfx12<0x034>; 23650b57cec5SDimitry Andricdefm S_MUL_HI_U32 : SOP2_Real_gfx10<0x035>; 23660b57cec5SDimitry Andricdefm S_MUL_HI_I32 : SOP2_Real_gfx10<0x036>; 23670b57cec5SDimitry Andric 23680b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 23690b57cec5SDimitry Andric// SOP2 - GFX6, GFX7. 23700b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 23710b57cec5SDimitry Andric 23720b57cec5SDimitry Andricmulticlass SOP2_Real_gfx6_gfx7<bits<7> op> { 2373*0fca6ea1SDimitry Andric defvar ps = !cast<SOP2_Pseudo>(NAME); 23745f757f3fSDimitry Andric def _gfx6_gfx7 : SOP2_Real32<op, ps>, 2375*0fca6ea1SDimitry Andric Select_gfx6_gfx7<ps.PseudoInstr>; 23760b57cec5SDimitry Andric} 23770b57cec5SDimitry Andric 23780b57cec5SDimitry Andricmulticlass SOP2_Real_gfx6_gfx7_gfx10<bits<7> op> : 23790b57cec5SDimitry Andric SOP2_Real_gfx6_gfx7<op>, SOP2_Real_gfx10<op>; 23800b57cec5SDimitry Andric 2381*0fca6ea1SDimitry Andricmulticlass SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<bits<7> op, string gfx12_name> : 2382*0fca6ea1SDimitry Andric SOP2_Real_gfx6_gfx7<op>, SOP2_Real_gfx10<op>, SOP2_Real_gfx11<op>, 2383*0fca6ea1SDimitry Andric SOP2_Real_gfx12<op, gfx12_name>; 238481ad6265SDimitry Andric 23850b57cec5SDimitry Andricdefm S_CBRANCH_G_FORK : SOP2_Real_gfx6_gfx7<0x02b>; 23860b57cec5SDimitry Andric 2387*0fca6ea1SDimitry Andricdefm S_ADD_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x000, "s_add_co_u32">; 2388*0fca6ea1SDimitry Andricdefm S_SUB_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x001, "s_sub_co_u32">; 2389*0fca6ea1SDimitry Andricdefm S_ADD_I32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x002, "s_add_co_i32">; 2390*0fca6ea1SDimitry Andricdefm S_SUB_I32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x003, "s_sub_co_i32">; 2391*0fca6ea1SDimitry Andricdefm S_ADDC_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x004, "s_add_co_ci_u32">; 2392*0fca6ea1SDimitry Andricdefm S_SUBB_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x005, "s_sub_co_ci_u32">; 23930b57cec5SDimitry Andricdefm S_MIN_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x006>; 23940b57cec5SDimitry Andricdefm S_MIN_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x007>; 23950b57cec5SDimitry Andricdefm S_MAX_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x008>; 23960b57cec5SDimitry Andricdefm S_MAX_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x009>; 23970b57cec5SDimitry Andricdefm S_CSELECT_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x00a>; 23980b57cec5SDimitry Andricdefm S_CSELECT_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x00b>; 23990b57cec5SDimitry Andricdefm S_AND_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x00e>; 24000b57cec5SDimitry Andricdefm S_AND_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x00f>; 24010b57cec5SDimitry Andricdefm S_OR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x010>; 24020b57cec5SDimitry Andricdefm S_OR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x011>; 24030b57cec5SDimitry Andricdefm S_XOR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x012>; 24040b57cec5SDimitry Andricdefm S_XOR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x013>; 24050b57cec5SDimitry Andricdefm S_ANDN2_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x014>; 24060b57cec5SDimitry Andricdefm S_ANDN2_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x015>; 24070b57cec5SDimitry Andricdefm S_ORN2_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x016>; 24080b57cec5SDimitry Andricdefm S_ORN2_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x017>; 24090b57cec5SDimitry Andricdefm S_NAND_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x018>; 24100b57cec5SDimitry Andricdefm S_NAND_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x019>; 24110b57cec5SDimitry Andricdefm S_NOR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x01a>; 24120b57cec5SDimitry Andricdefm S_NOR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x01b>; 24130b57cec5SDimitry Andricdefm S_XNOR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x01c>; 24140b57cec5SDimitry Andricdefm S_XNOR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x01d>; 24150b57cec5SDimitry Andricdefm S_LSHL_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x01e>; 24160b57cec5SDimitry Andricdefm S_LSHL_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x01f>; 24170b57cec5SDimitry Andricdefm S_LSHR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x020>; 24180b57cec5SDimitry Andricdefm S_LSHR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x021>; 24190b57cec5SDimitry Andricdefm S_ASHR_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x022>; 24200b57cec5SDimitry Andricdefm S_ASHR_I64 : SOP2_Real_gfx6_gfx7_gfx10<0x023>; 24210b57cec5SDimitry Andricdefm S_BFM_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x024>; 24220b57cec5SDimitry Andricdefm S_BFM_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x025>; 24230b57cec5SDimitry Andricdefm S_MUL_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x026>; 24240b57cec5SDimitry Andricdefm S_BFE_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x027>; 24250b57cec5SDimitry Andricdefm S_BFE_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x028>; 24260b57cec5SDimitry Andricdefm S_BFE_U64 : SOP2_Real_gfx6_gfx7_gfx10<0x029>; 24270b57cec5SDimitry Andricdefm S_BFE_I64 : SOP2_Real_gfx6_gfx7_gfx10<0x02a>; 24280b57cec5SDimitry Andricdefm S_ABSDIFF_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x02c>; 24290b57cec5SDimitry Andric 24300b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 24315f757f3fSDimitry Andric// SOPK - GFX11, GFX12. 243281ad6265SDimitry Andric//===----------------------------------------------------------------------===// 243381ad6265SDimitry Andric 2434*0fca6ea1SDimitry Andricmulticlass SOPK_Real32_gfx12<bits<5> op, string name = !tolower(NAME)> { 2435*0fca6ea1SDimitry Andric defvar ps = !cast<SOPK_Pseudo>(NAME); 2436*0fca6ea1SDimitry Andric def _gfx12 : SOPK_Real32<op, ps, name>, 2437*0fca6ea1SDimitry Andric Select<GFX12Gen, ps.PseudoInstr>; 2438*0fca6ea1SDimitry Andric if !ne(ps.Mnemonic, name) then 2439*0fca6ea1SDimitry Andric def : AMDGPUMnemonicAlias<ps.Mnemonic, name> { 2440*0fca6ea1SDimitry Andric let AssemblerPredicate = isGFX12Plus; 24415f757f3fSDimitry Andric } 24425f757f3fSDimitry Andric} 24435f757f3fSDimitry Andric 244481ad6265SDimitry Andricmulticlass SOPK_Real32_gfx11<bits<5> op> { 244581ad6265SDimitry Andric def _gfx11 : SOPK_Real32<op, !cast<SOPK_Pseudo>(NAME)>, 2446*0fca6ea1SDimitry Andric Select<GFX11Gen, !cast<SOPK_Pseudo>(NAME).PseudoInstr>; 244781ad6265SDimitry Andric} 244881ad6265SDimitry Andric 24495f757f3fSDimitry Andricmulticlass SOPK_Real64_gfx12<bits<5> op> { 24505f757f3fSDimitry Andric def _gfx12 : SOPK_Real64<op, !cast<SOPK_Pseudo>(NAME)>, 2451*0fca6ea1SDimitry Andric Select<GFX12Gen, !cast<SOPK_Pseudo>(NAME).PseudoInstr>; 24525f757f3fSDimitry Andric} 24535f757f3fSDimitry Andric 245481ad6265SDimitry Andricmulticlass SOPK_Real64_gfx11<bits<5> op> { 245581ad6265SDimitry Andric def _gfx11 : SOPK_Real64<op, !cast<SOPK_Pseudo>(NAME)>, 2456*0fca6ea1SDimitry Andric Select<GFX11Gen, !cast<SOPK_Pseudo>(NAME).PseudoInstr>; 245781ad6265SDimitry Andric} 245881ad6265SDimitry Andric 24595f757f3fSDimitry Andricmulticlass SOPK_Real32_gfx11_gfx12<bits<5> op> : 24605f757f3fSDimitry Andric SOPK_Real32_gfx11<op>, SOPK_Real32_gfx12<op>; 24615f757f3fSDimitry Andric 24625f757f3fSDimitry Andricmulticlass SOPK_Real64_gfx11_gfx12<bits<5> op> : 24635f757f3fSDimitry Andric SOPK_Real64_gfx11<op>, SOPK_Real64_gfx12<op>; 24645f757f3fSDimitry Andric 24655f757f3fSDimitry Andricdefm S_GETREG_B32 : SOPK_Real32_gfx11_gfx12<0x011>; 24665f757f3fSDimitry Andricdefm S_SETREG_B32 : SOPK_Real32_gfx11_gfx12<0x012>; 24675f757f3fSDimitry Andricdefm S_SETREG_IMM32_B32 : SOPK_Real64_gfx11_gfx12<0x013>; 24685f757f3fSDimitry Andricdefm S_CALL_B64 : SOPK_Real32_gfx11_gfx12<0x014>; 246981ad6265SDimitry Andricdefm S_SUBVECTOR_LOOP_BEGIN : SOPK_Real32_gfx11<0x016>; 247081ad6265SDimitry Andricdefm S_SUBVECTOR_LOOP_END : SOPK_Real32_gfx11<0x017>; 24711db9f3b2SDimitry Andricdefm S_WAITCNT_VSCNT : SOPK_Real32_gfx11<0x018>; 24721db9f3b2SDimitry Andricdefm S_WAITCNT_VMCNT : SOPK_Real32_gfx11<0x019>; 24731db9f3b2SDimitry Andricdefm S_WAITCNT_EXPCNT : SOPK_Real32_gfx11<0x01a>; 24741db9f3b2SDimitry Andricdefm S_WAITCNT_LGKMCNT : SOPK_Real32_gfx11<0x01b>; 247581ad6265SDimitry Andric 247681ad6265SDimitry Andric//===----------------------------------------------------------------------===// 24770b57cec5SDimitry Andric// SOPK - GFX10. 24780b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 24790b57cec5SDimitry Andric 24800b57cec5SDimitry Andricmulticlass SOPK_Real32_gfx10<bits<5> op> { 2481fe6060f1SDimitry Andric defvar ps = !cast<SOPK_Pseudo>(NAME); 2482fe6060f1SDimitry Andric def _gfx10 : SOPK_Real32<op, ps>, 2483*0fca6ea1SDimitry Andric Select<GFX10Gen, ps.PseudoInstr>; 24840b57cec5SDimitry Andric} 24850b57cec5SDimitry Andric 24860b57cec5SDimitry Andricmulticlass SOPK_Real64_gfx10<bits<5> op> { 2487fe6060f1SDimitry Andric defvar ps = !cast<SOPK_Pseudo>(NAME); 2488fe6060f1SDimitry Andric def _gfx10 : SOPK_Real64<op, ps>, 2489*0fca6ea1SDimitry Andric Select<GFX10Gen, ps.PseudoInstr>; 24900b57cec5SDimitry Andric} 24910b57cec5SDimitry Andric 249281ad6265SDimitry Andricmulticlass SOPK_Real32_gfx10_gfx11<bits<5> op> : 249381ad6265SDimitry Andric SOPK_Real32_gfx10<op>, SOPK_Real32_gfx11<op>; 249481ad6265SDimitry Andric 24955f757f3fSDimitry Andricmulticlass SOPK_Real32_gfx10_gfx11_gfx12<bits<5> op> : 24965f757f3fSDimitry Andric SOPK_Real32_gfx10<op>, SOPK_Real32_gfx11_gfx12<op>; 24975f757f3fSDimitry Andric 24985f757f3fSDimitry Andricdefm S_VERSION : SOPK_Real32_gfx10_gfx11_gfx12<0x001>; 24990b57cec5SDimitry Andricdefm S_CALL_B64 : SOPK_Real32_gfx10<0x016>; 25000b57cec5SDimitry Andricdefm S_WAITCNT_VSCNT : SOPK_Real32_gfx10<0x017>; 25010b57cec5SDimitry Andricdefm S_WAITCNT_VMCNT : SOPK_Real32_gfx10<0x018>; 25020b57cec5SDimitry Andricdefm S_WAITCNT_EXPCNT : SOPK_Real32_gfx10<0x019>; 25030b57cec5SDimitry Andricdefm S_WAITCNT_LGKMCNT : SOPK_Real32_gfx10<0x01a>; 25040b57cec5SDimitry Andricdefm S_SUBVECTOR_LOOP_BEGIN : SOPK_Real32_gfx10<0x01b>; 25050b57cec5SDimitry Andricdefm S_SUBVECTOR_LOOP_END : SOPK_Real32_gfx10<0x01c>; 25060b57cec5SDimitry Andric 25070b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 25080b57cec5SDimitry Andric// SOPK - GFX6, GFX7. 25090b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 25100b57cec5SDimitry Andric 25110b57cec5SDimitry Andricmulticlass SOPK_Real32_gfx6_gfx7<bits<5> op> { 2512fe6060f1SDimitry Andric defvar ps = !cast<SOPK_Pseudo>(NAME); 2513fe6060f1SDimitry Andric def _gfx6_gfx7 : SOPK_Real32<op, ps>, 2514*0fca6ea1SDimitry Andric Select_gfx6_gfx7<ps.PseudoInstr>; 25150b57cec5SDimitry Andric} 25160b57cec5SDimitry Andric 25170b57cec5SDimitry Andricmulticlass SOPK_Real64_gfx6_gfx7<bits<5> op> { 2518fe6060f1SDimitry Andric defvar ps = !cast<SOPK_Pseudo>(NAME); 2519fe6060f1SDimitry Andric def _gfx6_gfx7 : SOPK_Real64<op, ps>, 2520*0fca6ea1SDimitry Andric Select_gfx6_gfx7<ps.PseudoInstr>; 25210b57cec5SDimitry Andric} 25220b57cec5SDimitry Andric 25230b57cec5SDimitry Andricmulticlass SOPK_Real32_gfx6_gfx7_gfx10<bits<5> op> : 25240b57cec5SDimitry Andric SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10<op>; 25250b57cec5SDimitry Andric 25260b57cec5SDimitry Andricmulticlass SOPK_Real64_gfx6_gfx7_gfx10<bits<5> op> : 25270b57cec5SDimitry Andric SOPK_Real64_gfx6_gfx7<op>, SOPK_Real64_gfx10<op>; 25280b57cec5SDimitry Andric 252981ad6265SDimitry Andricmulticlass SOPK_Real32_gfx6_gfx7_gfx10_gfx11<bits<5> op> : 253081ad6265SDimitry Andric SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10_gfx11<op>; 253181ad6265SDimitry Andric 25325f757f3fSDimitry Andricmulticlass SOPK_Real32_gfx6_gfx7_gfx10_gfx11_gfx12<bits<5> op> : 25335f757f3fSDimitry Andric SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10_gfx11_gfx12<op>; 25345f757f3fSDimitry Andric 2535*0fca6ea1SDimitry Andricmulticlass SOPK_Real32_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<bits<5> op, string gfx12_name> : 2536*0fca6ea1SDimitry Andric SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10<op>, SOPK_Real32_gfx11<op>, 2537*0fca6ea1SDimitry Andric SOPK_Real32_gfx12<op, gfx12_name>; 2538*0fca6ea1SDimitry Andric 25390b57cec5SDimitry Andricdefm S_CBRANCH_I_FORK : SOPK_Real32_gfx6_gfx7<0x011>; 25400b57cec5SDimitry Andric 25415f757f3fSDimitry Andricdefm S_MOVK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11_gfx12<0x000>; 25425f757f3fSDimitry Andricdefm S_CMOVK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11_gfx12<0x002>; 254381ad6265SDimitry Andricdefm S_CMPK_EQ_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x003>; 254481ad6265SDimitry Andricdefm S_CMPK_LG_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x004>; 254581ad6265SDimitry Andricdefm S_CMPK_GT_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x005>; 254681ad6265SDimitry Andricdefm S_CMPK_GE_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x006>; 254781ad6265SDimitry Andricdefm S_CMPK_LT_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x007>; 254881ad6265SDimitry Andricdefm S_CMPK_LE_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x008>; 254981ad6265SDimitry Andricdefm S_CMPK_EQ_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x009>; 255081ad6265SDimitry Andricdefm S_CMPK_LG_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00a>; 255181ad6265SDimitry Andricdefm S_CMPK_GT_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00b>; 255281ad6265SDimitry Andricdefm S_CMPK_GE_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00c>; 255381ad6265SDimitry Andricdefm S_CMPK_LT_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00d>; 255481ad6265SDimitry Andricdefm S_CMPK_LE_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00e>; 2555*0fca6ea1SDimitry Andricdefm S_ADDK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11_Renamed_gfx12<0x00f, "s_addk_co_i32">; 25565f757f3fSDimitry Andricdefm S_MULK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11_gfx12<0x010>; 25570b57cec5SDimitry Andricdefm S_GETREG_B32 : SOPK_Real32_gfx6_gfx7_gfx10<0x012>; 25580b57cec5SDimitry Andricdefm S_SETREG_B32 : SOPK_Real32_gfx6_gfx7_gfx10<0x013>; 25590b57cec5SDimitry Andricdefm S_SETREG_IMM32_B32 : SOPK_Real64_gfx6_gfx7_gfx10<0x015>; 25600b57cec5SDimitry Andric 25610b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 25625f757f3fSDimitry Andric// SOPP - GFX12 only. 256381ad6265SDimitry Andric//===----------------------------------------------------------------------===// 256481ad6265SDimitry Andric 2565*0fca6ea1SDimitry Andricmulticlass SOPP_Real_32_gfx12<bits<7> op, string name = !tolower(NAME)> { 2566*0fca6ea1SDimitry Andric defvar ps = !cast<SOPP_Pseudo>(NAME); 2567*0fca6ea1SDimitry Andric def _gfx12 : SOPP_Real_32<op, ps, name>, 2568*0fca6ea1SDimitry Andric Select<GFX12Gen, ps.PseudoInstr>; 2569*0fca6ea1SDimitry Andric if !ne(ps.Mnemonic, name) then 2570*0fca6ea1SDimitry Andric def : AMDGPUMnemonicAlias<ps.Mnemonic, name> { 2571*0fca6ea1SDimitry Andric let AssemblerPredicate = isGFX12Plus; 2572*0fca6ea1SDimitry Andric } 25735f757f3fSDimitry Andric} 25745f757f3fSDimitry Andric 25755f757f3fSDimitry Andricdefm S_BARRIER_WAIT : SOPP_Real_32_gfx12<0x014>; 25765f757f3fSDimitry Andricdefm S_BARRIER_LEAVE : SOPP_Real_32_gfx12<0x015>; 25771db9f3b2SDimitry Andricdefm S_WAIT_LOADCNT : SOPP_Real_32_gfx12<0x040>; 25781db9f3b2SDimitry Andricdefm S_WAIT_STORECNT : SOPP_Real_32_gfx12<0x041>; 25791db9f3b2SDimitry Andricdefm S_WAIT_SAMPLECNT : SOPP_Real_32_gfx12<0x042>; 25801db9f3b2SDimitry Andricdefm S_WAIT_BVHCNT : SOPP_Real_32_gfx12<0x043>; 25811db9f3b2SDimitry Andricdefm S_WAIT_EXPCNT : SOPP_Real_32_gfx12<0x044>; 25821db9f3b2SDimitry Andricdefm S_WAIT_DSCNT : SOPP_Real_32_gfx12<0x046>; 25831db9f3b2SDimitry Andricdefm S_WAIT_KMCNT : SOPP_Real_32_gfx12<0x047>; 25841db9f3b2SDimitry Andricdefm S_WAIT_LOADCNT_DSCNT : SOPP_Real_32_gfx12<0x048>; 25851db9f3b2SDimitry Andricdefm S_WAIT_STORECNT_DSCNT : SOPP_Real_32_gfx12<0x049>; 25865f757f3fSDimitry Andric 25875f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 25885f757f3fSDimitry Andric// SOPP - GFX11, GFX12. 25895f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 25905f757f3fSDimitry Andric 25915f757f3fSDimitry Andric 2592*0fca6ea1SDimitry Andricmulticlass SOPP_Real_32_gfx11<bits<7> op, string name = !tolower(NAME)> { 2593*0fca6ea1SDimitry Andric defvar ps = !cast<SOPP_Pseudo>(NAME); 2594*0fca6ea1SDimitry Andric def _gfx11 : SOPP_Real_32<op, ps, name>, 2595*0fca6ea1SDimitry Andric Select<GFX11Gen, ps.PseudoInstr>, 2596*0fca6ea1SDimitry Andric SOPPRelaxTable<0, ps.KeyName, "_gfx11">; 2597*0fca6ea1SDimitry Andric if !ne(ps.Mnemonic, name) then 2598*0fca6ea1SDimitry Andric def : AMDGPUMnemonicAlias<ps.Mnemonic, name> { 2599*0fca6ea1SDimitry Andric let AssemblerPredicate = isGFX11Only; 2600*0fca6ea1SDimitry Andric } 260181ad6265SDimitry Andric} 260281ad6265SDimitry Andric 26035f757f3fSDimitry Andricmulticlass SOPP_Real_64_gfx12<bits<7> op> { 26045f757f3fSDimitry Andric def _gfx12 : SOPP_Real_64<op, !cast<SOPP_Pseudo>(NAME), !cast<SOPP_Pseudo>(NAME).Mnemonic>, 2605*0fca6ea1SDimitry Andric Select<GFX12Gen, !cast<SOPP_Pseudo>(NAME).PseudoInstr>, 26065f757f3fSDimitry Andric SOPPRelaxTable<1, !cast<SOPP_Pseudo>(NAME).KeyName, "_gfx12">; 26075f757f3fSDimitry Andric} 26085f757f3fSDimitry Andric 2609bdd1243dSDimitry Andricmulticlass SOPP_Real_64_gfx11<bits<7> op> { 2610bdd1243dSDimitry Andric def _gfx11 : SOPP_Real_64<op, !cast<SOPP_Pseudo>(NAME), !cast<SOPP_Pseudo>(NAME).Mnemonic>, 2611*0fca6ea1SDimitry Andric Select<GFX11Gen, !cast<SOPP_Pseudo>(NAME).PseudoInstr>, 261281ad6265SDimitry Andric SOPPRelaxTable<1, !cast<SOPP_Pseudo>(NAME).KeyName, "_gfx11">; 261381ad6265SDimitry Andric} 261481ad6265SDimitry Andric 26155f757f3fSDimitry Andricmulticlass SOPP_Real_32_gfx11_gfx12<bits<7> op> : 26165f757f3fSDimitry Andric SOPP_Real_32_gfx11<op>, SOPP_Real_32_gfx12<op>; 26175f757f3fSDimitry Andric 2618*0fca6ea1SDimitry Andricmulticlass SOPP_Real_32_gfx11_Renamed_gfx12<bits<7> op, string gfx12_name> : 2619*0fca6ea1SDimitry Andric SOPP_Real_32_gfx11<op>, SOPP_Real_32_gfx12<op, gfx12_name>; 26205f757f3fSDimitry Andric 26215f757f3fSDimitry Andricmulticlass SOPP_Real_With_Relaxation_gfx12<bits<7> op> { 26225f757f3fSDimitry Andric defm "" : SOPP_Real_32_gfx12<op>; 2623*0fca6ea1SDimitry Andric let isCodeGenOnly = 1 in 26245f757f3fSDimitry Andric defm _pad_s_nop : SOPP_Real_64_gfx12<op>; 262581ad6265SDimitry Andric} 262681ad6265SDimitry Andric 262781ad6265SDimitry Andricmulticlass SOPP_Real_With_Relaxation_gfx11<bits<7> op> { 262881ad6265SDimitry Andric defm "" : SOPP_Real_32_gfx11<op>; 2629*0fca6ea1SDimitry Andric let isCodeGenOnly = 1 in 263081ad6265SDimitry Andric defm _pad_s_nop : SOPP_Real_64_gfx11<op>; 263181ad6265SDimitry Andric} 263281ad6265SDimitry Andric 26335f757f3fSDimitry Andricmulticlass SOPP_Real_With_Relaxation_gfx11_gfx12<bits<7>op> : 26345f757f3fSDimitry Andric SOPP_Real_With_Relaxation_gfx11<op>, SOPP_Real_With_Relaxation_gfx12<op>; 26355f757f3fSDimitry Andric 26365f757f3fSDimitry Andricdefm S_SETKILL : SOPP_Real_32_gfx11_gfx12<0x001>; 26375f757f3fSDimitry Andricdefm S_SETHALT : SOPP_Real_32_gfx11_gfx12<0x002>; 26385f757f3fSDimitry Andricdefm S_SLEEP : SOPP_Real_32_gfx11_gfx12<0x003>; 2639*0fca6ea1SDimitry Andricdefm S_INST_PREFETCH : SOPP_Real_32_gfx11<0x004, "s_set_inst_prefetch_distance">; 26405f757f3fSDimitry Andricdefm S_CLAUSE : SOPP_Real_32_gfx11_gfx12<0x005>; 26415f757f3fSDimitry Andricdefm S_DELAY_ALU : SOPP_Real_32_gfx11_gfx12<0x007>; 2642*0fca6ea1SDimitry Andricdefm S_WAITCNT_DEPCTR : SOPP_Real_32_gfx11_Renamed_gfx12<0x008, "s_wait_alu">; 26435f757f3fSDimitry Andricdefm S_WAITCNT : SOPP_Real_32_gfx11_gfx12<0x009>; 26445f757f3fSDimitry Andricdefm S_WAIT_IDLE : SOPP_Real_32_gfx11_gfx12<0x00a>; 26455f757f3fSDimitry Andricdefm S_WAIT_EVENT : SOPP_Real_32_gfx11_gfx12<0x00b>; 26465f757f3fSDimitry Andricdefm S_TRAP : SOPP_Real_32_gfx11_gfx12<0x010>; 26475f757f3fSDimitry Andricdefm S_ROUND_MODE : SOPP_Real_32_gfx11_gfx12<0x011>; 26485f757f3fSDimitry Andricdefm S_DENORM_MODE : SOPP_Real_32_gfx11_gfx12<0x012>; 26495f757f3fSDimitry Andricdefm S_BRANCH : SOPP_Real_With_Relaxation_gfx11_gfx12<0x020>; 26505f757f3fSDimitry Andricdefm S_CBRANCH_SCC0 : SOPP_Real_With_Relaxation_gfx11_gfx12<0x021>; 26515f757f3fSDimitry Andricdefm S_CBRANCH_SCC1 : SOPP_Real_With_Relaxation_gfx11_gfx12<0x022>; 26525f757f3fSDimitry Andricdefm S_CBRANCH_VCCZ : SOPP_Real_With_Relaxation_gfx11_gfx12<0x023>; 26535f757f3fSDimitry Andricdefm S_CBRANCH_VCCNZ : SOPP_Real_With_Relaxation_gfx11_gfx12<0x024>; 26545f757f3fSDimitry Andricdefm S_CBRANCH_EXECZ : SOPP_Real_With_Relaxation_gfx11_gfx12<0x025>; 26555f757f3fSDimitry Andricdefm S_CBRANCH_EXECNZ : SOPP_Real_With_Relaxation_gfx11_gfx12<0x026>; 265681ad6265SDimitry Andricdefm S_CBRANCH_CDBGSYS : SOPP_Real_With_Relaxation_gfx11<0x027>; 265781ad6265SDimitry Andricdefm S_CBRANCH_CDBGUSER : SOPP_Real_With_Relaxation_gfx11<0x028>; 265881ad6265SDimitry Andricdefm S_CBRANCH_CDBGSYS_OR_USER : SOPP_Real_With_Relaxation_gfx11<0x029>; 265981ad6265SDimitry Andricdefm S_CBRANCH_CDBGSYS_AND_USER : SOPP_Real_With_Relaxation_gfx11<0x02a>; 26605f757f3fSDimitry Andricdefm S_ENDPGM : SOPP_Real_32_gfx11_gfx12<0x030>; 26615f757f3fSDimitry Andricdefm S_ENDPGM_SAVED : SOPP_Real_32_gfx11_gfx12<0x031>; 26625f757f3fSDimitry Andricdefm S_WAKEUP : SOPP_Real_32_gfx11_gfx12<0x034>; 26635f757f3fSDimitry Andricdefm S_SETPRIO : SOPP_Real_32_gfx11_gfx12<0x035>; 26645f757f3fSDimitry Andricdefm S_SENDMSG : SOPP_Real_32_gfx11_gfx12<0x036>; 26655f757f3fSDimitry Andricdefm S_SENDMSGHALT : SOPP_Real_32_gfx11_gfx12<0x037>; 26665f757f3fSDimitry Andricdefm S_INCPERFLEVEL : SOPP_Real_32_gfx11_gfx12<0x038>; 26675f757f3fSDimitry Andricdefm S_DECPERFLEVEL : SOPP_Real_32_gfx11_gfx12<0x039>; 26685f757f3fSDimitry Andricdefm S_TTRACEDATA : SOPP_Real_32_gfx11_gfx12<0x03a>; 26695f757f3fSDimitry Andricdefm S_TTRACEDATA_IMM : SOPP_Real_32_gfx11_gfx12<0x03b>; 26705f757f3fSDimitry Andricdefm S_ICACHE_INV : SOPP_Real_32_gfx11_gfx12<0x03c>; 2671*0fca6ea1SDimitry Andric 2672*0fca6ea1SDimitry Andricdefm S_BARRIER : SOPP_Real_32_gfx11<0x03d>; 26735f757f3fSDimitry Andric 26745f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 26755f757f3fSDimitry Andric// SOPP - GFX1150, GFX12. 26765f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 26775f757f3fSDimitry Andric 26785f757f3fSDimitry Andricdefm S_SINGLEUSE_VDST : SOPP_Real_32_gfx11_gfx12<0x013>; 267981ad6265SDimitry Andric 268081ad6265SDimitry Andric//===----------------------------------------------------------------------===// 2681e8d8bef9SDimitry Andric// SOPP - GFX6, GFX7, GFX8, GFX9, GFX10 26820b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 26830b57cec5SDimitry Andric 2684bdd1243dSDimitry Andricmulticlass SOPP_Real_32_gfx6_gfx7<bits<7> op> { 2685fe6060f1SDimitry Andric defvar ps = !cast<SOPP_Pseudo>(NAME); 2686bdd1243dSDimitry Andric def _gfx6_gfx7 : SOPP_Real_32<op, ps, !cast<SOPP_Pseudo>(NAME).Mnemonic>, 2687*0fca6ea1SDimitry Andric Select_gfx6_gfx7<ps.PseudoInstr>, 2688fe6060f1SDimitry Andric SOPPRelaxTable<0, ps.KeyName, "_gfx6_gfx7">; 26890b57cec5SDimitry Andric} 26900b57cec5SDimitry Andric 2691bdd1243dSDimitry Andricmulticlass SOPP_Real_32_gfx8_gfx9<bits<7> op> { 2692fe6060f1SDimitry Andric defvar ps = !cast<SOPP_Pseudo>(NAME); 2693bdd1243dSDimitry Andric def _vi : SOPP_Real_32<op, ps>, 2694*0fca6ea1SDimitry Andric Select_vi<ps.PseudoInstr>, 2695fe6060f1SDimitry Andric SOPPRelaxTable<0, ps.KeyName, "_vi">; 2696e8d8bef9SDimitry Andric} 2697e8d8bef9SDimitry Andric 2698bdd1243dSDimitry Andricmulticlass SOPP_Real_32_gfx10<bits<7> op> { 2699fe6060f1SDimitry Andric defvar ps = !cast<SOPP_Pseudo>(NAME); 2700bdd1243dSDimitry Andric def _gfx10 : SOPP_Real_32<op, ps>, 2701*0fca6ea1SDimitry Andric Select<GFX10Gen, ps.PseudoInstr>, 2702fe6060f1SDimitry Andric SOPPRelaxTable<0, ps.KeyName, "_gfx10">; 2703e8d8bef9SDimitry Andric} 2704e8d8bef9SDimitry Andric 2705bdd1243dSDimitry Andricmulticlass SOPP_Real_32_gfx8_gfx9_gfx10<bits<7> op> : 2706bdd1243dSDimitry Andric SOPP_Real_32_gfx8_gfx9<op>, SOPP_Real_32_gfx10<op>; 2707e8d8bef9SDimitry Andric 2708bdd1243dSDimitry Andricmulticlass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9<bits<7> op> : 2709bdd1243dSDimitry Andric SOPP_Real_32_gfx6_gfx7<op>, SOPP_Real_32_gfx8_gfx9<op>; 2710e8d8bef9SDimitry Andric 2711bdd1243dSDimitry Andricmulticlass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> : 2712bdd1243dSDimitry Andric SOPP_Real_32_gfx6_gfx7_gfx8_gfx9<op>, SOPP_Real_32_gfx10<op>; 2713e8d8bef9SDimitry Andric 27145f757f3fSDimitry Andricmulticlass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<bits<7> op> : 27155f757f3fSDimitry Andric SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<op>, SOPP_Real_32_gfx11_gfx12<op>; 271681ad6265SDimitry Andric 27175f757f3fSDimitry Andricmulticlass SOPP_Real_32_gfx10_gfx11_gfx12<bits<7> op> : 27185f757f3fSDimitry Andric SOPP_Real_32_gfx10<op>, SOPP_Real_32_gfx11_gfx12<op>; 271981ad6265SDimitry Andric 2720e8d8bef9SDimitry Andric//64 bit encodings, for Relaxation 2721bdd1243dSDimitry Andricmulticlass SOPP_Real_64_gfx6_gfx7<bits<7> op> { 2722fe6060f1SDimitry Andric defvar ps = !cast<SOPP_Pseudo>(NAME); 2723bdd1243dSDimitry Andric def _gfx6_gfx7 : SOPP_Real_64<op, ps>, 2724*0fca6ea1SDimitry Andric Select_gfx6_gfx7<ps.PseudoInstr>, 2725fe6060f1SDimitry Andric SOPPRelaxTable<1, ps.KeyName, "_gfx6_gfx7">; 2726e8d8bef9SDimitry Andric} 2727e8d8bef9SDimitry Andric 2728bdd1243dSDimitry Andricmulticlass SOPP_Real_64_gfx8_gfx9<bits<7> op> { 2729fe6060f1SDimitry Andric defvar ps = !cast<SOPP_Pseudo>(NAME); 2730bdd1243dSDimitry Andric def _vi : SOPP_Real_64<op, ps>, 2731*0fca6ea1SDimitry Andric Select_vi<ps.PseudoInstr>, 2732fe6060f1SDimitry Andric SOPPRelaxTable<1, ps.KeyName, "_vi">; 2733e8d8bef9SDimitry Andric} 2734e8d8bef9SDimitry Andric 2735bdd1243dSDimitry Andricmulticlass SOPP_Real_64_gfx10<bits<7> op> { 2736fe6060f1SDimitry Andric defvar ps = !cast<SOPP_Pseudo>(NAME); 2737bdd1243dSDimitry Andric def _gfx10 : SOPP_Real_64<op, ps>, 2738*0fca6ea1SDimitry Andric Select<GFX10Gen, ps.PseudoInstr>, 2739fe6060f1SDimitry Andric SOPPRelaxTable<1, ps.KeyName, "_gfx10">; 2740e8d8bef9SDimitry Andric} 2741e8d8bef9SDimitry Andric 2742bdd1243dSDimitry Andricmulticlass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9<bits<7> op> : 2743bdd1243dSDimitry Andric SOPP_Real_64_gfx6_gfx7<op>, SOPP_Real_64_gfx8_gfx9<op>; 2744e8d8bef9SDimitry Andric 2745bdd1243dSDimitry Andricmulticlass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> : 2746bdd1243dSDimitry Andric SOPP_Real_64_gfx6_gfx7_gfx8_gfx9<op>, SOPP_Real_64_gfx10<op>; 2747e8d8bef9SDimitry Andric 2748e8d8bef9SDimitry Andric//relaxation for insts with no operands not implemented 2749e8d8bef9SDimitry Andricmulticlass SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> { 2750e8d8bef9SDimitry Andric defm "" : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<op>; 2751*0fca6ea1SDimitry Andric let isCodeGenOnly = 1 in 2752e8d8bef9SDimitry Andric defm _pad_s_nop : SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10<op>; 2753e8d8bef9SDimitry Andric} 2754e8d8bef9SDimitry Andric 27555f757f3fSDimitry Andricdefm S_NOP : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x000>; 2756bdd1243dSDimitry Andricdefm S_ENDPGM : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x001>; 2757e8d8bef9SDimitry Andricdefm S_WAKEUP : SOPP_Real_32_gfx8_gfx9_gfx10<0x003>; 2758e8d8bef9SDimitry Andricdefm S_BARRIER : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00a>; 2759e8d8bef9SDimitry Andricdefm S_WAITCNT : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00c>; 2760e8d8bef9SDimitry Andricdefm S_SETHALT : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00d>; 2761e8d8bef9SDimitry Andricdefm S_SETKILL : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00b>; 2762e8d8bef9SDimitry Andricdefm S_SLEEP : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00e>; 2763e8d8bef9SDimitry Andricdefm S_SETPRIO : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00f>; 2764e8d8bef9SDimitry Andricdefm S_SENDMSG : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x010>; 2765e8d8bef9SDimitry Andricdefm S_SENDMSGHALT : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x011>; 2766e8d8bef9SDimitry Andricdefm S_TRAP : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x012>; 2767e8d8bef9SDimitry Andricdefm S_ICACHE_INV : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x013>; 2768e8d8bef9SDimitry Andricdefm S_INCPERFLEVEL : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x014>; 2769e8d8bef9SDimitry Andricdefm S_DECPERFLEVEL : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x015>; 2770e8d8bef9SDimitry Andricdefm S_TTRACEDATA : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x016>; 2771e8d8bef9SDimitry Andricdefm S_ENDPGM_SAVED : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x01B>; 2772e8d8bef9SDimitry Andricdefm S_SET_GPR_IDX_OFF : SOPP_Real_32_gfx8_gfx9<0x01c>; 2773e8d8bef9SDimitry Andricdefm S_SET_GPR_IDX_MODE : SOPP_Real_32_gfx8_gfx9<0x01d>; 2774e8d8bef9SDimitry Andricdefm S_ENDPGM_ORDERED_PS_DONE : SOPP_Real_32_gfx8_gfx9_gfx10<0x01e>; 27755f757f3fSDimitry Andricdefm S_CODE_END : SOPP_Real_32_gfx10_gfx11_gfx12<0x01f>; 2776e8d8bef9SDimitry Andricdefm S_INST_PREFETCH : SOPP_Real_32_gfx10<0x020>; 2777e8d8bef9SDimitry Andricdefm S_CLAUSE : SOPP_Real_32_gfx10<0x021>; 2778e8d8bef9SDimitry Andricdefm S_WAIT_IDLE : SOPP_Real_32_gfx10<0x022>; 2779e8d8bef9SDimitry Andricdefm S_WAITCNT_DEPCTR : SOPP_Real_32_gfx10<0x023>; 2780e8d8bef9SDimitry Andricdefm S_ROUND_MODE : SOPP_Real_32_gfx10<0x024>; 2781e8d8bef9SDimitry Andricdefm S_DENORM_MODE : SOPP_Real_32_gfx10<0x025>; 2782e8d8bef9SDimitry Andricdefm S_TTRACEDATA_IMM : SOPP_Real_32_gfx10<0x028>; 2783e8d8bef9SDimitry Andric 2784fe6060f1SDimitry Andriclet isBranch = 1 in { 2785fe6060f1SDimitry Andricdefm S_BRANCH : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x002>; 2786fe6060f1SDimitry Andricdefm S_CBRANCH_SCC0 : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x004>; 2787fe6060f1SDimitry Andricdefm S_CBRANCH_SCC1 : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x005>; 2788fe6060f1SDimitry Andricdefm S_CBRANCH_VCCZ : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x006>; 2789fe6060f1SDimitry Andricdefm S_CBRANCH_VCCNZ : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x007>; 2790fe6060f1SDimitry Andricdefm S_CBRANCH_EXECZ : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x008>; 2791fe6060f1SDimitry Andricdefm S_CBRANCH_EXECNZ : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x009>; 2792fe6060f1SDimitry Andricdefm S_CBRANCH_CDBGSYS : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x017>; 2793fe6060f1SDimitry Andricdefm S_CBRANCH_CDBGUSER : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x018>; 2794fe6060f1SDimitry Andricdefm S_CBRANCH_CDBGSYS_OR_USER : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x019>; 2795fe6060f1SDimitry Andricdefm S_CBRANCH_CDBGSYS_AND_USER : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x01A>; 2796fe6060f1SDimitry Andric} 2797fe6060f1SDimitry Andric 2798e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 27995f757f3fSDimitry Andric// SOPC - GFX11, GFX12. 280081ad6265SDimitry Andric//===----------------------------------------------------------------------===// 280181ad6265SDimitry Andric 28025f757f3fSDimitry Andricmulticlass SOPC_Real_gfx12<bits<7> op> { 28035f757f3fSDimitry Andric def _gfx12 : SOPC_Real<op, !cast<SOPC_Pseudo>(NAME)>, 2804*0fca6ea1SDimitry Andric Select<GFX12Gen, !cast<SOPC_Pseudo>(NAME).PseudoInstr>; 28055f757f3fSDimitry Andric} 28065f757f3fSDimitry Andric 280781ad6265SDimitry Andricmulticlass SOPC_Real_gfx11<bits<7> op> { 280881ad6265SDimitry Andric def _gfx11 : SOPC_Real<op, !cast<SOPC_Pseudo>(NAME)>, 2809*0fca6ea1SDimitry Andric Select<GFX11Gen, !cast<SOPC_Pseudo>(NAME).PseudoInstr>; 281081ad6265SDimitry Andric} 281181ad6265SDimitry Andric 28125f757f3fSDimitry Andricmulticlass SOPC_Real_gfx11_gfx12<bits<7> op> : 28135f757f3fSDimitry Andric SOPC_Real_gfx11<op>, SOPC_Real_gfx12<op>; 28145f757f3fSDimitry Andric 28155f757f3fSDimitry Andricdefm S_CMP_EQ_U64 : SOPC_Real_gfx11_gfx12<0x10>; 28165f757f3fSDimitry Andricdefm S_CMP_LG_U64 : SOPC_Real_gfx11_gfx12<0x11>; 28175f757f3fSDimitry Andric 28185f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 28195f757f3fSDimitry Andric// SOPC - GFX1150, GFX12 28205f757f3fSDimitry Andric//===----------------------------------------------------------------------===// 28215f757f3fSDimitry Andric 28225f757f3fSDimitry Andricdefm S_CMP_LT_F32 : SOPC_Real_gfx11_gfx12<0x41>; 28235f757f3fSDimitry Andricdefm S_CMP_EQ_F32 : SOPC_Real_gfx11_gfx12<0x42>; 28245f757f3fSDimitry Andricdefm S_CMP_LE_F32 : SOPC_Real_gfx11_gfx12<0x43>; 28255f757f3fSDimitry Andricdefm S_CMP_GT_F32 : SOPC_Real_gfx11_gfx12<0x44>; 28265f757f3fSDimitry Andricdefm S_CMP_LG_F32 : SOPC_Real_gfx11_gfx12<0x45>; 28275f757f3fSDimitry Andricdefm S_CMP_GE_F32 : SOPC_Real_gfx11_gfx12<0x46>; 28285f757f3fSDimitry Andricdefm S_CMP_O_F32 : SOPC_Real_gfx11_gfx12<0x47>; 28295f757f3fSDimitry Andricdefm S_CMP_U_F32 : SOPC_Real_gfx11_gfx12<0x48>; 28305f757f3fSDimitry Andricdefm S_CMP_NGE_F32 : SOPC_Real_gfx11_gfx12<0x49>; 28315f757f3fSDimitry Andricdefm S_CMP_NLG_F32 : SOPC_Real_gfx11_gfx12<0x4a>; 28325f757f3fSDimitry Andricdefm S_CMP_NGT_F32 : SOPC_Real_gfx11_gfx12<0x4b>; 28335f757f3fSDimitry Andricdefm S_CMP_NLE_F32 : SOPC_Real_gfx11_gfx12<0x4c>; 28345f757f3fSDimitry Andricdefm S_CMP_NEQ_F32 : SOPC_Real_gfx11_gfx12<0x4d>; 28355f757f3fSDimitry Andricdefm S_CMP_NLT_F32 : SOPC_Real_gfx11_gfx12<0x4e>; 28365f757f3fSDimitry Andric 28375f757f3fSDimitry Andricdefm S_CMP_LT_F16 : SOPC_Real_gfx11_gfx12<0x51>; 28385f757f3fSDimitry Andricdefm S_CMP_EQ_F16 : SOPC_Real_gfx11_gfx12<0x52>; 28395f757f3fSDimitry Andricdefm S_CMP_LE_F16 : SOPC_Real_gfx11_gfx12<0x53>; 28405f757f3fSDimitry Andricdefm S_CMP_GT_F16 : SOPC_Real_gfx11_gfx12<0x54>; 28415f757f3fSDimitry Andricdefm S_CMP_LG_F16 : SOPC_Real_gfx11_gfx12<0x55>; 28425f757f3fSDimitry Andricdefm S_CMP_GE_F16 : SOPC_Real_gfx11_gfx12<0x56>; 28435f757f3fSDimitry Andricdefm S_CMP_O_F16 : SOPC_Real_gfx11_gfx12<0x57>; 28445f757f3fSDimitry Andricdefm S_CMP_U_F16 : SOPC_Real_gfx11_gfx12<0x58>; 28455f757f3fSDimitry Andricdefm S_CMP_NGE_F16 : SOPC_Real_gfx11_gfx12<0x59>; 28465f757f3fSDimitry Andricdefm S_CMP_NLG_F16 : SOPC_Real_gfx11_gfx12<0x5a>; 28475f757f3fSDimitry Andricdefm S_CMP_NGT_F16 : SOPC_Real_gfx11_gfx12<0x5b>; 28485f757f3fSDimitry Andricdefm S_CMP_NLE_F16 : SOPC_Real_gfx11_gfx12<0x5c>; 28495f757f3fSDimitry Andricdefm S_CMP_NEQ_F16 : SOPC_Real_gfx11_gfx12<0x5d>; 28505f757f3fSDimitry Andricdefm S_CMP_NLT_F16 : SOPC_Real_gfx11_gfx12<0x5e>; 285181ad6265SDimitry Andric 285281ad6265SDimitry Andric//===----------------------------------------------------------------------===// 2853e8d8bef9SDimitry Andric// SOPC - GFX6, GFX7, GFX8, GFX9, GFX10 2854e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 2855e8d8bef9SDimitry Andric 2856e8d8bef9SDimitry Andricmulticlass SOPC_Real_gfx6_gfx7<bits<7> op> { 2857fe6060f1SDimitry Andric defvar ps = !cast<SOPC_Pseudo>(NAME); 2858fe6060f1SDimitry Andric def _gfx6_gfx7 : SOPC_Real<op, ps>, 2859*0fca6ea1SDimitry Andric Select_gfx6_gfx7<ps.PseudoInstr>; 2860e8d8bef9SDimitry Andric} 2861e8d8bef9SDimitry Andric 2862e8d8bef9SDimitry Andricmulticlass SOPC_Real_gfx8_gfx9<bits<7> op> { 2863fe6060f1SDimitry Andric defvar ps = !cast<SOPC_Pseudo>(NAME); 2864fe6060f1SDimitry Andric def _vi : SOPC_Real<op, ps>, 2865*0fca6ea1SDimitry Andric Select_vi<ps.PseudoInstr>; 2866e8d8bef9SDimitry Andric} 2867e8d8bef9SDimitry Andric 2868e8d8bef9SDimitry Andricmulticlass SOPC_Real_gfx10<bits<7> op> { 2869fe6060f1SDimitry Andric defvar ps = !cast<SOPC_Pseudo>(NAME); 2870fe6060f1SDimitry Andric def _gfx10 : SOPC_Real<op, ps>, 2871*0fca6ea1SDimitry Andric Select<GFX10Gen, ps.PseudoInstr>; 2872e8d8bef9SDimitry Andric} 2873e8d8bef9SDimitry Andric 2874e8d8bef9SDimitry Andricmulticlass SOPC_Real_gfx8_gfx9_gfx10<bits<7> op> : 2875e8d8bef9SDimitry Andric SOPC_Real_gfx8_gfx9<op>, SOPC_Real_gfx10<op>; 2876e8d8bef9SDimitry Andric 2877e8d8bef9SDimitry Andricmulticlass SOPC_Real_gfx6_gfx7_gfx8_gfx9<bits<7> op> : 2878e8d8bef9SDimitry Andric SOPC_Real_gfx6_gfx7<op>, SOPC_Real_gfx8_gfx9<op>; 2879e8d8bef9SDimitry Andric 2880*0fca6ea1SDimitry Andricmulticlass SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<bits<7> op> : 2881*0fca6ea1SDimitry Andric SOPC_Real_gfx6_gfx7_gfx8_gfx9<op>, SOPC_Real_gfx10<op>, SOPC_Real_gfx11<op>, 2882*0fca6ea1SDimitry Andric SOPC_Real_gfx12<op>; 2883e8d8bef9SDimitry Andric 2884*0fca6ea1SDimitry Andricdefm S_CMP_EQ_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x00>; 2885*0fca6ea1SDimitry Andricdefm S_CMP_LG_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x01>; 2886*0fca6ea1SDimitry Andricdefm S_CMP_GT_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x02>; 2887*0fca6ea1SDimitry Andricdefm S_CMP_GE_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x03>; 2888*0fca6ea1SDimitry Andricdefm S_CMP_LT_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x04>; 2889*0fca6ea1SDimitry Andricdefm S_CMP_LE_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x05>; 2890*0fca6ea1SDimitry Andricdefm S_CMP_EQ_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x06>; 2891*0fca6ea1SDimitry Andricdefm S_CMP_LG_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x07>; 2892*0fca6ea1SDimitry Andricdefm S_CMP_GT_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x08>; 2893*0fca6ea1SDimitry Andricdefm S_CMP_GE_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x09>; 2894*0fca6ea1SDimitry Andricdefm S_CMP_LT_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0a>; 2895*0fca6ea1SDimitry Andricdefm S_CMP_LE_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0b>; 2896*0fca6ea1SDimitry Andricdefm S_BITCMP0_B32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0c>; 2897*0fca6ea1SDimitry Andricdefm S_BITCMP1_B32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0d>; 2898*0fca6ea1SDimitry Andricdefm S_BITCMP0_B64 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0e>; 2899*0fca6ea1SDimitry Andricdefm S_BITCMP1_B64 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11_gfx12<0x0f>; 2900e8d8bef9SDimitry Andricdefm S_SETVSKIP : SOPC_Real_gfx6_gfx7_gfx8_gfx9<0x10>; 2901e8d8bef9SDimitry Andricdefm S_SET_GPR_IDX_ON : SOPC_Real_gfx8_gfx9<0x11>; 2902e8d8bef9SDimitry Andricdefm S_CMP_EQ_U64 : SOPC_Real_gfx8_gfx9_gfx10<0x12>; 2903e8d8bef9SDimitry Andricdefm S_CMP_LG_U64 : SOPC_Real_gfx8_gfx9_gfx10<0x13>; 2904e8d8bef9SDimitry Andric 2905e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 2906e8d8bef9SDimitry Andric// GFX8 (VI), GFX9. 2907e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 2908e8d8bef9SDimitry Andric 29090b57cec5SDimitry Andricclass SOP1_Real_vi<bits<8> op, SOP1_Pseudo ps> : 29100b57cec5SDimitry Andric SOP1_Real<op, ps>, 2911*0fca6ea1SDimitry Andric Select_vi<ps.PseudoInstr>; 29120b57cec5SDimitry Andric 29130b57cec5SDimitry Andricclass SOP2_Real_vi<bits<7> op, SOP2_Pseudo ps> : 29145f757f3fSDimitry Andric SOP2_Real32<op, ps>, 2915*0fca6ea1SDimitry Andric Select_vi<ps.PseudoInstr>; 29160b57cec5SDimitry Andric 29170b57cec5SDimitry Andricclass SOPK_Real_vi<bits<5> op, SOPK_Pseudo ps> : 29180b57cec5SDimitry Andric SOPK_Real32<op, ps>, 2919*0fca6ea1SDimitry Andric Select_vi<ps.PseudoInstr>; 29200b57cec5SDimitry Andric 29210b57cec5SDimitry Andricdef S_MOV_B32_vi : SOP1_Real_vi <0x00, S_MOV_B32>; 29220b57cec5SDimitry Andricdef S_MOV_B64_vi : SOP1_Real_vi <0x01, S_MOV_B64>; 29230b57cec5SDimitry Andricdef S_CMOV_B32_vi : SOP1_Real_vi <0x02, S_CMOV_B32>; 29240b57cec5SDimitry Andricdef S_CMOV_B64_vi : SOP1_Real_vi <0x03, S_CMOV_B64>; 29250b57cec5SDimitry Andricdef S_NOT_B32_vi : SOP1_Real_vi <0x04, S_NOT_B32>; 29260b57cec5SDimitry Andricdef S_NOT_B64_vi : SOP1_Real_vi <0x05, S_NOT_B64>; 29270b57cec5SDimitry Andricdef S_WQM_B32_vi : SOP1_Real_vi <0x06, S_WQM_B32>; 29280b57cec5SDimitry Andricdef S_WQM_B64_vi : SOP1_Real_vi <0x07, S_WQM_B64>; 29290b57cec5SDimitry Andricdef S_BREV_B32_vi : SOP1_Real_vi <0x08, S_BREV_B32>; 29300b57cec5SDimitry Andricdef S_BREV_B64_vi : SOP1_Real_vi <0x09, S_BREV_B64>; 29310b57cec5SDimitry Andricdef S_BCNT0_I32_B32_vi : SOP1_Real_vi <0x0a, S_BCNT0_I32_B32>; 29320b57cec5SDimitry Andricdef S_BCNT0_I32_B64_vi : SOP1_Real_vi <0x0b, S_BCNT0_I32_B64>; 29330b57cec5SDimitry Andricdef S_BCNT1_I32_B32_vi : SOP1_Real_vi <0x0c, S_BCNT1_I32_B32>; 29340b57cec5SDimitry Andricdef S_BCNT1_I32_B64_vi : SOP1_Real_vi <0x0d, S_BCNT1_I32_B64>; 29350b57cec5SDimitry Andricdef S_FF0_I32_B32_vi : SOP1_Real_vi <0x0e, S_FF0_I32_B32>; 29360b57cec5SDimitry Andricdef S_FF0_I32_B64_vi : SOP1_Real_vi <0x0f, S_FF0_I32_B64>; 29370b57cec5SDimitry Andricdef S_FF1_I32_B32_vi : SOP1_Real_vi <0x10, S_FF1_I32_B32>; 29380b57cec5SDimitry Andricdef S_FF1_I32_B64_vi : SOP1_Real_vi <0x11, S_FF1_I32_B64>; 29390b57cec5SDimitry Andricdef S_FLBIT_I32_B32_vi : SOP1_Real_vi <0x12, S_FLBIT_I32_B32>; 29400b57cec5SDimitry Andricdef S_FLBIT_I32_B64_vi : SOP1_Real_vi <0x13, S_FLBIT_I32_B64>; 29410b57cec5SDimitry Andricdef S_FLBIT_I32_vi : SOP1_Real_vi <0x14, S_FLBIT_I32>; 29420b57cec5SDimitry Andricdef S_FLBIT_I32_I64_vi : SOP1_Real_vi <0x15, S_FLBIT_I32_I64>; 29430b57cec5SDimitry Andricdef S_SEXT_I32_I8_vi : SOP1_Real_vi <0x16, S_SEXT_I32_I8>; 29440b57cec5SDimitry Andricdef S_SEXT_I32_I16_vi : SOP1_Real_vi <0x17, S_SEXT_I32_I16>; 29450b57cec5SDimitry Andricdef S_BITSET0_B32_vi : SOP1_Real_vi <0x18, S_BITSET0_B32>; 29460b57cec5SDimitry Andricdef S_BITSET0_B64_vi : SOP1_Real_vi <0x19, S_BITSET0_B64>; 29470b57cec5SDimitry Andricdef S_BITSET1_B32_vi : SOP1_Real_vi <0x1a, S_BITSET1_B32>; 29480b57cec5SDimitry Andricdef S_BITSET1_B64_vi : SOP1_Real_vi <0x1b, S_BITSET1_B64>; 29490b57cec5SDimitry Andricdef S_GETPC_B64_vi : SOP1_Real_vi <0x1c, S_GETPC_B64>; 29500b57cec5SDimitry Andricdef S_SETPC_B64_vi : SOP1_Real_vi <0x1d, S_SETPC_B64>; 29510b57cec5SDimitry Andricdef S_SWAPPC_B64_vi : SOP1_Real_vi <0x1e, S_SWAPPC_B64>; 29520b57cec5SDimitry Andricdef S_RFE_B64_vi : SOP1_Real_vi <0x1f, S_RFE_B64>; 29530b57cec5SDimitry Andricdef S_AND_SAVEEXEC_B64_vi : SOP1_Real_vi <0x20, S_AND_SAVEEXEC_B64>; 29540b57cec5SDimitry Andricdef S_OR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x21, S_OR_SAVEEXEC_B64>; 29550b57cec5SDimitry Andricdef S_XOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x22, S_XOR_SAVEEXEC_B64>; 29560b57cec5SDimitry Andricdef S_ANDN2_SAVEEXEC_B64_vi: SOP1_Real_vi <0x23, S_ANDN2_SAVEEXEC_B64>; 29570b57cec5SDimitry Andricdef S_ORN2_SAVEEXEC_B64_vi : SOP1_Real_vi <0x24, S_ORN2_SAVEEXEC_B64>; 29580b57cec5SDimitry Andricdef S_NAND_SAVEEXEC_B64_vi : SOP1_Real_vi <0x25, S_NAND_SAVEEXEC_B64>; 29590b57cec5SDimitry Andricdef S_NOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x26, S_NOR_SAVEEXEC_B64>; 29600b57cec5SDimitry Andricdef S_XNOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x27, S_XNOR_SAVEEXEC_B64>; 29610b57cec5SDimitry Andricdef S_QUADMASK_B32_vi : SOP1_Real_vi <0x28, S_QUADMASK_B32>; 29620b57cec5SDimitry Andricdef S_QUADMASK_B64_vi : SOP1_Real_vi <0x29, S_QUADMASK_B64>; 29630b57cec5SDimitry Andricdef S_MOVRELS_B32_vi : SOP1_Real_vi <0x2a, S_MOVRELS_B32>; 29640b57cec5SDimitry Andricdef S_MOVRELS_B64_vi : SOP1_Real_vi <0x2b, S_MOVRELS_B64>; 29650b57cec5SDimitry Andricdef S_MOVRELD_B32_vi : SOP1_Real_vi <0x2c, S_MOVRELD_B32>; 29660b57cec5SDimitry Andricdef S_MOVRELD_B64_vi : SOP1_Real_vi <0x2d, S_MOVRELD_B64>; 29670b57cec5SDimitry Andricdef S_CBRANCH_JOIN_vi : SOP1_Real_vi <0x2e, S_CBRANCH_JOIN>; 29680b57cec5SDimitry Andricdef S_ABS_I32_vi : SOP1_Real_vi <0x30, S_ABS_I32>; 29690b57cec5SDimitry Andricdef S_SET_GPR_IDX_IDX_vi : SOP1_Real_vi <0x32, S_SET_GPR_IDX_IDX>; 29700b57cec5SDimitry Andric 29710b57cec5SDimitry Andricdef S_ADD_U32_vi : SOP2_Real_vi <0x00, S_ADD_U32>; 29720b57cec5SDimitry Andricdef S_ADD_I32_vi : SOP2_Real_vi <0x02, S_ADD_I32>; 29730b57cec5SDimitry Andricdef S_SUB_U32_vi : SOP2_Real_vi <0x01, S_SUB_U32>; 29740b57cec5SDimitry Andricdef S_SUB_I32_vi : SOP2_Real_vi <0x03, S_SUB_I32>; 29750b57cec5SDimitry Andricdef S_ADDC_U32_vi : SOP2_Real_vi <0x04, S_ADDC_U32>; 29760b57cec5SDimitry Andricdef S_SUBB_U32_vi : SOP2_Real_vi <0x05, S_SUBB_U32>; 29770b57cec5SDimitry Andricdef S_MIN_I32_vi : SOP2_Real_vi <0x06, S_MIN_I32>; 29780b57cec5SDimitry Andricdef S_MIN_U32_vi : SOP2_Real_vi <0x07, S_MIN_U32>; 29790b57cec5SDimitry Andricdef S_MAX_I32_vi : SOP2_Real_vi <0x08, S_MAX_I32>; 29800b57cec5SDimitry Andricdef S_MAX_U32_vi : SOP2_Real_vi <0x09, S_MAX_U32>; 29810b57cec5SDimitry Andricdef S_CSELECT_B32_vi : SOP2_Real_vi <0x0a, S_CSELECT_B32>; 29820b57cec5SDimitry Andricdef S_CSELECT_B64_vi : SOP2_Real_vi <0x0b, S_CSELECT_B64>; 29830b57cec5SDimitry Andricdef S_AND_B32_vi : SOP2_Real_vi <0x0c, S_AND_B32>; 29840b57cec5SDimitry Andricdef S_AND_B64_vi : SOP2_Real_vi <0x0d, S_AND_B64>; 29850b57cec5SDimitry Andricdef S_OR_B32_vi : SOP2_Real_vi <0x0e, S_OR_B32>; 29860b57cec5SDimitry Andricdef S_OR_B64_vi : SOP2_Real_vi <0x0f, S_OR_B64>; 29870b57cec5SDimitry Andricdef S_XOR_B32_vi : SOP2_Real_vi <0x10, S_XOR_B32>; 29880b57cec5SDimitry Andricdef S_XOR_B64_vi : SOP2_Real_vi <0x11, S_XOR_B64>; 29890b57cec5SDimitry Andricdef S_ANDN2_B32_vi : SOP2_Real_vi <0x12, S_ANDN2_B32>; 29900b57cec5SDimitry Andricdef S_ANDN2_B64_vi : SOP2_Real_vi <0x13, S_ANDN2_B64>; 29910b57cec5SDimitry Andricdef S_ORN2_B32_vi : SOP2_Real_vi <0x14, S_ORN2_B32>; 29920b57cec5SDimitry Andricdef S_ORN2_B64_vi : SOP2_Real_vi <0x15, S_ORN2_B64>; 29930b57cec5SDimitry Andricdef S_NAND_B32_vi : SOP2_Real_vi <0x16, S_NAND_B32>; 29940b57cec5SDimitry Andricdef S_NAND_B64_vi : SOP2_Real_vi <0x17, S_NAND_B64>; 29950b57cec5SDimitry Andricdef S_NOR_B32_vi : SOP2_Real_vi <0x18, S_NOR_B32>; 29960b57cec5SDimitry Andricdef S_NOR_B64_vi : SOP2_Real_vi <0x19, S_NOR_B64>; 29970b57cec5SDimitry Andricdef S_XNOR_B32_vi : SOP2_Real_vi <0x1a, S_XNOR_B32>; 29980b57cec5SDimitry Andricdef S_XNOR_B64_vi : SOP2_Real_vi <0x1b, S_XNOR_B64>; 29990b57cec5SDimitry Andricdef S_LSHL_B32_vi : SOP2_Real_vi <0x1c, S_LSHL_B32>; 30000b57cec5SDimitry Andricdef S_LSHL_B64_vi : SOP2_Real_vi <0x1d, S_LSHL_B64>; 30010b57cec5SDimitry Andricdef S_LSHR_B32_vi : SOP2_Real_vi <0x1e, S_LSHR_B32>; 30020b57cec5SDimitry Andricdef S_LSHR_B64_vi : SOP2_Real_vi <0x1f, S_LSHR_B64>; 30030b57cec5SDimitry Andricdef S_ASHR_I32_vi : SOP2_Real_vi <0x20, S_ASHR_I32>; 30040b57cec5SDimitry Andricdef S_ASHR_I64_vi : SOP2_Real_vi <0x21, S_ASHR_I64>; 30050b57cec5SDimitry Andricdef S_BFM_B32_vi : SOP2_Real_vi <0x22, S_BFM_B32>; 30060b57cec5SDimitry Andricdef S_BFM_B64_vi : SOP2_Real_vi <0x23, S_BFM_B64>; 30070b57cec5SDimitry Andricdef S_MUL_I32_vi : SOP2_Real_vi <0x24, S_MUL_I32>; 30080b57cec5SDimitry Andricdef S_BFE_U32_vi : SOP2_Real_vi <0x25, S_BFE_U32>; 30090b57cec5SDimitry Andricdef S_BFE_I32_vi : SOP2_Real_vi <0x26, S_BFE_I32>; 30100b57cec5SDimitry Andricdef S_BFE_U64_vi : SOP2_Real_vi <0x27, S_BFE_U64>; 30110b57cec5SDimitry Andricdef S_BFE_I64_vi : SOP2_Real_vi <0x28, S_BFE_I64>; 30120b57cec5SDimitry Andricdef S_CBRANCH_G_FORK_vi : SOP2_Real_vi <0x29, S_CBRANCH_G_FORK>; 30130b57cec5SDimitry Andricdef S_ABSDIFF_I32_vi : SOP2_Real_vi <0x2a, S_ABSDIFF_I32>; 30140b57cec5SDimitry Andricdef S_PACK_LL_B32_B16_vi : SOP2_Real_vi <0x32, S_PACK_LL_B32_B16>; 30150b57cec5SDimitry Andricdef S_PACK_LH_B32_B16_vi : SOP2_Real_vi <0x33, S_PACK_LH_B32_B16>; 30160b57cec5SDimitry Andricdef S_PACK_HH_B32_B16_vi : SOP2_Real_vi <0x34, S_PACK_HH_B32_B16>; 30170b57cec5SDimitry Andricdef S_RFE_RESTORE_B64_vi : SOP2_Real_vi <0x2b, S_RFE_RESTORE_B64>; 30180b57cec5SDimitry Andric 30190b57cec5SDimitry Andricdef S_MOVK_I32_vi : SOPK_Real_vi <0x00, S_MOVK_I32>; 30200b57cec5SDimitry Andricdef S_CMOVK_I32_vi : SOPK_Real_vi <0x01, S_CMOVK_I32>; 30210b57cec5SDimitry Andricdef S_CMPK_EQ_I32_vi : SOPK_Real_vi <0x02, S_CMPK_EQ_I32>; 30220b57cec5SDimitry Andricdef S_CMPK_LG_I32_vi : SOPK_Real_vi <0x03, S_CMPK_LG_I32>; 30230b57cec5SDimitry Andricdef S_CMPK_GT_I32_vi : SOPK_Real_vi <0x04, S_CMPK_GT_I32>; 30240b57cec5SDimitry Andricdef S_CMPK_GE_I32_vi : SOPK_Real_vi <0x05, S_CMPK_GE_I32>; 30250b57cec5SDimitry Andricdef S_CMPK_LT_I32_vi : SOPK_Real_vi <0x06, S_CMPK_LT_I32>; 30260b57cec5SDimitry Andricdef S_CMPK_LE_I32_vi : SOPK_Real_vi <0x07, S_CMPK_LE_I32>; 30270b57cec5SDimitry Andricdef S_CMPK_EQ_U32_vi : SOPK_Real_vi <0x08, S_CMPK_EQ_U32>; 30280b57cec5SDimitry Andricdef S_CMPK_LG_U32_vi : SOPK_Real_vi <0x09, S_CMPK_LG_U32>; 30290b57cec5SDimitry Andricdef S_CMPK_GT_U32_vi : SOPK_Real_vi <0x0A, S_CMPK_GT_U32>; 30300b57cec5SDimitry Andricdef S_CMPK_GE_U32_vi : SOPK_Real_vi <0x0B, S_CMPK_GE_U32>; 30310b57cec5SDimitry Andricdef S_CMPK_LT_U32_vi : SOPK_Real_vi <0x0C, S_CMPK_LT_U32>; 30320b57cec5SDimitry Andricdef S_CMPK_LE_U32_vi : SOPK_Real_vi <0x0D, S_CMPK_LE_U32>; 30330b57cec5SDimitry Andricdef S_ADDK_I32_vi : SOPK_Real_vi <0x0E, S_ADDK_I32>; 30340b57cec5SDimitry Andricdef S_MULK_I32_vi : SOPK_Real_vi <0x0F, S_MULK_I32>; 30350b57cec5SDimitry Andricdef S_CBRANCH_I_FORK_vi : SOPK_Real_vi <0x10, S_CBRANCH_I_FORK>; 30360b57cec5SDimitry Andricdef S_GETREG_B32_vi : SOPK_Real_vi <0x11, S_GETREG_B32>; 30370b57cec5SDimitry Andricdef S_SETREG_B32_vi : SOPK_Real_vi <0x12, S_SETREG_B32>; 30380b57cec5SDimitry Andric//def S_GETREG_REGRD_B32_vi : SOPK_Real_vi <0x13, S_GETREG_REGRD_B32>; // see pseudo for comments 30390b57cec5SDimitry Andricdef S_SETREG_IMM32_B32_vi : SOPK_Real64<0x14, S_SETREG_IMM32_B32>, 3040*0fca6ea1SDimitry Andric Select_vi<S_SETREG_IMM32_B32.PseudoInstr>; 30410b57cec5SDimitry Andric 30420b57cec5SDimitry Andricdef S_CALL_B64_vi : SOPK_Real_vi <0x15, S_CALL_B64>; 30430b57cec5SDimitry Andric 30440b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 30450b57cec5SDimitry Andric// SOP1 - GFX9. 30460b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 30470b57cec5SDimitry Andric 30480b57cec5SDimitry Andricdef S_ANDN1_SAVEEXEC_B64_vi : SOP1_Real_vi<0x33, S_ANDN1_SAVEEXEC_B64>; 30490b57cec5SDimitry Andricdef S_ORN1_SAVEEXEC_B64_vi : SOP1_Real_vi<0x34, S_ORN1_SAVEEXEC_B64>; 30500b57cec5SDimitry Andricdef S_ANDN1_WREXEC_B64_vi : SOP1_Real_vi<0x35, S_ANDN1_WREXEC_B64>; 30510b57cec5SDimitry Andricdef S_ANDN2_WREXEC_B64_vi : SOP1_Real_vi<0x36, S_ANDN2_WREXEC_B64>; 30520b57cec5SDimitry Andricdef S_BITREPLICATE_B64_B32_vi : SOP1_Real_vi<0x37, S_BITREPLICATE_B64_B32>; 30530b57cec5SDimitry Andric 30540b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 30550b57cec5SDimitry Andric// SOP2 - GFX9. 30560b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 30570b57cec5SDimitry Andric 30580b57cec5SDimitry Andricdef S_LSHL1_ADD_U32_vi : SOP2_Real_vi<0x2e, S_LSHL1_ADD_U32>; 30590b57cec5SDimitry Andricdef S_LSHL2_ADD_U32_vi : SOP2_Real_vi<0x2f, S_LSHL2_ADD_U32>; 30600b57cec5SDimitry Andricdef S_LSHL3_ADD_U32_vi : SOP2_Real_vi<0x30, S_LSHL3_ADD_U32>; 30610b57cec5SDimitry Andricdef S_LSHL4_ADD_U32_vi : SOP2_Real_vi<0x31, S_LSHL4_ADD_U32>; 30620b57cec5SDimitry Andricdef S_MUL_HI_U32_vi : SOP2_Real_vi<0x2c, S_MUL_HI_U32>; 30630b57cec5SDimitry Andricdef S_MUL_HI_I32_vi : SOP2_Real_vi<0x2d, S_MUL_HI_I32>; 3064