1//===-- SOPInstructions.td - SOP Instruction Definitions ------------------===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9def GPRIdxMode : CustomOperand<i32>; 10 11class SOP_Pseudo<string opName, dag outs, dag ins, string asmOps, 12 list<dag> pattern=[]> : 13 InstSI<outs, ins, "", pattern>, 14 SIMCInstr<opName, SIEncodingFamily.NONE> { 15 16 let isPseudo = 1; 17 let isCodeGenOnly = 1; 18 19 string Mnemonic = opName; 20 string AsmOperands = asmOps; 21 22 bits<1> has_sdst = 0; 23} 24 25//===----------------------------------------------------------------------===// 26// SOP1 Instructions 27//===----------------------------------------------------------------------===// 28 29class SOP1_Pseudo <string opName, dag outs, dag ins, 30 string asmOps, list<dag> pattern=[]> : 31 SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> { 32 33 let mayLoad = 0; 34 let mayStore = 0; 35 let hasSideEffects = 0; 36 let SALU = 1; 37 let SOP1 = 1; 38 let SchedRW = [WriteSALU]; 39 let Size = 4; 40 let UseNamedOperandTable = 1; 41 42 bits<1> has_src0 = 1; 43 let has_sdst = 1; 44} 45 46class SOP1_Real<bits<8> op, SOP1_Pseudo ps, string real_name = ps.Mnemonic> : 47 InstSI <ps.OutOperandList, ps.InOperandList, 48 real_name # ps.AsmOperands>, 49 Enc32 { 50 51 let SALU = 1; 52 let SOP1 = 1; 53 let isPseudo = 0; 54 let isCodeGenOnly = 0; 55 let Size = 4; 56 57 // copy relevant pseudo op flags 58 let SubtargetPredicate = ps.SubtargetPredicate; 59 let AsmMatchConverter = ps.AsmMatchConverter; 60 let SchedRW = ps.SchedRW; 61 let mayLoad = ps.mayLoad; 62 let mayStore = ps.mayStore; 63 64 // encoding 65 bits<7> sdst; 66 bits<8> src0; 67 68 let Inst{7-0} = !if(ps.has_src0, src0, ?); 69 let Inst{15-8} = op; 70 let Inst{22-16} = !if(ps.has_sdst, sdst, ?); 71 let Inst{31-23} = 0x17d; //encoding; 72} 73 74class SOP1_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo < 75 opName, (outs SReg_32:$sdst), 76 !if(tied_in, (ins SSrc_b32:$src0, SReg_32:$sdst_in), 77 (ins SSrc_b32:$src0)), 78 "$sdst, $src0", pattern> { 79 let Constraints = !if(tied_in, "$sdst = $sdst_in", ""); 80} 81 82// Only register input allowed. 83class SOP1_32R <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 84 opName, (outs SReg_32:$sdst), (ins SReg_32:$src0), 85 "$sdst, $src0", pattern>; 86 87// 32-bit input, no output. 88class SOP1_0_32 <string opName, list<dag> pattern = []> : SOP1_Pseudo < 89 opName, (outs), (ins SSrc_b32:$src0), 90 "$src0", pattern> { 91 let has_sdst = 0; 92} 93 94// Special case for movreld where sdst is treated as a use operand. 95class SOP1_32_movreld <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 96 opName, (outs), (ins SReg_32:$sdst, SSrc_b32:$src0), 97 "$sdst, $src0", pattern>; 98 99// Special case for movreld where sdst is treated as a use operand. 100class SOP1_64_movreld <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 101 opName, (outs), (ins SReg_64:$sdst, SSrc_b64:$src0), 102 "$sdst, $src0", pattern 103>; 104 105class SOP1_0_32R <string opName, list<dag> pattern = []> : SOP1_Pseudo < 106 opName, (outs), (ins SReg_32:$src0), 107 "$src0", pattern> { 108 let has_sdst = 0; 109} 110 111class SOP1_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 112 opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0), 113 "$sdst, $src0", pattern 114>; 115 116// Only register input allowed. 117class SOP1_64R <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 118 opName, (outs SReg_64:$sdst), (ins SReg_64:$src0), 119 "$sdst, $src0", pattern 120>; 121 122// 64-bit input, 32-bit output. 123class SOP1_32_64 <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 124 opName, (outs SReg_32:$sdst), (ins SSrc_b64:$src0), 125 "$sdst, $src0", pattern 126>; 127 128// 32-bit input, 64-bit output. 129class SOP1_64_32 <string opName, list<dag> pattern=[], bit tied_in = 0> : SOP1_Pseudo < 130 opName, (outs SReg_64:$sdst), 131 !if(tied_in, (ins SSrc_b32:$src0, SReg_64:$sdst_in), 132 (ins SSrc_b32:$src0)), 133 "$sdst, $src0", pattern> { 134 let Constraints = !if(tied_in, "$sdst = $sdst_in", ""); 135} 136 137// no input, 64-bit output. 138class SOP1_64_0 <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 139 opName, (outs SReg_64:$sdst), (ins), "$sdst", pattern> { 140 let has_src0 = 0; 141} 142 143// 64-bit input, no output 144class SOP1_1 <string opName, list<dag> pattern=[]> : SOP1_Pseudo < 145 opName, (outs), (ins SReg_64:$src0), "$src0", pattern> { 146 let has_sdst = 0; 147} 148 149 150class UniformUnaryFrag<SDPatternOperator Op> : PatFrag < 151 (ops node:$src0), 152 (Op $src0), 153 [{ return !N->isDivergent(); }]> { 154 // This check is unnecessary as it's captured by the result register 155 // bank constraint. 156 // 157 // FIXME: Should add a way for the emitter to recognize this is a 158 // trivially true predicate to eliminate the check. 159 let GISelPredicateCode = [{return true;}]; 160} 161 162class UniformBinFrag<SDPatternOperator Op> : PatFrag < 163 (ops node:$src0, node:$src1), 164 (Op $src0, $src1), 165 [{ return !N->isDivergent(); }]> { 166 // This check is unnecessary as it's captured by the result register 167 // bank constraint. 168 // 169 // FIXME: Should add a way for the emitter to recognize this is a 170 // trivially true predicate to eliminate the check. 171 let GISelPredicateCode = [{return true;}]; 172} 173 174class UniformTernaryFrag<SDPatternOperator Op> : PatFrag < 175 (ops node:$src0, node:$src1, node:$src2), 176 (Op $src0, $src1, $src2), 177 [{ return !N->isDivergent(); }]> { 178 // This check is unnecessary as it's captured by the result register 179 // bank constraint. 180 // 181 // FIXME: Should add a way for the emitter to recognize this is a 182 // trivially true predicate to eliminate the check. 183 let GISelPredicateCode = [{return true;}]; 184} 185 186class DivergentBinFrag<SDPatternOperator Op> : PatFrag < 187 (ops node:$src0, node:$src1), 188 (Op $src0, $src1), 189 [{ return N->isDivergent(); }]> { 190 // This check is unnecessary as it's captured by the result register 191 // bank constraint. 192 // 193 // FIXME: Should add a way for the emitter to recognize this is a 194 // trivially true predicate to eliminate the check. 195 let GISelPredicateCode = [{return true;}]; 196} 197 198 199let isMoveImm = 1 in { 200 let isReMaterializable = 1, isAsCheapAsAMove = 1 in { 201 def S_MOV_B32 : SOP1_32 <"s_mov_b32">; 202 def S_MOV_B64 : SOP1_64 <"s_mov_b64">; 203 } // End isReMaterializable = 1 204 205 let Uses = [SCC] in { 206 def S_CMOV_B32 : SOP1_32 <"s_cmov_b32">; 207 def S_CMOV_B64 : SOP1_64 <"s_cmov_b64">; 208 } // End Uses = [SCC] 209} // End isMoveImm = 1 210 211let Defs = [SCC] in { 212 def S_NOT_B32 : SOP1_32 <"s_not_b32", 213 [(set i32:$sdst, (UniformUnaryFrag<not> i32:$src0))] 214 >; 215 216 def S_NOT_B64 : SOP1_64 <"s_not_b64", 217 [(set i64:$sdst, (UniformUnaryFrag<not> i64:$src0))] 218 >; 219 def S_WQM_B32 : SOP1_32 <"s_wqm_b32">; 220 def S_WQM_B64 : SOP1_64 <"s_wqm_b64">; 221} // End Defs = [SCC] 222 223 224let WaveSizePredicate = isWave32 in { 225def : GCNPat < 226 (int_amdgcn_wqm_vote i1:$src0), 227 (S_WQM_B32 SSrc_b32:$src0) 228>; 229} 230 231let WaveSizePredicate = isWave64 in { 232def : GCNPat < 233 (int_amdgcn_wqm_vote i1:$src0), 234 (S_WQM_B64 SSrc_b64:$src0) 235>; 236} 237 238let isReMaterializable = 1, isAsCheapAsAMove = 1 in { 239def S_BREV_B32 : SOP1_32 <"s_brev_b32", 240 [(set i32:$sdst, (UniformUnaryFrag<bitreverse> i32:$src0))] 241>; 242def S_BREV_B64 : SOP1_64 <"s_brev_b64", 243 [(set i64:$sdst, (UniformUnaryFrag<bitreverse> i64:$src0))] 244>; 245} // End isReMaterializable = 1, isAsCheapAsAMove = 1 246 247let Defs = [SCC] in { 248def S_BCNT0_I32_B32 : SOP1_32 <"s_bcnt0_i32_b32">; 249def S_BCNT0_I32_B64 : SOP1_32_64 <"s_bcnt0_i32_b64">; 250def S_BCNT1_I32_B32 : SOP1_32 <"s_bcnt1_i32_b32", 251 [(set i32:$sdst, (UniformUnaryFrag<ctpop> i32:$src0))] 252>; 253def S_BCNT1_I32_B64 : SOP1_32_64 <"s_bcnt1_i32_b64", 254 [(set i32:$sdst, (UniformUnaryFrag<ctpop> i64:$src0))] 255>; 256} // End Defs = [SCC] 257 258let isReMaterializable = 1 in { 259def S_FF0_I32_B32 : SOP1_32 <"s_ff0_i32_b32">; 260def S_FF0_I32_B64 : SOP1_32_64 <"s_ff0_i32_b64">; 261def S_FF1_I32_B64 : SOP1_32_64 <"s_ff1_i32_b64", 262 [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbl_b32> i64:$src0))] 263>; 264 265def S_FF1_I32_B32 : SOP1_32 <"s_ff1_i32_b32", 266 [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbl_b32> i32:$src0))] 267>; 268 269def S_FLBIT_I32_B32 : SOP1_32 <"s_flbit_i32_b32", 270 [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_u32> i32:$src0))] 271>; 272 273def S_FLBIT_I32_B64 : SOP1_32_64 <"s_flbit_i32_b64", 274 [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_u32> i64:$src0))] 275>; 276def S_FLBIT_I32 : SOP1_32 <"s_flbit_i32", 277 [(set i32:$sdst, (UniformUnaryFrag<AMDGPUffbh_i32> i32:$src0))] 278>; 279def S_FLBIT_I32_I64 : SOP1_32_64 <"s_flbit_i32_i64">; 280def S_SEXT_I32_I8 : SOP1_32 <"s_sext_i32_i8", 281 [(set i32:$sdst, (UniformSextInreg<i8> i32:$src0))] 282>; 283def S_SEXT_I32_I16 : SOP1_32 <"s_sext_i32_i16", 284 [(set i32:$sdst, (UniformSextInreg<i16> i32:$src0))] 285>; 286} // End isReMaterializable = 1 287 288def S_BITSET0_B32 : SOP1_32 <"s_bitset0_b32", [], 1>; 289def S_BITSET0_B64 : SOP1_64_32 <"s_bitset0_b64", [], 1>; 290def S_BITSET1_B32 : SOP1_32 <"s_bitset1_b32", [], 1>; 291def S_BITSET1_B64 : SOP1_64_32 <"s_bitset1_b64", [], 1>; 292 293def S_GETPC_B64 : SOP1_64_0 <"s_getpc_b64", 294 [(set i64:$sdst, (int_amdgcn_s_getpc))] 295>; 296 297let isTerminator = 1, isBarrier = 1, SchedRW = [WriteBranch] in { 298 299let isBranch = 1, isIndirectBranch = 1 in { 300def S_SETPC_B64 : SOP1_1 <"s_setpc_b64">; 301} // End isBranch = 1, isIndirectBranch = 1 302 303let isReturn = 1 in { 304// Define variant marked as return rather than branch. 305def S_SETPC_B64_return : SOP1_1<"">; 306} 307} // End isTerminator = 1, isBarrier = 1 308 309let isCall = 1 in { 310def S_SWAPPC_B64 : SOP1_64 <"s_swappc_b64" 311>; 312} 313 314def S_RFE_B64 : SOP1_1 <"s_rfe_b64">; 315 316let hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC] in { 317 318def S_AND_SAVEEXEC_B64 : SOP1_64 <"s_and_saveexec_b64">; 319def S_OR_SAVEEXEC_B64 : SOP1_64 <"s_or_saveexec_b64">; 320def S_XOR_SAVEEXEC_B64 : SOP1_64 <"s_xor_saveexec_b64">; 321def S_ANDN2_SAVEEXEC_B64 : SOP1_64 <"s_andn2_saveexec_b64">; 322def S_ORN2_SAVEEXEC_B64 : SOP1_64 <"s_orn2_saveexec_b64">; 323def S_NAND_SAVEEXEC_B64 : SOP1_64 <"s_nand_saveexec_b64">; 324def S_NOR_SAVEEXEC_B64 : SOP1_64 <"s_nor_saveexec_b64">; 325def S_XNOR_SAVEEXEC_B64 : SOP1_64 <"s_xnor_saveexec_b64">; 326 327} // End hasSideEffects = 1, Uses = [EXEC], Defs = [EXEC, SCC] 328 329def S_QUADMASK_B32 : SOP1_32 <"s_quadmask_b32">; 330def S_QUADMASK_B64 : SOP1_64 <"s_quadmask_b64">; 331 332let Uses = [M0] in { 333def S_MOVRELS_B32 : SOP1_32R <"s_movrels_b32">; 334def S_MOVRELS_B64 : SOP1_64R <"s_movrels_b64">; 335def S_MOVRELD_B32 : SOP1_32_movreld <"s_movreld_b32">; 336def S_MOVRELD_B64 : SOP1_64_movreld <"s_movreld_b64">; 337} // End Uses = [M0] 338 339let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in { 340def S_CBRANCH_JOIN : SOP1_0_32R <"s_cbranch_join">; 341} // End SubtargetPredicate = isGFX6GFX7GFX8GFX9 342 343let Defs = [SCC] in { 344def S_ABS_I32 : SOP1_32 <"s_abs_i32", 345 [(set i32:$sdst, (UniformUnaryFrag<abs> i32:$src0))] 346 >; 347} // End Defs = [SCC] 348 349let SubtargetPredicate = HasVGPRIndexMode in { 350def S_SET_GPR_IDX_IDX : SOP1_0_32<"s_set_gpr_idx_idx"> { 351 let Uses = [M0, MODE]; 352 let Defs = [M0, MODE]; 353} 354} 355 356let SubtargetPredicate = isGFX9Plus in { 357 let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in { 358 def S_ANDN1_SAVEEXEC_B64 : SOP1_64<"s_andn1_saveexec_b64">; 359 def S_ORN1_SAVEEXEC_B64 : SOP1_64<"s_orn1_saveexec_b64">; 360 def S_ANDN1_WREXEC_B64 : SOP1_64<"s_andn1_wrexec_b64">; 361 def S_ANDN2_WREXEC_B64 : SOP1_64<"s_andn2_wrexec_b64">; 362 } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] 363 364 let isReMaterializable = 1 in 365 def S_BITREPLICATE_B64_B32 : SOP1_64_32<"s_bitreplicate_b64_b32">; 366} // End SubtargetPredicate = isGFX9Plus 367 368let SubtargetPredicate = isGFX10Plus in { 369 let hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] in { 370 def S_AND_SAVEEXEC_B32 : SOP1_32<"s_and_saveexec_b32">; 371 def S_OR_SAVEEXEC_B32 : SOP1_32<"s_or_saveexec_b32">; 372 def S_XOR_SAVEEXEC_B32 : SOP1_32<"s_xor_saveexec_b32">; 373 def S_ANDN2_SAVEEXEC_B32 : SOP1_32<"s_andn2_saveexec_b32">; 374 def S_ORN2_SAVEEXEC_B32 : SOP1_32<"s_orn2_saveexec_b32">; 375 def S_NAND_SAVEEXEC_B32 : SOP1_32<"s_nand_saveexec_b32">; 376 def S_NOR_SAVEEXEC_B32 : SOP1_32<"s_nor_saveexec_b32">; 377 def S_XNOR_SAVEEXEC_B32 : SOP1_32<"s_xnor_saveexec_b32">; 378 def S_ANDN1_SAVEEXEC_B32 : SOP1_32<"s_andn1_saveexec_b32">; 379 def S_ORN1_SAVEEXEC_B32 : SOP1_32<"s_orn1_saveexec_b32">; 380 def S_ANDN1_WREXEC_B32 : SOP1_32<"s_andn1_wrexec_b32">; 381 def S_ANDN2_WREXEC_B32 : SOP1_32<"s_andn2_wrexec_b32">; 382 } // End hasSideEffects = 1, Defs = [EXEC, SCC], Uses = [EXEC] 383 384 let Uses = [M0] in { 385 def S_MOVRELSD_2_B32 : SOP1_32<"s_movrelsd_2_b32">; 386 } // End Uses = [M0] 387} // End SubtargetPredicate = isGFX10Plus 388 389let SubtargetPredicate = isGFX11Plus in { 390 let hasSideEffects = 1 in { 391 // For s_sendmsg_rtn_* the src0 field encodes the message type directly; it 392 // is not an SGPR number. 393 def S_SENDMSG_RTN_B32 : SOP1_Pseudo< 394 "s_sendmsg_rtn_b32", (outs SReg_32:$sdst), (ins SendMsg:$src0), 395 "$sdst, $src0", [(set i32:$sdst, (int_amdgcn_s_sendmsg_rtn timm:$src0))] 396 >; 397 def S_SENDMSG_RTN_B64 : SOP1_Pseudo< 398 "s_sendmsg_rtn_b64", (outs SReg_64:$sdst), (ins SendMsg:$src0), 399 "$sdst, $src0", [(set i64:$sdst, (int_amdgcn_s_sendmsg_rtn timm:$src0))] 400 >; 401 } 402} // End SubtargetPredicate = isGFX11Plus 403 404//===----------------------------------------------------------------------===// 405// SOP2 Instructions 406//===----------------------------------------------------------------------===// 407 408class SOP2_Pseudo<string opName, dag outs, dag ins, 409 string asmOps, list<dag> pattern=[]> : 410 SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> { 411 412 let mayLoad = 0; 413 let mayStore = 0; 414 let hasSideEffects = 0; 415 let SALU = 1; 416 let SOP2 = 1; 417 let SchedRW = [WriteSALU]; 418 let UseNamedOperandTable = 1; 419 420 let has_sdst = 1; 421 422 // Pseudo instructions have no encodings, but adding this field here allows 423 // us to do: 424 // let sdst = xxx in { 425 // for multiclasses that include both real and pseudo instructions. 426 // field bits<7> sdst = 0; 427 // let Size = 4; // Do we need size here? 428} 429 430class SOP2_Real<bits<7> op, SOP_Pseudo ps, string real_name = ps.Mnemonic> : 431 InstSI <ps.OutOperandList, ps.InOperandList, 432 real_name # ps.AsmOperands>, 433 Enc32 { 434 let SALU = 1; 435 let SOP2 = 1; 436 let isPseudo = 0; 437 let isCodeGenOnly = 0; 438 439 // copy relevant pseudo op flags 440 let SubtargetPredicate = ps.SubtargetPredicate; 441 let AsmMatchConverter = ps.AsmMatchConverter; 442 let UseNamedOperandTable = ps.UseNamedOperandTable; 443 let TSFlags = ps.TSFlags; 444 let SchedRW = ps.SchedRW; 445 let mayLoad = ps.mayLoad; 446 let mayStore = ps.mayStore; 447 448 // encoding 449 bits<7> sdst; 450 bits<8> src0; 451 bits<8> src1; 452 453 let Inst{7-0} = src0; 454 let Inst{15-8} = src1; 455 let Inst{22-16} = !if(ps.has_sdst, sdst, ?); 456 let Inst{29-23} = op; 457 let Inst{31-30} = 0x2; // encoding 458} 459 460 461class SOP2_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo < 462 opName, (outs SReg_32:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1), 463 "$sdst, $src0, $src1", pattern 464>; 465 466class SOP2_64 <string opName, list<dag> pattern=[]> : SOP2_Pseudo < 467 opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b64:$src1), 468 "$sdst, $src0, $src1", pattern 469>; 470 471class SOP2_64_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo < 472 opName, (outs SReg_64:$sdst), (ins SSrc_b64:$src0, SSrc_b32:$src1), 473 "$sdst, $src0, $src1", pattern 474>; 475 476class SOP2_64_32_32 <string opName, list<dag> pattern=[]> : SOP2_Pseudo < 477 opName, (outs SReg_64:$sdst), (ins SSrc_b32:$src0, SSrc_b32:$src1), 478 "$sdst, $src0, $src1", pattern 479>; 480 481 482let Defs = [SCC] in { // Carry out goes to SCC 483let isCommutable = 1 in { 484def S_ADD_U32 : SOP2_32 <"s_add_u32">; 485def S_ADD_I32 : SOP2_32 <"s_add_i32", 486 [(set i32:$sdst, (UniformBinFrag<add> SSrc_b32:$src0, SSrc_b32:$src1))] 487>; 488} // End isCommutable = 1 489 490def S_SUB_U32 : SOP2_32 <"s_sub_u32">; 491def S_SUB_I32 : SOP2_32 <"s_sub_i32", 492 [(set i32:$sdst, (UniformBinFrag<sub> SSrc_b32:$src0, SSrc_b32:$src1))] 493>; 494 495let Uses = [SCC] in { // Carry in comes from SCC 496let isCommutable = 1 in { 497def S_ADDC_U32 : SOP2_32 <"s_addc_u32", 498 [(set i32:$sdst, (UniformBinFrag<adde> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>; 499} // End isCommutable = 1 500 501def S_SUBB_U32 : SOP2_32 <"s_subb_u32", 502 [(set i32:$sdst, (UniformBinFrag<sube> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))]>; 503} // End Uses = [SCC] 504 505let isCommutable = 1 in { 506def S_MIN_I32 : SOP2_32 <"s_min_i32", 507 [(set i32:$sdst, (UniformBinFrag<smin> i32:$src0, i32:$src1))] 508>; 509def S_MIN_U32 : SOP2_32 <"s_min_u32", 510 [(set i32:$sdst, (UniformBinFrag<umin> i32:$src0, i32:$src1))] 511>; 512def S_MAX_I32 : SOP2_32 <"s_max_i32", 513 [(set i32:$sdst, (UniformBinFrag<smax> i32:$src0, i32:$src1))] 514>; 515def S_MAX_U32 : SOP2_32 <"s_max_u32", 516 [(set i32:$sdst, (UniformBinFrag<umax> i32:$src0, i32:$src1))] 517>; 518} // End isCommutable = 1 519} // End Defs = [SCC] 520 521def SelectPat : PatFrag < 522 (ops node:$src1, node:$src2), 523 (select SCC, $src1, $src2), 524 [{ return !N->isDivergent(); }] 525>; 526 527let Uses = [SCC] in { 528 let AddedComplexity = 20 in { 529 def S_CSELECT_B32 : SOP2_32 <"s_cselect_b32", 530 [(set i32:$sdst, (SelectPat i32:$src0, i32:$src1))] 531 >; 532 } 533 534 def S_CSELECT_B64 : SOP2_64 <"s_cselect_b64">; 535} // End Uses = [SCC] 536 537let Defs = [SCC] in { 538let isCommutable = 1 in { 539def S_AND_B32 : SOP2_32 <"s_and_b32", 540 [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, i32:$src1))] 541>; 542 543def S_AND_B64 : SOP2_64 <"s_and_b64", 544 [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, i64:$src1))] 545>; 546 547def S_OR_B32 : SOP2_32 <"s_or_b32", 548 [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, i32:$src1))] 549>; 550 551def S_OR_B64 : SOP2_64 <"s_or_b64", 552 [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, i64:$src1))] 553>; 554 555def S_XOR_B32 : SOP2_32 <"s_xor_b32", 556 [(set i32:$sdst, (UniformBinFrag<xor> i32:$src0, i32:$src1))] 557>; 558 559def S_XOR_B64 : SOP2_64 <"s_xor_b64", 560 [(set i64:$sdst, (UniformBinFrag<xor> i64:$src0, i64:$src1))] 561>; 562 563def S_XNOR_B32 : SOP2_32 <"s_xnor_b32", 564 [(set i32:$sdst, (UniformUnaryFrag<not> (xor_oneuse i32:$src0, i32:$src1)))] 565>; 566 567def S_XNOR_B64 : SOP2_64 <"s_xnor_b64", 568 [(set i64:$sdst, (UniformUnaryFrag<not> (xor_oneuse i64:$src0, i64:$src1)))] 569>; 570 571def S_NAND_B32 : SOP2_32 <"s_nand_b32", 572 [(set i32:$sdst, (UniformUnaryFrag<not> (and_oneuse i32:$src0, i32:$src1)))] 573>; 574 575def S_NAND_B64 : SOP2_64 <"s_nand_b64", 576 [(set i64:$sdst, (UniformUnaryFrag<not> (and_oneuse i64:$src0, i64:$src1)))] 577>; 578 579def S_NOR_B32 : SOP2_32 <"s_nor_b32", 580 [(set i32:$sdst, (UniformUnaryFrag<not> (or_oneuse i32:$src0, i32:$src1)))] 581>; 582 583def S_NOR_B64 : SOP2_64 <"s_nor_b64", 584 [(set i64:$sdst, (UniformUnaryFrag<not> (or_oneuse i64:$src0, i64:$src1)))] 585>; 586} // End isCommutable = 1 587 588// There are also separate patterns for types other than i32 589def S_ANDN2_B32 : SOP2_32 <"s_andn2_b32", 590 [(set i32:$sdst, (UniformBinFrag<and> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))] 591>; 592 593def S_ANDN2_B64 : SOP2_64 <"s_andn2_b64", 594 [(set i64:$sdst, (UniformBinFrag<and> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))] 595>; 596 597def S_ORN2_B32 : SOP2_32 <"s_orn2_b32", 598 [(set i32:$sdst, (UniformBinFrag<or> i32:$src0, (UniformUnaryFrag<not> i32:$src1)))] 599>; 600 601def S_ORN2_B64 : SOP2_64 <"s_orn2_b64", 602 [(set i64:$sdst, (UniformBinFrag<or> i64:$src0, (UniformUnaryFrag<not> i64:$src1)))] 603>; 604} // End Defs = [SCC] 605 606// Use added complexity so these patterns are preferred to the VALU patterns. 607let AddedComplexity = 1 in { 608 609let Defs = [SCC] in { 610// TODO: b64 versions require VOP3 change since v_lshlrev_b64 is VOP3 611def S_LSHL_B32 : SOP2_32 <"s_lshl_b32", 612 [(set SReg_32:$sdst, (UniformBinFrag<cshl_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))] 613>; 614def S_LSHL_B64 : SOP2_64_32 <"s_lshl_b64", 615 [(set SReg_64:$sdst, (UniformBinFrag<cshl_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))] 616>; 617def S_LSHR_B32 : SOP2_32 <"s_lshr_b32", 618 [(set SReg_32:$sdst, (UniformBinFrag<csrl_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))] 619>; 620def S_LSHR_B64 : SOP2_64_32 <"s_lshr_b64", 621 [(set SReg_64:$sdst, (UniformBinFrag<csrl_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))] 622>; 623def S_ASHR_I32 : SOP2_32 <"s_ashr_i32", 624 [(set SReg_32:$sdst, (UniformBinFrag<csra_32> (i32 SSrc_b32:$src0), (i32 SSrc_b32:$src1)))] 625>; 626def S_ASHR_I64 : SOP2_64_32 <"s_ashr_i64", 627 [(set SReg_64:$sdst, (UniformBinFrag<csra_64> (i64 SSrc_b64:$src0), (i32 SSrc_b32:$src1)))] 628>; 629} // End Defs = [SCC] 630 631let isReMaterializable = 1 in { 632def S_BFM_B32 : SOP2_32 <"s_bfm_b32", 633 [(set i32:$sdst, (UniformBinFrag<AMDGPUbfm> i32:$src0, i32:$src1))]>; 634def S_BFM_B64 : SOP2_64_32_32 <"s_bfm_b64">; 635 636def S_MUL_I32 : SOP2_32 <"s_mul_i32", 637 [(set i32:$sdst, (UniformBinFrag<mul> i32:$src0, i32:$src1))]> { 638 let isCommutable = 1; 639} 640} // End isReMaterializable = 1 641} // End AddedComplexity = 1 642 643let Defs = [SCC] in { 644def S_BFE_U32 : SOP2_32 <"s_bfe_u32">; 645def S_BFE_I32 : SOP2_32 <"s_bfe_i32">; 646def S_BFE_U64 : SOP2_64_32 <"s_bfe_u64">; 647def S_BFE_I64 : SOP2_64_32 <"s_bfe_i64">; 648} // End Defs = [SCC] 649 650def S_CBRANCH_G_FORK : SOP2_Pseudo < 651 "s_cbranch_g_fork", (outs), 652 (ins SCSrc_b64:$src0, SCSrc_b64:$src1), 653 "$src0, $src1" 654> { 655 let has_sdst = 0; 656 let SubtargetPredicate = isGFX6GFX7GFX8GFX9; 657} 658 659let Defs = [SCC] in { 660def S_ABSDIFF_I32 : SOP2_32 <"s_absdiff_i32">; 661} // End Defs = [SCC] 662 663let SubtargetPredicate = isGFX8GFX9 in { 664 def S_RFE_RESTORE_B64 : SOP2_Pseudo < 665 "s_rfe_restore_b64", (outs), 666 (ins SSrc_b64:$src0, SSrc_b32:$src1), 667 "$src0, $src1" 668 > { 669 let hasSideEffects = 1; 670 let has_sdst = 0; 671 } 672} 673 674let SubtargetPredicate = isGFX9Plus in { 675 let isReMaterializable = 1 in { 676 def S_PACK_LL_B32_B16 : SOP2_32<"s_pack_ll_b32_b16">; 677 def S_PACK_LH_B32_B16 : SOP2_32<"s_pack_lh_b32_b16">; 678 def S_PACK_HH_B32_B16 : SOP2_32<"s_pack_hh_b32_b16">; 679 } // End isReMaterializable = 1 680 681 let Defs = [SCC] in { 682 def S_LSHL1_ADD_U32 : SOP2_32<"s_lshl1_add_u32", 683 [(set i32:$sdst, (shl1_add SSrc_b32:$src0, SSrc_b32:$src1))] 684 >; 685 def S_LSHL2_ADD_U32 : SOP2_32<"s_lshl2_add_u32", 686 [(set i32:$sdst, (shl2_add SSrc_b32:$src0, SSrc_b32:$src1))] 687 >; 688 def S_LSHL3_ADD_U32 : SOP2_32<"s_lshl3_add_u32", 689 [(set i32:$sdst, (shl3_add SSrc_b32:$src0, SSrc_b32:$src1))] 690 >; 691 def S_LSHL4_ADD_U32 : SOP2_32<"s_lshl4_add_u32", 692 [(set i32:$sdst, (shl4_add SSrc_b32:$src0, SSrc_b32:$src1))] 693 >; 694 } // End Defs = [SCC] 695 696 let isCommutable = 1, isReMaterializable = 1 in { 697 def S_MUL_HI_U32 : SOP2_32<"s_mul_hi_u32", 698 [(set i32:$sdst, (UniformBinFrag<mulhu> SSrc_b32:$src0, SSrc_b32:$src1))]>; 699 def S_MUL_HI_I32 : SOP2_32<"s_mul_hi_i32", 700 [(set i32:$sdst, (UniformBinFrag<mulhs> SSrc_b32:$src0, SSrc_b32:$src1))]>; 701 } // End isCommutable = 1, isReMaterializable = 1 702} // End SubtargetPredicate = isGFX9Plus 703 704let SubtargetPredicate = isGFX11Plus in { 705 def S_PACK_HL_B32_B16 : SOP2_32<"s_pack_hl_b32_b16">; 706} // End SubtargetPredicate = isGFX11Plus 707 708//===----------------------------------------------------------------------===// 709// SOPK Instructions 710//===----------------------------------------------------------------------===// 711 712class SOPK_Pseudo <string opName, dag outs, dag ins, 713 string asmOps, list<dag> pattern=[]> : 714 SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> { 715 let mayLoad = 0; 716 let mayStore = 0; 717 let hasSideEffects = 0; 718 let SALU = 1; 719 let SOPK = 1; 720 let FixedSize = 1; 721 let SchedRW = [WriteSALU]; 722 let UseNamedOperandTable = 1; 723 724 let has_sdst = 1; 725} 726 727class SOPK_Real<SOPK_Pseudo ps> : 728 InstSI <ps.OutOperandList, ps.InOperandList, 729 ps.Mnemonic # ps.AsmOperands> { 730 let SALU = 1; 731 let SOPK = 1; 732 let isPseudo = 0; 733 let isCodeGenOnly = 0; 734 let UseNamedOperandTable = 1; 735 736 // copy relevant pseudo op flags 737 let SubtargetPredicate = ps.SubtargetPredicate; 738 let AsmMatchConverter = ps.AsmMatchConverter; 739 let DisableEncoding = ps.DisableEncoding; 740 let Constraints = ps.Constraints; 741 let SchedRW = ps.SchedRW; 742 let mayLoad = ps.mayLoad; 743 let mayStore = ps.mayStore; 744 let isBranch = ps.isBranch; 745 let isCall = ps.isCall; 746 747 // encoding 748 bits<7> sdst; 749 bits<16> simm16; 750 bits<32> imm; 751} 752 753class SOPK_Real32<bits<5> op, SOPK_Pseudo ps> : 754 SOPK_Real <ps>, 755 Enc32 { 756 let Inst{15-0} = simm16; 757 let Inst{22-16} = !if(ps.has_sdst, sdst, ?); 758 let Inst{27-23} = op; 759 let Inst{31-28} = 0xb; //encoding 760} 761 762class SOPK_Real64<bits<5> op, SOPK_Pseudo ps> : 763 SOPK_Real<ps>, 764 Enc64 { 765 let Inst{15-0} = simm16; 766 let Inst{22-16} = !if(ps.has_sdst, sdst, ?); 767 let Inst{27-23} = op; 768 let Inst{31-28} = 0xb; //encoding 769 let Inst{63-32} = imm; 770} 771 772class SOPKInstTable <bit is_sopk, string cmpOp = ""> { 773 bit IsSOPK = is_sopk; 774 string BaseCmpOp = cmpOp; 775} 776 777class SOPK_32 <string opName, list<dag> pattern=[]> : SOPK_Pseudo < 778 opName, 779 (outs SReg_32:$sdst), 780 (ins s16imm:$simm16), 781 "$sdst, $simm16", 782 pattern>; 783 784class SOPK_32_BR <string opName, list<dag> pattern=[]> : SOPK_Pseudo < 785 opName, 786 (outs), 787 (ins SOPPBrTarget:$simm16, SReg_32:$sdst), 788 "$sdst, $simm16", 789 pattern> { 790 let Defs = [EXEC]; 791 let Uses = [EXEC]; 792 let isBranch = 1; 793 let isTerminator = 1; 794 let SchedRW = [WriteBranch]; 795} 796 797class SOPK_SCC <string opName, string base_op, bit isSignExt> : SOPK_Pseudo < 798 opName, 799 (outs), 800 !if(isSignExt, 801 (ins SReg_32:$sdst, s16imm:$simm16), 802 (ins SReg_32:$sdst, u16imm:$simm16)), 803 "$sdst, $simm16">, 804 SOPKInstTable<1, base_op>{ 805 let Defs = [SCC]; 806} 807 808class SOPK_32TIE <string opName, list<dag> pattern=[]> : SOPK_Pseudo < 809 opName, 810 (outs SReg_32:$sdst), 811 (ins SReg_32:$src0, s16imm:$simm16), 812 "$sdst, $simm16", 813 pattern 814>; 815 816let isReMaterializable = 1, isMoveImm = 1 in { 817def S_MOVK_I32 : SOPK_32 <"s_movk_i32">; 818} // End isReMaterializable = 1 819let Uses = [SCC] in { 820def S_CMOVK_I32 : SOPK_32 <"s_cmovk_i32">; 821} 822 823let isCompare = 1 in { 824 825// This instruction is disabled for now until we can figure out how to teach 826// the instruction selector to correctly use the S_CMP* vs V_CMP* 827// instructions. 828// 829// When this instruction is enabled the code generator sometimes produces this 830// invalid sequence: 831// 832// SCC = S_CMPK_EQ_I32 SGPR0, imm 833// VCC = COPY SCC 834// VGPR0 = V_CNDMASK VCC, VGPR0, VGPR1 835// 836// def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32", 837// [(set i1:$dst, (setcc i32:$src0, imm:$src1, SETEQ))] 838// >; 839 840def S_CMPK_EQ_I32 : SOPK_SCC <"s_cmpk_eq_i32", "s_cmp_eq_i32", 1>; 841def S_CMPK_LG_I32 : SOPK_SCC <"s_cmpk_lg_i32", "s_cmp_lg_i32", 1>; 842def S_CMPK_GT_I32 : SOPK_SCC <"s_cmpk_gt_i32", "s_cmp_gt_i32", 1>; 843def S_CMPK_GE_I32 : SOPK_SCC <"s_cmpk_ge_i32", "s_cmp_ge_i32", 1>; 844def S_CMPK_LT_I32 : SOPK_SCC <"s_cmpk_lt_i32", "s_cmp_lt_i32", 1>; 845def S_CMPK_LE_I32 : SOPK_SCC <"s_cmpk_le_i32", "s_cmp_le_i32", 1>; 846 847let SOPKZext = 1 in { 848def S_CMPK_EQ_U32 : SOPK_SCC <"s_cmpk_eq_u32", "s_cmp_eq_u32", 0>; 849def S_CMPK_LG_U32 : SOPK_SCC <"s_cmpk_lg_u32", "s_cmp_lg_u32", 0>; 850def S_CMPK_GT_U32 : SOPK_SCC <"s_cmpk_gt_u32", "s_cmp_gt_u32", 0>; 851def S_CMPK_GE_U32 : SOPK_SCC <"s_cmpk_ge_u32", "s_cmp_ge_u32", 0>; 852def S_CMPK_LT_U32 : SOPK_SCC <"s_cmpk_lt_u32", "s_cmp_lt_u32", 0>; 853def S_CMPK_LE_U32 : SOPK_SCC <"s_cmpk_le_u32", "s_cmp_le_u32", 0>; 854} // End SOPKZext = 1 855} // End isCompare = 1 856 857let isCommutable = 1, DisableEncoding = "$src0", 858 Constraints = "$sdst = $src0" in { 859 let Defs = [SCC] in 860 def S_ADDK_I32 : SOPK_32TIE <"s_addk_i32">; 861 def S_MULK_I32 : SOPK_32TIE <"s_mulk_i32">; 862} 863 864let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in 865def S_CBRANCH_I_FORK : SOPK_Pseudo < 866 "s_cbranch_i_fork", 867 (outs), (ins SReg_64:$sdst, SOPPBrTarget:$simm16), 868 "$sdst, $simm16" 869>; 870 871// This is hasSideEffects to allow its use in readcyclecounter selection. 872// FIXME: Need to truncate immediate to 16-bits. 873def S_GETREG_B32 : SOPK_Pseudo < 874 "s_getreg_b32", 875 (outs SReg_32:$sdst), (ins hwreg:$simm16), 876 "$sdst, $simm16", 877 [(set i32:$sdst, (int_amdgcn_s_getreg (i32 timm:$simm16)))]> { 878 let SOPKZext = 1; 879 let hasSideEffects = 1; 880} 881 882let Defs = [MODE], Uses = [MODE] in { 883 884// FIXME: Need to truncate immediate to 16-bits. 885class S_SETREG_B32_Pseudo <list<dag> pattern=[]> : SOPK_Pseudo < 886 "s_setreg_b32", 887 (outs), (ins SReg_32:$sdst, hwreg:$simm16), 888 "$simm16, $sdst", 889 pattern>; 890 891def S_SETREG_B32 : S_SETREG_B32_Pseudo < 892 [(int_amdgcn_s_setreg (i32 timm:$simm16), i32:$sdst)]> { 893 // Use custom inserter to optimize some cases to 894 // S_DENORM_MODE/S_ROUND_MODE/S_SETREG_B32_mode. 895 let usesCustomInserter = 1; 896 let hasSideEffects = 1; 897} 898 899// Variant of SETREG that is guaranteed to only touch FP bits in the MODE 900// register, so doesn't have unmodeled side effects. 901def S_SETREG_B32_mode : S_SETREG_B32_Pseudo { 902 let hasSideEffects = 0; 903} 904 905// FIXME: Not on SI? 906//def S_GETREG_REGRD_B32 : SOPK_32 <sopk<0x14, 0x13>, "s_getreg_regrd_b32">; 907 908class S_SETREG_IMM32_B32_Pseudo : SOPK_Pseudo < 909 "s_setreg_imm32_b32", 910 (outs), (ins i32imm:$imm, hwreg:$simm16), 911 "$simm16, $imm"> { 912 let Size = 8; // Unlike every other SOPK instruction. 913 let has_sdst = 0; 914} 915 916def S_SETREG_IMM32_B32 : S_SETREG_IMM32_B32_Pseudo { 917 let hasSideEffects = 1; 918} 919 920// Variant of SETREG_IMM32 that is guaranteed to only touch FP bits in the MODE 921// register, so doesn't have unmodeled side effects. 922def S_SETREG_IMM32_B32_mode : S_SETREG_IMM32_B32_Pseudo { 923 let hasSideEffects = 0; 924} 925 926} // End Defs = [MODE], Uses = [MODE] 927 928class SOPK_WAITCNT<string opName, list<dag> pat=[]> : 929 SOPK_Pseudo< 930 opName, 931 (outs), 932 (ins SReg_32:$sdst, s16imm:$simm16), 933 "$sdst, $simm16", 934 pat> { 935 let hasSideEffects = 1; 936 let mayLoad = 1; 937 let mayStore = 1; 938 let has_sdst = 1; // First source takes place of sdst in encoding 939} 940 941let SubtargetPredicate = isGFX9Plus in { 942 def S_CALL_B64 : SOPK_Pseudo< 943 "s_call_b64", 944 (outs SReg_64:$sdst), 945 (ins SOPPBrTarget:$simm16), 946 "$sdst, $simm16"> { 947 let isCall = 1; 948 } 949} // End SubtargetPredicate = isGFX9Plus 950 951let SubtargetPredicate = isGFX10Plus in { 952 def S_VERSION : SOPK_Pseudo< 953 "s_version", 954 (outs), 955 (ins s16imm:$simm16), 956 "$simm16"> { 957 let has_sdst = 0; 958 } 959 960 def S_SUBVECTOR_LOOP_BEGIN : SOPK_32_BR<"s_subvector_loop_begin">; 961 def S_SUBVECTOR_LOOP_END : SOPK_32_BR<"s_subvector_loop_end">; 962 963 def S_WAITCNT_VSCNT : SOPK_WAITCNT<"s_waitcnt_vscnt">; 964 def S_WAITCNT_VMCNT : SOPK_WAITCNT<"s_waitcnt_vmcnt">; 965 def S_WAITCNT_EXPCNT : SOPK_WAITCNT<"s_waitcnt_expcnt">; 966 def S_WAITCNT_LGKMCNT : SOPK_WAITCNT<"s_waitcnt_lgkmcnt">; 967} // End SubtargetPredicate = isGFX10Plus 968 969//===----------------------------------------------------------------------===// 970// SOPC Instructions 971//===----------------------------------------------------------------------===// 972 973class SOPC_Pseudo<string opName, dag outs, dag ins, 974 string asmOps, list<dag> pattern=[]> : 975 SOP_Pseudo<opName, outs, ins, " " # asmOps, pattern> { 976 let mayLoad = 0; 977 let mayStore = 0; 978 let hasSideEffects = 0; 979 let SALU = 1; 980 let SOPC = 1; 981 let Defs = [SCC]; 982 let SchedRW = [WriteSALU]; 983 let UseNamedOperandTable = 1; 984} 985 986class SOPC_Real<bits<7> op, SOPC_Pseudo ps> : 987 InstSI <ps.OutOperandList, ps.InOperandList, 988 ps.Mnemonic # ps.AsmOperands>, 989 Enc32 { 990 let SALU = 1; 991 let SOPC = 1; 992 let isPseudo = 0; 993 let isCodeGenOnly = 0; 994 995 // copy relevant pseudo op flags 996 let SubtargetPredicate = ps.SubtargetPredicate; 997 let OtherPredicates = ps.OtherPredicates; 998 let AsmMatchConverter = ps.AsmMatchConverter; 999 let UseNamedOperandTable = ps.UseNamedOperandTable; 1000 let TSFlags = ps.TSFlags; 1001 let SchedRW = ps.SchedRW; 1002 let mayLoad = ps.mayLoad; 1003 let mayStore = ps.mayStore; 1004 1005 // encoding 1006 bits<8> src0; 1007 bits<8> src1; 1008 1009 let Inst{7-0} = src0; 1010 let Inst{15-8} = src1; 1011 let Inst{22-16} = op; 1012 let Inst{31-23} = 0x17e; 1013} 1014 1015class SOPC_Base <RegisterOperand rc0, RegisterOperand rc1, 1016 string opName, list<dag> pattern = []> : SOPC_Pseudo < 1017 opName, (outs), (ins rc0:$src0, rc1:$src1), 1018 "$src0, $src1", pattern > { 1019} 1020 1021class SOPC_Helper <RegisterOperand rc, ValueType vt, 1022 string opName, SDPatternOperator cond> : SOPC_Base < 1023 rc, rc, opName, 1024 [(set SCC, (UniformTernaryFrag<setcc> vt:$src0, vt:$src1, cond))] > { 1025} 1026 1027class SOPC_CMP_32<string opName, 1028 SDPatternOperator cond = COND_NULL, string revOp = opName> 1029 : SOPC_Helper<SSrc_b32, i32, opName, cond>, 1030 Commutable_REV<revOp, !eq(revOp, opName)>, 1031 SOPKInstTable<0, opName> { 1032 let isCompare = 1; 1033 let isCommutable = 1; 1034} 1035 1036class SOPC_CMP_64<string opName, 1037 SDPatternOperator cond = COND_NULL, string revOp = opName> 1038 : SOPC_Helper<SSrc_b64, i64, opName, cond>, 1039 Commutable_REV<revOp, !eq(revOp, opName)> { 1040 let isCompare = 1; 1041 let isCommutable = 1; 1042} 1043 1044class SOPC_32<string opName, list<dag> pattern = []> 1045 : SOPC_Base<SSrc_b32, SSrc_b32, opName, pattern>; 1046 1047class SOPC_64_32<string opName, list<dag> pattern = []> 1048 : SOPC_Base<SSrc_b64, SSrc_b32, opName, pattern>; 1049 1050def S_CMP_EQ_I32 : SOPC_CMP_32 <"s_cmp_eq_i32">; 1051def S_CMP_LG_I32 : SOPC_CMP_32 <"s_cmp_lg_i32">; 1052def S_CMP_GT_I32 : SOPC_CMP_32 <"s_cmp_gt_i32", COND_SGT>; 1053def S_CMP_GE_I32 : SOPC_CMP_32 <"s_cmp_ge_i32", COND_SGE>; 1054def S_CMP_LT_I32 : SOPC_CMP_32 <"s_cmp_lt_i32", COND_SLT, "s_cmp_gt_i32">; 1055def S_CMP_LE_I32 : SOPC_CMP_32 <"s_cmp_le_i32", COND_SLE, "s_cmp_ge_i32">; 1056def S_CMP_EQ_U32 : SOPC_CMP_32 <"s_cmp_eq_u32", COND_EQ>; 1057def S_CMP_LG_U32 : SOPC_CMP_32 <"s_cmp_lg_u32", COND_NE>; 1058def S_CMP_GT_U32 : SOPC_CMP_32 <"s_cmp_gt_u32", COND_UGT>; 1059def S_CMP_GE_U32 : SOPC_CMP_32 <"s_cmp_ge_u32", COND_UGE>; 1060def S_CMP_LT_U32 : SOPC_CMP_32 <"s_cmp_lt_u32", COND_ULT, "s_cmp_gt_u32">; 1061def S_CMP_LE_U32 : SOPC_CMP_32 <"s_cmp_le_u32", COND_ULE, "s_cmp_ge_u32">; 1062 1063def S_BITCMP0_B32 : SOPC_32 <"s_bitcmp0_b32">; 1064def S_BITCMP1_B32 : SOPC_32 <"s_bitcmp1_b32">; 1065def S_BITCMP0_B64 : SOPC_64_32 <"s_bitcmp0_b64">; 1066def S_BITCMP1_B64 : SOPC_64_32 <"s_bitcmp1_b64">; 1067let SubtargetPredicate = isGFX6GFX7GFX8GFX9 in 1068def S_SETVSKIP : SOPC_32 <"s_setvskip">; 1069 1070let SubtargetPredicate = isGFX8Plus in { 1071def S_CMP_EQ_U64 : SOPC_CMP_64 <"s_cmp_eq_u64", COND_EQ>; 1072def S_CMP_LG_U64 : SOPC_CMP_64 <"s_cmp_lg_u64", COND_NE>; 1073} // End SubtargetPredicate = isGFX8Plus 1074 1075let SubtargetPredicate = HasVGPRIndexMode in { 1076// Setting the GPR index mode is really writing the fields in the mode 1077// register. We don't want to add mode register uses to every 1078// instruction, and it's too complicated to deal with anyway. This is 1079// modeled just as a side effect. 1080def S_SET_GPR_IDX_ON : SOPC_Pseudo < 1081 "s_set_gpr_idx_on" , 1082 (outs), 1083 (ins SSrc_b32:$src0, GPRIdxMode:$src1), 1084 "$src0, $src1"> { 1085 let Defs = [M0, MODE]; // No scc def 1086 let Uses = [M0, MODE]; // Other bits of mode, m0 unmodified. 1087 let hasSideEffects = 1; // Sets mode.gpr_idx_en 1088 let FixedSize = 1; 1089} 1090} 1091 1092//===----------------------------------------------------------------------===// 1093// SOPP Instructions 1094//===----------------------------------------------------------------------===// 1095 1096class SOPP_Pseudo<string opName, dag ins, 1097 string asmOps = "", list<dag> pattern=[], 1098 string sep = !if(!empty(asmOps), "", " "), 1099 string keyName = opName> : 1100 SOP_Pseudo<opName, (outs), ins, sep # asmOps, pattern> { 1101 let mayLoad = 0; 1102 let mayStore = 0; 1103 let hasSideEffects = 0; 1104 let SALU = 1; 1105 let SOPP = 1; 1106 let FixedSize = 1; 1107 let SchedRW = [WriteSALU]; 1108 let UseNamedOperandTable = 1; 1109 bits <16> simm16; 1110 bits <1> fixed_imm = 0; 1111 string KeyName = keyName; 1112} 1113 1114class SOPPRelaxTable <bit isRelaxed, string keyName, string gfxip> { 1115 bit IsRelaxed = isRelaxed; 1116 string KeyName = keyName # gfxip; 1117} 1118 1119class SOPP_Real<SOPP_Pseudo ps, string real_name = ps.Mnemonic> : 1120 InstSI <ps.OutOperandList, ps.InOperandList, 1121 real_name # ps.AsmOperands> { 1122 let SALU = 1; 1123 let SOPP = 1; 1124 let isPseudo = 0; 1125 let isCodeGenOnly = 0; 1126 1127 // copy relevant pseudo op flags 1128 let SubtargetPredicate = ps.SubtargetPredicate; 1129 let OtherPredicates = ps.OtherPredicates; 1130 let AsmMatchConverter = ps.AsmMatchConverter; 1131 let UseNamedOperandTable = ps.UseNamedOperandTable; 1132 let TSFlags = ps.TSFlags; 1133 let SchedRW = ps.SchedRW; 1134 let mayLoad = ps.mayLoad; 1135 let mayStore = ps.mayStore; 1136 bits <16> simm16; 1137} 1138 1139class SOPP_Real_32 <bits<7> op, SOPP_Pseudo ps, string real_name = ps.Mnemonic> : SOPP_Real<ps, real_name>, 1140Enc32 { 1141 let Inst{15-0} = !if(ps.fixed_imm, ps.simm16, simm16); 1142 let Inst{22-16} = op; 1143 let Inst{31-23} = 0x17f; 1144} 1145 1146class SOPP_Real_64 <bits<7> op, SOPP_Pseudo ps, string real_name = ps.Mnemonic> : SOPP_Real<ps, real_name>, 1147Enc64 { 1148 // encoding 1149 let Inst{15-0} = !if(ps.fixed_imm, ps.simm16, simm16); 1150 let Inst{22-16} = op; 1151 let Inst{31-23} = 0x17f; 1152 //effectively a nop 1153 let Inst{47-32} = 0x0; 1154 let Inst{54-48} = 0x0; 1155 let Inst{63-55} = 0x17f; 1156} 1157 1158multiclass SOPP_With_Relaxation <string opName, dag ins, 1159 string asmOps, list<dag> pattern=[]> { 1160 def "" : SOPP_Pseudo <opName, ins, asmOps, pattern>; 1161 def _pad_s_nop : SOPP_Pseudo <opName # "_pad_s_nop", ins, asmOps, pattern, " ", opName>; 1162} 1163 1164def S_NOP : SOPP_Pseudo<"s_nop" , (ins i16imm:$simm16), "$simm16">; 1165 1166let isTerminator = 1 in { 1167def S_ENDPGM : SOPP_Pseudo<"s_endpgm", (ins Endpgm:$simm16), "$simm16", [], ""> { 1168 let isBarrier = 1; 1169 let isReturn = 1; 1170 let hasSideEffects = 1; 1171} 1172 1173def S_ENDPGM_SAVED : SOPP_Pseudo<"s_endpgm_saved", (ins)> { 1174 let SubtargetPredicate = isGFX8Plus; 1175 let simm16 = 0; 1176 let fixed_imm = 1; 1177 let isBarrier = 1; 1178 let isReturn = 1; 1179} 1180 1181let SubtargetPredicate = isGFX9GFX10 in { 1182 let isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 in { 1183 def S_ENDPGM_ORDERED_PS_DONE : 1184 SOPP_Pseudo<"s_endpgm_ordered_ps_done", (ins)>; 1185 } // End isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 1186} // End SubtargetPredicate = isGFX9GFX10 1187 1188let SubtargetPredicate = isGFX10Plus in { 1189 let isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 in { 1190 def S_CODE_END : 1191 SOPP_Pseudo<"s_code_end", (ins)>; 1192 } // End isBarrier = 1, isReturn = 1, simm16 = 0, fixed_imm = 1 1193} // End SubtargetPredicate = isGFX10Plus 1194 1195let isBranch = 1, SchedRW = [WriteBranch] in { 1196let isBarrier = 1 in { 1197defm S_BRANCH : SOPP_With_Relaxation< 1198 "s_branch" , (ins SOPPBrTarget:$simm16), "$simm16", 1199 [(br bb:$simm16)]>; 1200} 1201 1202let Uses = [SCC] in { 1203defm S_CBRANCH_SCC0 : SOPP_With_Relaxation< 1204 "s_cbranch_scc0" , (ins SOPPBrTarget:$simm16), 1205 "$simm16" 1206>; 1207defm S_CBRANCH_SCC1 : SOPP_With_Relaxation < 1208 "s_cbranch_scc1" , (ins SOPPBrTarget:$simm16), 1209 "$simm16" 1210>; 1211} // End Uses = [SCC] 1212 1213let Uses = [VCC] in { 1214defm S_CBRANCH_VCCZ : SOPP_With_Relaxation < 1215 "s_cbranch_vccz" , (ins SOPPBrTarget:$simm16), 1216 "$simm16" 1217>; 1218defm S_CBRANCH_VCCNZ : SOPP_With_Relaxation < 1219 "s_cbranch_vccnz" , (ins SOPPBrTarget:$simm16), 1220 "$simm16" 1221>; 1222} // End Uses = [VCC] 1223 1224let Uses = [EXEC] in { 1225defm S_CBRANCH_EXECZ : SOPP_With_Relaxation < 1226 "s_cbranch_execz" , (ins SOPPBrTarget:$simm16), 1227 "$simm16" 1228>; 1229defm S_CBRANCH_EXECNZ : SOPP_With_Relaxation < 1230 "s_cbranch_execnz" , (ins SOPPBrTarget:$simm16), 1231 "$simm16" 1232>; 1233} // End Uses = [EXEC] 1234 1235defm S_CBRANCH_CDBGSYS : SOPP_With_Relaxation < 1236 "s_cbranch_cdbgsys" , (ins SOPPBrTarget:$simm16), 1237 "$simm16" 1238>; 1239 1240defm S_CBRANCH_CDBGSYS_AND_USER : SOPP_With_Relaxation < 1241 "s_cbranch_cdbgsys_and_user" , (ins SOPPBrTarget:$simm16), 1242 "$simm16" 1243>; 1244 1245defm S_CBRANCH_CDBGSYS_OR_USER : SOPP_With_Relaxation < 1246 "s_cbranch_cdbgsys_or_user" , (ins SOPPBrTarget:$simm16), 1247 "$simm16" 1248>; 1249 1250defm S_CBRANCH_CDBGUSER : SOPP_With_Relaxation < 1251 "s_cbranch_cdbguser" , (ins SOPPBrTarget:$simm16), 1252 "$simm16" 1253>; 1254 1255} // End isBranch = 1 1256} // End isTerminator = 1 1257 1258let hasSideEffects = 1 in { 1259def S_BARRIER : SOPP_Pseudo <"s_barrier", (ins), "", 1260 [(int_amdgcn_s_barrier)]> { 1261 let SchedRW = [WriteBarrier]; 1262 let simm16 = 0; 1263 let fixed_imm = 1; 1264 let isConvergent = 1; 1265} 1266 1267def S_WAKEUP : SOPP_Pseudo <"s_wakeup", (ins) > { 1268 let SubtargetPredicate = isGFX8Plus; 1269 let simm16 = 0; 1270 let fixed_imm = 1; 1271 let mayLoad = 1; 1272 let mayStore = 1; 1273} 1274 1275let hasSideEffects = 1 in 1276def S_WAITCNT : SOPP_Pseudo <"s_waitcnt" , (ins SWaitCnt:$simm16), "$simm16", 1277 [(int_amdgcn_s_waitcnt timm:$simm16)]>; 1278def S_SETHALT : SOPP_Pseudo <"s_sethalt" , (ins i32imm:$simm16), "$simm16", 1279 [(int_amdgcn_s_sethalt timm:$simm16)]>; 1280def S_SETKILL : SOPP_Pseudo <"s_setkill" , (ins i16imm:$simm16), "$simm16">; 1281 1282// On SI the documentation says sleep for approximately 64 * low 2 1283// bits, consistent with the reported maximum of 448. On VI the 1284// maximum reported is 960 cycles, so 960 / 64 = 15 max, so is the 1285// maximum really 15 on VI? 1286def S_SLEEP : SOPP_Pseudo <"s_sleep", (ins i32imm:$simm16), 1287 "$simm16", [(int_amdgcn_s_sleep timm:$simm16)]> { 1288 let hasSideEffects = 1; 1289} 1290 1291def S_SETPRIO : SOPP_Pseudo <"s_setprio", (ins i16imm:$simm16), "$simm16", 1292 [(int_amdgcn_s_setprio timm:$simm16)]> { 1293 let hasSideEffects = 1; 1294} 1295 1296let Uses = [EXEC, M0] in { 1297def S_SENDMSG : SOPP_Pseudo <"s_sendmsg" , (ins SendMsg:$simm16), "$simm16", 1298 [(int_amdgcn_s_sendmsg (i32 timm:$simm16), M0)]> { 1299 let hasSideEffects = 1; 1300} 1301 1302def S_SENDMSGHALT : SOPP_Pseudo <"s_sendmsghalt" , (ins SendMsg:$simm16), "$simm16", 1303 [(int_amdgcn_s_sendmsghalt (i32 timm:$simm16), M0)]> { 1304 let hasSideEffects = 1; 1305} 1306 1307} // End Uses = [EXEC, M0] 1308 1309def S_TRAP : SOPP_Pseudo <"s_trap" , (ins i16imm:$simm16), "$simm16"> { 1310 let isTrap = 1; 1311} 1312 1313def S_ICACHE_INV : SOPP_Pseudo <"s_icache_inv", (ins)> { 1314 let simm16 = 0; 1315 let fixed_imm = 1; 1316} 1317def S_INCPERFLEVEL : SOPP_Pseudo <"s_incperflevel", (ins i32imm:$simm16), "$simm16", 1318 [(int_amdgcn_s_incperflevel timm:$simm16)]> { 1319 let hasSideEffects = 1; 1320} 1321def S_DECPERFLEVEL : SOPP_Pseudo <"s_decperflevel", (ins i32imm:$simm16), "$simm16", 1322 [(int_amdgcn_s_decperflevel timm:$simm16)]> { 1323 let hasSideEffects = 1; 1324} 1325def S_TTRACEDATA : SOPP_Pseudo <"s_ttracedata", (ins)> { 1326 let simm16 = 0; 1327 let fixed_imm = 1; 1328} 1329 1330let SubtargetPredicate = HasVGPRIndexMode in { 1331def S_SET_GPR_IDX_OFF : SOPP_Pseudo<"s_set_gpr_idx_off", (ins) > { 1332 let simm16 = 0; 1333 let fixed_imm = 1; 1334 let Defs = [MODE]; 1335 let Uses = [MODE]; 1336} 1337} 1338} // End hasSideEffects 1339 1340let SubtargetPredicate = HasVGPRIndexMode in { 1341def S_SET_GPR_IDX_MODE : SOPP_Pseudo<"s_set_gpr_idx_mode", (ins GPRIdxMode:$simm16), 1342 "$simm16"> { 1343 let Defs = [M0, MODE]; 1344 let Uses = [MODE]; 1345} 1346} 1347 1348let SubtargetPredicate = isGFX10Plus in { 1349 def S_INST_PREFETCH : 1350 SOPP_Pseudo<"s_inst_prefetch", (ins s16imm:$simm16), "$simm16">; 1351 def S_CLAUSE : 1352 SOPP_Pseudo<"s_clause", (ins s16imm:$simm16), "$simm16">; 1353 def S_WAIT_IDLE : 1354 SOPP_Pseudo <"s_wait_idle", (ins)> { 1355 let simm16 = 0; 1356 let fixed_imm = 1; 1357 } 1358 def S_WAITCNT_DEPCTR : 1359 SOPP_Pseudo <"s_waitcnt_depctr" , (ins DepCtr:$simm16), "$simm16">; 1360 1361 let hasSideEffects = 0, Uses = [MODE], Defs = [MODE] in { 1362 def S_ROUND_MODE : 1363 SOPP_Pseudo<"s_round_mode", (ins s16imm:$simm16), "$simm16">; 1364 def S_DENORM_MODE : 1365 SOPP_Pseudo<"s_denorm_mode", (ins i32imm:$simm16), "$simm16", 1366 [(SIdenorm_mode (i32 timm:$simm16))]>; 1367 } 1368 1369 def S_TTRACEDATA_IMM : 1370 SOPP_Pseudo<"s_ttracedata_imm", (ins s16imm:$simm16), "$simm16">; 1371} // End SubtargetPredicate = isGFX10Plus 1372 1373let SubtargetPredicate = isGFX11Plus in { 1374 def S_WAIT_EVENT : SOPP_Pseudo<"s_wait_event", (ins s16imm:$simm16), 1375 "$simm16"> { 1376 let hasSideEffects = 1; 1377 } 1378 def S_DELAY_ALU : SOPP_Pseudo<"s_delay_alu", (ins SDelayALU:$simm16), 1379 "$simm16">; 1380} // End SubtargetPredicate = isGFX11Plus 1381 1382//===----------------------------------------------------------------------===// 1383// SOP1 Patterns 1384//===----------------------------------------------------------------------===// 1385 1386def : GCNPat < 1387 (AMDGPUendpgm), 1388 (S_ENDPGM (i16 0)) 1389>; 1390 1391def : GCNPat < 1392 (int_amdgcn_endpgm), 1393 (S_ENDPGM (i16 0)) 1394>; 1395 1396def : GCNPat < 1397 (i64 (UniformUnaryFrag<ctpop> i64:$src)), 1398 (i64 (REG_SEQUENCE SReg_64, 1399 (i32 (COPY_TO_REGCLASS (S_BCNT1_I32_B64 $src), SReg_32)), sub0, 1400 (S_MOV_B32 (i32 0)), sub1)) 1401>; 1402 1403def : GCNPat < 1404 (i32 (UniformBinFrag<smax> i32:$x, (i32 (ineg i32:$x)))), 1405 (S_ABS_I32 SReg_32:$x) 1406>; 1407 1408def : GCNPat < 1409 (i16 imm:$imm), 1410 (S_MOV_B32 imm:$imm) 1411>; 1412 1413// Same as a 32-bit inreg 1414def : GCNPat< 1415 (i32 (UniformUnaryFrag<sext> i16:$src)), 1416 (S_SEXT_I32_I16 $src) 1417>; 1418 1419def : GCNPat < 1420 (int_amdgcn_s_wait_event_export_ready), 1421 (S_WAIT_EVENT (i16 0)) 1422>; 1423 1424//===----------------------------------------------------------------------===// 1425// SOP2 Patterns 1426//===----------------------------------------------------------------------===// 1427 1428// V_ADD_I32_e32/S_ADD_U32 produces carry in VCC/SCC. For the vector 1429// case, the sgpr-copies pass will fix this to use the vector version. 1430def : GCNPat < 1431 (i32 (addc i32:$src0, i32:$src1)), 1432 (S_ADD_U32 $src0, $src1) 1433>; 1434 1435// FIXME: We need to use COPY_TO_REGCLASS to work-around the fact that 1436// REG_SEQUENCE patterns don't support instructions with multiple 1437// outputs. 1438def : GCNPat< 1439 (i64 (UniformUnaryFrag<zext> i16:$src)), 1440 (REG_SEQUENCE SReg_64, 1441 (i32 (COPY_TO_REGCLASS (S_AND_B32 $src, (S_MOV_B32 (i32 0xffff))), SGPR_32)), sub0, 1442 (S_MOV_B32 (i32 0)), sub1) 1443>; 1444 1445def : GCNPat < 1446 (i64 (UniformUnaryFrag<sext> i16:$src)), 1447 (REG_SEQUENCE SReg_64, (i32 (S_SEXT_I32_I16 $src)), sub0, 1448 (i32 (COPY_TO_REGCLASS (S_ASHR_I32 (i32 (S_SEXT_I32_I16 $src)), (S_MOV_B32 (i32 31))), SGPR_32)), sub1) 1449>; 1450 1451def : GCNPat< 1452 (i32 (UniformUnaryFrag<zext> i16:$src)), 1453 (S_AND_B32 (S_MOV_B32 (i32 0xffff)), $src) 1454>; 1455 1456// FIXME: ValueType should have isVector field 1457class ScalarNot2Pat<Instruction inst, SDPatternOperator op, ValueType vt, 1458 bit isVector = 1> : GCNPat< 1459 (UniformBinFrag<op> vt:$src0, (UniformUnaryFrag<!if(isVector, vnot, not)> vt:$src1)), 1460 (inst getSOPSrcForVT<vt>.ret:$src0, getSOPSrcForVT<vt>.ret:$src1) 1461>; 1462 1463// Match these for some more types 1464// TODO: i1 1465def : ScalarNot2Pat<S_ANDN2_B32, and, i16, 0>; 1466def : ScalarNot2Pat<S_ANDN2_B32, and, v2i16>; 1467def : ScalarNot2Pat<S_ANDN2_B64, and, v4i16>; 1468def : ScalarNot2Pat<S_ANDN2_B64, and, v2i32>; 1469 1470def : ScalarNot2Pat<S_ORN2_B32, or, i16, 0>; 1471def : ScalarNot2Pat<S_ORN2_B32, or, v2i16>; 1472def : ScalarNot2Pat<S_ORN2_B64, or, v4i16>; 1473def : ScalarNot2Pat<S_ORN2_B64, or, v2i32>; 1474 1475//===----------------------------------------------------------------------===// 1476// Target-specific instruction encodings. 1477//===----------------------------------------------------------------------===// 1478 1479class Select_gfx11<string opName> : SIMCInstr<opName, SIEncodingFamily.GFX11> { 1480 Predicate AssemblerPredicate = isGFX11Only; 1481 string DecoderNamespace = "GFX11"; 1482} 1483 1484class Select_gfx10<string opName> : SIMCInstr<opName, SIEncodingFamily.GFX10> { 1485 Predicate AssemblerPredicate = isGFX10Only; 1486 string DecoderNamespace = "GFX10"; 1487} 1488 1489class Select_vi<string opName> : SIMCInstr<opName, SIEncodingFamily.VI> { 1490 Predicate AssemblerPredicate = isGFX8GFX9; 1491 string DecoderNamespace = "GFX8"; 1492} 1493 1494class Select_gfx6_gfx7<string opName> : SIMCInstr<opName, SIEncodingFamily.SI> { 1495 Predicate AssemblerPredicate = isGFX6GFX7; 1496 string DecoderNamespace = "GFX6GFX7"; 1497} 1498 1499//===----------------------------------------------------------------------===// 1500// GFX11. 1501//===----------------------------------------------------------------------===// 1502 1503multiclass SOP1_Real_gfx11<bits<8> op> { 1504 def _gfx11 : SOP1_Real<op, !cast<SOP1_Pseudo>(NAME)>, 1505 Select_gfx11<!cast<SOP1_Pseudo>(NAME).Mnemonic>; 1506} 1507 1508multiclass SOP1_Real_Renamed_gfx11<bits<8> op, SOP1_Pseudo backing_pseudo, string real_name> { 1509 def _gfx11 : SOP1_Real<op, backing_pseudo, real_name>, 1510 Select_gfx11<backing_pseudo.Mnemonic>, 1511 MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX11Plus]>; 1512} 1513 1514defm S_MOV_B32 : SOP1_Real_gfx11<0x000>; 1515defm S_MOV_B64 : SOP1_Real_gfx11<0x001>; 1516defm S_CMOV_B32 : SOP1_Real_gfx11<0x002>; 1517defm S_CMOV_B64 : SOP1_Real_gfx11<0x003>; 1518defm S_BREV_B32 : SOP1_Real_gfx11<0x004>; 1519defm S_BREV_B64 : SOP1_Real_gfx11<0x005>; 1520defm S_CTZ_I32_B32 : SOP1_Real_Renamed_gfx11<0x008, S_FF1_I32_B32, "s_ctz_i32_b32">; 1521defm S_CTZ_I32_B64 : SOP1_Real_Renamed_gfx11<0x009, S_FF1_I32_B64, "s_ctz_i32_b64">; 1522defm S_CLZ_I32_U32 : SOP1_Real_Renamed_gfx11<0x00a, S_FLBIT_I32_B32, "s_clz_i32_u32">; 1523defm S_CLZ_I32_U64 : SOP1_Real_Renamed_gfx11<0x00b, S_FLBIT_I32_B64, "s_clz_i32_u64">; 1524defm S_CLS_I32 : SOP1_Real_Renamed_gfx11<0x00c, S_FLBIT_I32, "s_cls_i32">; 1525defm S_CLS_I32_I64 : SOP1_Real_Renamed_gfx11<0x00d, S_FLBIT_I32_I64, "s_cls_i32_i64">; 1526defm S_SEXT_I32_I8 : SOP1_Real_gfx11<0x00e>; 1527defm S_SEXT_I32_I16 : SOP1_Real_gfx11<0x00f>; 1528defm S_BITSET0_B32 : SOP1_Real_gfx11<0x010>; 1529defm S_BITSET0_B64 : SOP1_Real_gfx11<0x011>; 1530defm S_BITSET1_B32 : SOP1_Real_gfx11<0x012>; 1531defm S_BITSET1_B64 : SOP1_Real_gfx11<0x013>; 1532defm S_BITREPLICATE_B64_B32 : SOP1_Real_gfx11<0x014>; 1533defm S_ABS_I32 : SOP1_Real_gfx11<0x015>; 1534defm S_BCNT0_I32_B32 : SOP1_Real_gfx11<0x016>; 1535defm S_BCNT0_I32_B64 : SOP1_Real_gfx11<0x017>; 1536defm S_BCNT1_I32_B32 : SOP1_Real_gfx11<0x018>; 1537defm S_BCNT1_I32_B64 : SOP1_Real_gfx11<0x019>; 1538defm S_QUADMASK_B32 : SOP1_Real_gfx11<0x01a>; 1539defm S_QUADMASK_B64 : SOP1_Real_gfx11<0x01b>; 1540defm S_WQM_B32 : SOP1_Real_gfx11<0x01c>; 1541defm S_WQM_B64 : SOP1_Real_gfx11<0x01d>; 1542defm S_NOT_B32 : SOP1_Real_gfx11<0x01e>; 1543defm S_NOT_B64 : SOP1_Real_gfx11<0x01f>; 1544defm S_AND_SAVEEXEC_B32 : SOP1_Real_gfx11<0x020>; 1545defm S_AND_SAVEEXEC_B64 : SOP1_Real_gfx11<0x021>; 1546defm S_OR_SAVEEXEC_B32 : SOP1_Real_gfx11<0x022>; 1547defm S_OR_SAVEEXEC_B64 : SOP1_Real_gfx11<0x023>; 1548defm S_XOR_SAVEEXEC_B32 : SOP1_Real_gfx11<0x024>; 1549defm S_XOR_SAVEEXEC_B64 : SOP1_Real_gfx11<0x025>; 1550defm S_NAND_SAVEEXEC_B32 : SOP1_Real_gfx11<0x026>; 1551defm S_NAND_SAVEEXEC_B64 : SOP1_Real_gfx11<0x027>; 1552defm S_NOR_SAVEEXEC_B32 : SOP1_Real_gfx11<0x028>; 1553defm S_NOR_SAVEEXEC_B64 : SOP1_Real_gfx11<0x029>; 1554defm S_XNOR_SAVEEXEC_B32 : SOP1_Real_gfx11<0x02a>; 1555/*defm S_XNOR_SAVEEXEC_B64 : SOP1_Real_gfx11<0x02b>; //same as older arch, handled there*/ 1556defm S_AND_NOT0_SAVEEXEC_B32 : SOP1_Real_Renamed_gfx11<0x02c, S_ANDN1_SAVEEXEC_B32, "s_and_not0_saveexec_b32">; 1557defm S_AND_NOT0_SAVEEXEC_B64 : SOP1_Real_Renamed_gfx11<0x02d, S_ANDN1_SAVEEXEC_B64, "s_and_not0_saveexec_b64">; 1558defm S_OR_NOT0_SAVEEXEC_B32 : SOP1_Real_Renamed_gfx11<0x02e, S_ORN1_SAVEEXEC_B32, "s_or_not0_saveexec_b32">; 1559defm S_OR_NOT0_SAVEEXEC_B64 : SOP1_Real_Renamed_gfx11<0x02f, S_ORN1_SAVEEXEC_B64, "s_or_not0_saveexec_b64">; 1560defm S_AND_NOT1_SAVEEXEC_B32 : SOP1_Real_Renamed_gfx11<0x030, S_ANDN2_SAVEEXEC_B32, "s_and_not1_saveexec_b32">; 1561defm S_AND_NOT1_SAVEEXEC_B64 : SOP1_Real_Renamed_gfx11<0x031, S_ANDN2_SAVEEXEC_B64, "s_and_not1_saveexec_b64">; 1562defm S_OR_NOT1_SAVEEXEC_B32 : SOP1_Real_Renamed_gfx11<0x032, S_ORN2_SAVEEXEC_B32, "s_or_not1_saveexec_b32">; 1563defm S_OR_NOT1_SAVEEXEC_B64 : SOP1_Real_Renamed_gfx11<0x033, S_ORN2_SAVEEXEC_B64, "s_or_not1_saveexec_b64">; 1564defm S_AND_NOT0_WREXEC_B32 : SOP1_Real_Renamed_gfx11<0x034, S_ANDN1_WREXEC_B32, "s_and_not0_wrexec_b32">; 1565defm S_AND_NOT0_WREXEC_B64 : SOP1_Real_Renamed_gfx11<0x035, S_ANDN1_WREXEC_B64, "s_and_not0_wrexec_b64">; 1566defm S_AND_NOT1_WREXEC_B32 : SOP1_Real_Renamed_gfx11<0x036, S_ANDN2_WREXEC_B32, "s_and_not1_wrexec_b32">; 1567defm S_AND_NOT1_WREXEC_B64 : SOP1_Real_Renamed_gfx11<0x037, S_ANDN2_WREXEC_B64, "s_and_not1_wrexec_b64">; 1568defm S_MOVRELS_B32 : SOP1_Real_gfx11<0x040>; 1569defm S_MOVRELS_B64 : SOP1_Real_gfx11<0x041>; 1570defm S_MOVRELD_B32 : SOP1_Real_gfx11<0x042>; 1571defm S_MOVRELD_B64 : SOP1_Real_gfx11<0x043>; 1572defm S_MOVRELSD_2_B32 : SOP1_Real_gfx11<0x044>; 1573defm S_GETPC_B64 : SOP1_Real_gfx11<0x047>; 1574defm S_SETPC_B64 : SOP1_Real_gfx11<0x048>; 1575defm S_SWAPPC_B64 : SOP1_Real_gfx11<0x049>; 1576defm S_RFE_B64 : SOP1_Real_gfx11<0x04a>; 1577defm S_SENDMSG_RTN_B32 : SOP1_Real_gfx11<0x04c>; 1578defm S_SENDMSG_RTN_B64 : SOP1_Real_gfx11<0x04d>; 1579 1580//===----------------------------------------------------------------------===// 1581// SOP1 - GFX10. 1582//===----------------------------------------------------------------------===// 1583 1584multiclass SOP1_Real_gfx10<bits<8> op> { 1585 defvar ps = !cast<SOP1_Pseudo>(NAME); 1586 def _gfx10 : SOP1_Real<op, ps>, 1587 Select_gfx10<ps.Mnemonic>; 1588} 1589 1590multiclass SOP1_Real_gfx10_gfx11<bits<8> op> : 1591 SOP1_Real_gfx10<op>, SOP1_Real_gfx11<op>; 1592 1593defm S_ANDN1_SAVEEXEC_B64 : SOP1_Real_gfx10<0x037>; 1594defm S_ORN1_SAVEEXEC_B64 : SOP1_Real_gfx10<0x038>; 1595defm S_ANDN1_WREXEC_B64 : SOP1_Real_gfx10<0x039>; 1596defm S_ANDN2_WREXEC_B64 : SOP1_Real_gfx10<0x03a>; 1597defm S_BITREPLICATE_B64_B32 : SOP1_Real_gfx10<0x03b>; 1598defm S_AND_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03c>; 1599defm S_OR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03d>; 1600defm S_XOR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03e>; 1601defm S_ANDN2_SAVEEXEC_B32 : SOP1_Real_gfx10<0x03f>; 1602defm S_ORN2_SAVEEXEC_B32 : SOP1_Real_gfx10<0x040>; 1603defm S_NAND_SAVEEXEC_B32 : SOP1_Real_gfx10<0x041>; 1604defm S_NOR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x042>; 1605defm S_XNOR_SAVEEXEC_B32 : SOP1_Real_gfx10<0x043>; 1606defm S_ANDN1_SAVEEXEC_B32 : SOP1_Real_gfx10<0x044>; 1607defm S_ORN1_SAVEEXEC_B32 : SOP1_Real_gfx10<0x045>; 1608defm S_ANDN1_WREXEC_B32 : SOP1_Real_gfx10<0x046>; 1609defm S_ANDN2_WREXEC_B32 : SOP1_Real_gfx10<0x047>; 1610defm S_MOVRELSD_2_B32 : SOP1_Real_gfx10<0x049>; 1611 1612//===----------------------------------------------------------------------===// 1613// SOP1 - GFX6, GFX7, GFX10, GFX11. 1614//===----------------------------------------------------------------------===// 1615 1616 1617multiclass SOP1_Real_gfx6_gfx7<bits<8> op> { 1618 defvar ps = !cast<SOP1_Pseudo>(NAME); 1619 def _gfx6_gfx7 : SOP1_Real<op, ps>, 1620 Select_gfx6_gfx7<ps.Mnemonic>; 1621} 1622 1623multiclass SOP1_Real_gfx6_gfx7_gfx10<bits<8> op> : 1624 SOP1_Real_gfx6_gfx7<op>, SOP1_Real_gfx10<op>; 1625 1626multiclass SOP1_Real_gfx6_gfx7_gfx10_gfx11<bits<8> op> : 1627 SOP1_Real_gfx6_gfx7<op>, SOP1_Real_gfx10_gfx11<op>; 1628 1629defm S_CBRANCH_JOIN : SOP1_Real_gfx6_gfx7<0x032>; 1630 1631defm S_MOV_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x003>; 1632defm S_MOV_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x004>; 1633defm S_CMOV_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x005>; 1634defm S_CMOV_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x006>; 1635defm S_NOT_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x007>; 1636defm S_NOT_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x008>; 1637defm S_WQM_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x009>; 1638defm S_WQM_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x00a>; 1639defm S_BREV_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x00b>; 1640defm S_BREV_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x00c>; 1641defm S_BCNT0_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x00d>; 1642defm S_BCNT0_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x00e>; 1643defm S_BCNT1_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x00f>; 1644defm S_BCNT1_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x010>; 1645defm S_FF0_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x011>; 1646defm S_FF0_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x012>; 1647defm S_FF1_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x013>; 1648defm S_FF1_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x014>; 1649defm S_FLBIT_I32_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x015>; 1650defm S_FLBIT_I32_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x016>; 1651defm S_FLBIT_I32 : SOP1_Real_gfx6_gfx7_gfx10<0x017>; 1652defm S_FLBIT_I32_I64 : SOP1_Real_gfx6_gfx7_gfx10<0x018>; 1653defm S_SEXT_I32_I8 : SOP1_Real_gfx6_gfx7_gfx10<0x019>; 1654defm S_SEXT_I32_I16 : SOP1_Real_gfx6_gfx7_gfx10<0x01a>; 1655defm S_BITSET0_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x01b>; 1656defm S_BITSET0_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x01c>; 1657defm S_BITSET1_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x01d>; 1658defm S_BITSET1_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x01e>; 1659defm S_GETPC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x01f>; 1660defm S_SETPC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x020>; 1661defm S_SWAPPC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x021>; 1662defm S_RFE_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x022>; 1663defm S_AND_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x024>; 1664defm S_OR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x025>; 1665defm S_XOR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x026>; 1666defm S_ANDN2_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x027>; 1667defm S_ORN2_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x028>; 1668defm S_NAND_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x029>; 1669defm S_NOR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x02a>; 1670defm S_XNOR_SAVEEXEC_B64 : SOP1_Real_gfx6_gfx7_gfx10_gfx11<0x02b>; 1671defm S_QUADMASK_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x02c>; 1672defm S_QUADMASK_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x02d>; 1673defm S_MOVRELS_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x02e>; 1674defm S_MOVRELS_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x02f>; 1675defm S_MOVRELD_B32 : SOP1_Real_gfx6_gfx7_gfx10<0x030>; 1676defm S_MOVRELD_B64 : SOP1_Real_gfx6_gfx7_gfx10<0x031>; 1677defm S_ABS_I32 : SOP1_Real_gfx6_gfx7_gfx10<0x034>; 1678 1679//===----------------------------------------------------------------------===// 1680// SOP2 - GFX11. 1681//===----------------------------------------------------------------------===// 1682 1683multiclass SOP2_Real_gfx11<bits<7> op> { 1684 def _gfx11 : SOP2_Real<op, !cast<SOP2_Pseudo>(NAME)>, 1685 Select_gfx11<!cast<SOP2_Pseudo>(NAME).Mnemonic>; 1686} 1687 1688multiclass SOP2_Real_Renamed_gfx11<bits<7> op, SOP2_Pseudo backing_pseudo, string real_name> { 1689 def _gfx11 : SOP2_Real<op, backing_pseudo, real_name>, 1690 Select_gfx11<backing_pseudo.Mnemonic>, 1691 MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX11Plus]>; 1692} 1693 1694defm S_ABSDIFF_I32 : SOP2_Real_gfx11<0x006>; 1695defm S_LSHL_B32 : SOP2_Real_gfx11<0x008>; 1696defm S_LSHL_B64 : SOP2_Real_gfx11<0x009>; 1697defm S_LSHR_B32 : SOP2_Real_gfx11<0x00a>; 1698defm S_LSHR_B64 : SOP2_Real_gfx11<0x00b>; 1699defm S_ASHR_I32 : SOP2_Real_gfx11<0x00c>; 1700defm S_ASHR_I64 : SOP2_Real_gfx11<0x00d>; 1701defm S_LSHL1_ADD_U32 : SOP2_Real_gfx11<0x00e>; 1702defm S_LSHL2_ADD_U32 : SOP2_Real_gfx11<0x00f>; 1703defm S_LSHL3_ADD_U32 : SOP2_Real_gfx11<0x010>; 1704defm S_LSHL4_ADD_U32 : SOP2_Real_gfx11<0x011>; 1705defm S_MIN_I32 : SOP2_Real_gfx11<0x012>; 1706defm S_MIN_U32 : SOP2_Real_gfx11<0x013>; 1707defm S_MAX_I32 : SOP2_Real_gfx11<0x014>; 1708defm S_MAX_U32 : SOP2_Real_gfx11<0x015>; 1709defm S_AND_B32 : SOP2_Real_gfx11<0x016>; 1710defm S_AND_B64 : SOP2_Real_gfx11<0x017>; 1711defm S_OR_B32 : SOP2_Real_gfx11<0x018>; 1712defm S_OR_B64 : SOP2_Real_gfx11<0x019>; 1713defm S_XOR_B32 : SOP2_Real_gfx11<0x01a>; 1714defm S_XOR_B64 : SOP2_Real_gfx11<0x01b>; 1715defm S_NAND_B32 : SOP2_Real_gfx11<0x01c>; 1716defm S_NAND_B64 : SOP2_Real_gfx11<0x01d>; 1717defm S_NOR_B32 : SOP2_Real_gfx11<0x01e>; 1718defm S_NOR_B64 : SOP2_Real_gfx11<0x01f>; 1719defm S_XNOR_B32 : SOP2_Real_gfx11<0x020>; 1720defm S_XNOR_B64 : SOP2_Real_gfx11<0x021>; 1721defm S_AND_NOT1_B32 : SOP2_Real_Renamed_gfx11<0x022, S_ANDN2_B32, "s_and_not1_b32">; 1722defm S_AND_NOT1_B64 : SOP2_Real_Renamed_gfx11<0x023, S_ANDN2_B64, "s_and_not1_b64">; 1723defm S_OR_NOT1_B32 : SOP2_Real_Renamed_gfx11<0x024, S_ORN2_B32, "s_or_not1_b32">; 1724defm S_OR_NOT1_B64 : SOP2_Real_Renamed_gfx11<0x025, S_ORN2_B64, "s_or_not1_b64">; 1725defm S_BFE_U32 : SOP2_Real_gfx11<0x026>; 1726defm S_BFE_I32 : SOP2_Real_gfx11<0x027>; 1727defm S_BFE_U64 : SOP2_Real_gfx11<0x028>; 1728defm S_BFE_I64 : SOP2_Real_gfx11<0x029>; 1729defm S_BFM_B32 : SOP2_Real_gfx11<0x02a>; 1730defm S_BFM_B64 : SOP2_Real_gfx11<0x02b>; 1731defm S_MUL_I32 : SOP2_Real_gfx11<0x02c>; 1732defm S_MUL_HI_U32 : SOP2_Real_gfx11<0x02d>; 1733defm S_MUL_HI_I32 : SOP2_Real_gfx11<0x02e>; 1734defm S_CSELECT_B32 : SOP2_Real_gfx11<0x030>; 1735defm S_CSELECT_B64 : SOP2_Real_gfx11<0x031>; 1736defm S_PACK_HL_B32_B16 : SOP2_Real_gfx11<0x035>; 1737 1738//===----------------------------------------------------------------------===// 1739// SOP2 - GFX10. 1740//===----------------------------------------------------------------------===// 1741 1742multiclass SOP2_Real_gfx10<bits<7> op> { 1743 defvar ps = !cast<SOP2_Pseudo>(NAME); 1744 def _gfx10 : SOP2_Real<op, ps>, 1745 Select_gfx10<ps.Mnemonic>; 1746} 1747 1748multiclass SOP2_Real_gfx10_gfx11<bits<7> op> : 1749 SOP2_Real_gfx10<op>, SOP2_Real_gfx11<op>; 1750 1751defm S_LSHL1_ADD_U32 : SOP2_Real_gfx10<0x02e>; 1752defm S_LSHL2_ADD_U32 : SOP2_Real_gfx10<0x02f>; 1753defm S_LSHL3_ADD_U32 : SOP2_Real_gfx10<0x030>; 1754defm S_LSHL4_ADD_U32 : SOP2_Real_gfx10<0x031>; 1755defm S_PACK_LL_B32_B16 : SOP2_Real_gfx10_gfx11<0x032>; 1756defm S_PACK_LH_B32_B16 : SOP2_Real_gfx10_gfx11<0x033>; 1757defm S_PACK_HH_B32_B16 : SOP2_Real_gfx10_gfx11<0x034>; 1758defm S_MUL_HI_U32 : SOP2_Real_gfx10<0x035>; 1759defm S_MUL_HI_I32 : SOP2_Real_gfx10<0x036>; 1760 1761//===----------------------------------------------------------------------===// 1762// SOP2 - GFX6, GFX7. 1763//===----------------------------------------------------------------------===// 1764 1765multiclass SOP2_Real_gfx6_gfx7<bits<7> op> { 1766 defvar ps = !cast<SOP_Pseudo>(NAME); 1767 def _gfx6_gfx7 : SOP2_Real<op, ps>, 1768 Select_gfx6_gfx7<ps.Mnemonic>; 1769} 1770 1771multiclass SOP2_Real_gfx6_gfx7_gfx10<bits<7> op> : 1772 SOP2_Real_gfx6_gfx7<op>, SOP2_Real_gfx10<op>; 1773 1774multiclass SOP2_Real_gfx6_gfx7_gfx10_gfx11<bits<7> op> : 1775 SOP2_Real_gfx6_gfx7<op>, SOP2_Real_gfx10_gfx11<op>; 1776 1777defm S_CBRANCH_G_FORK : SOP2_Real_gfx6_gfx7<0x02b>; 1778 1779defm S_ADD_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x000>; 1780defm S_SUB_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x001>; 1781defm S_ADD_I32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x002>; 1782defm S_SUB_I32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x003>; 1783defm S_ADDC_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x004>; 1784defm S_SUBB_U32 : SOP2_Real_gfx6_gfx7_gfx10_gfx11<0x005>; 1785defm S_MIN_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x006>; 1786defm S_MIN_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x007>; 1787defm S_MAX_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x008>; 1788defm S_MAX_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x009>; 1789defm S_CSELECT_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x00a>; 1790defm S_CSELECT_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x00b>; 1791defm S_AND_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x00e>; 1792defm S_AND_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x00f>; 1793defm S_OR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x010>; 1794defm S_OR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x011>; 1795defm S_XOR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x012>; 1796defm S_XOR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x013>; 1797defm S_ANDN2_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x014>; 1798defm S_ANDN2_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x015>; 1799defm S_ORN2_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x016>; 1800defm S_ORN2_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x017>; 1801defm S_NAND_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x018>; 1802defm S_NAND_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x019>; 1803defm S_NOR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x01a>; 1804defm S_NOR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x01b>; 1805defm S_XNOR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x01c>; 1806defm S_XNOR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x01d>; 1807defm S_LSHL_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x01e>; 1808defm S_LSHL_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x01f>; 1809defm S_LSHR_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x020>; 1810defm S_LSHR_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x021>; 1811defm S_ASHR_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x022>; 1812defm S_ASHR_I64 : SOP2_Real_gfx6_gfx7_gfx10<0x023>; 1813defm S_BFM_B32 : SOP2_Real_gfx6_gfx7_gfx10<0x024>; 1814defm S_BFM_B64 : SOP2_Real_gfx6_gfx7_gfx10<0x025>; 1815defm S_MUL_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x026>; 1816defm S_BFE_U32 : SOP2_Real_gfx6_gfx7_gfx10<0x027>; 1817defm S_BFE_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x028>; 1818defm S_BFE_U64 : SOP2_Real_gfx6_gfx7_gfx10<0x029>; 1819defm S_BFE_I64 : SOP2_Real_gfx6_gfx7_gfx10<0x02a>; 1820defm S_ABSDIFF_I32 : SOP2_Real_gfx6_gfx7_gfx10<0x02c>; 1821 1822//===----------------------------------------------------------------------===// 1823// SOPK - GFX11. 1824//===----------------------------------------------------------------------===// 1825 1826multiclass SOPK_Real32_gfx11<bits<5> op> { 1827 def _gfx11 : SOPK_Real32<op, !cast<SOPK_Pseudo>(NAME)>, 1828 Select_gfx11<!cast<SOPK_Pseudo>(NAME).Mnemonic>; 1829} 1830 1831multiclass SOPK_Real64_gfx11<bits<5> op> { 1832 def _gfx11 : SOPK_Real64<op, !cast<SOPK_Pseudo>(NAME)>, 1833 Select_gfx11<!cast<SOPK_Pseudo>(NAME).Mnemonic>; 1834} 1835 1836defm S_GETREG_B32 : SOPK_Real32_gfx11<0x011>; 1837defm S_SETREG_B32 : SOPK_Real32_gfx11<0x012>; 1838defm S_SETREG_IMM32_B32 : SOPK_Real64_gfx11<0x013>; 1839defm S_CALL_B64 : SOPK_Real32_gfx11<0x014>; 1840defm S_SUBVECTOR_LOOP_BEGIN : SOPK_Real32_gfx11<0x016>; 1841defm S_SUBVECTOR_LOOP_END : SOPK_Real32_gfx11<0x017>; 1842defm S_WAITCNT_VSCNT : SOPK_Real32_gfx11<0x018>; 1843defm S_WAITCNT_VMCNT : SOPK_Real32_gfx11<0x019>; 1844defm S_WAITCNT_EXPCNT : SOPK_Real32_gfx11<0x01a>; 1845defm S_WAITCNT_LGKMCNT : SOPK_Real32_gfx11<0x01b>; 1846 1847//===----------------------------------------------------------------------===// 1848// SOPK - GFX10. 1849//===----------------------------------------------------------------------===// 1850 1851multiclass SOPK_Real32_gfx10<bits<5> op> { 1852 defvar ps = !cast<SOPK_Pseudo>(NAME); 1853 def _gfx10 : SOPK_Real32<op, ps>, 1854 Select_gfx10<ps.Mnemonic>; 1855} 1856 1857multiclass SOPK_Real64_gfx10<bits<5> op> { 1858 defvar ps = !cast<SOPK_Pseudo>(NAME); 1859 def _gfx10 : SOPK_Real64<op, ps>, 1860 Select_gfx10<ps.Mnemonic>; 1861} 1862 1863multiclass SOPK_Real32_gfx10_gfx11<bits<5> op> : 1864 SOPK_Real32_gfx10<op>, SOPK_Real32_gfx11<op>; 1865 1866defm S_VERSION : SOPK_Real32_gfx10_gfx11<0x001>; 1867defm S_CALL_B64 : SOPK_Real32_gfx10<0x016>; 1868defm S_WAITCNT_VSCNT : SOPK_Real32_gfx10<0x017>; 1869defm S_WAITCNT_VMCNT : SOPK_Real32_gfx10<0x018>; 1870defm S_WAITCNT_EXPCNT : SOPK_Real32_gfx10<0x019>; 1871defm S_WAITCNT_LGKMCNT : SOPK_Real32_gfx10<0x01a>; 1872defm S_SUBVECTOR_LOOP_BEGIN : SOPK_Real32_gfx10<0x01b>; 1873defm S_SUBVECTOR_LOOP_END : SOPK_Real32_gfx10<0x01c>; 1874 1875//===----------------------------------------------------------------------===// 1876// SOPK - GFX6, GFX7. 1877//===----------------------------------------------------------------------===// 1878 1879multiclass SOPK_Real32_gfx6_gfx7<bits<5> op> { 1880 defvar ps = !cast<SOPK_Pseudo>(NAME); 1881 def _gfx6_gfx7 : SOPK_Real32<op, ps>, 1882 Select_gfx6_gfx7<ps.Mnemonic>; 1883} 1884 1885multiclass SOPK_Real64_gfx6_gfx7<bits<5> op> { 1886 defvar ps = !cast<SOPK_Pseudo>(NAME); 1887 def _gfx6_gfx7 : SOPK_Real64<op, ps>, 1888 Select_gfx6_gfx7<ps.Mnemonic>; 1889} 1890 1891multiclass SOPK_Real32_gfx6_gfx7_gfx10<bits<5> op> : 1892 SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10<op>; 1893 1894multiclass SOPK_Real64_gfx6_gfx7_gfx10<bits<5> op> : 1895 SOPK_Real64_gfx6_gfx7<op>, SOPK_Real64_gfx10<op>; 1896 1897multiclass SOPK_Real32_gfx6_gfx7_gfx10_gfx11<bits<5> op> : 1898 SOPK_Real32_gfx6_gfx7<op>, SOPK_Real32_gfx10_gfx11<op>; 1899 1900defm S_CBRANCH_I_FORK : SOPK_Real32_gfx6_gfx7<0x011>; 1901 1902defm S_MOVK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x000>; 1903defm S_CMOVK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x002>; 1904defm S_CMPK_EQ_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x003>; 1905defm S_CMPK_LG_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x004>; 1906defm S_CMPK_GT_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x005>; 1907defm S_CMPK_GE_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x006>; 1908defm S_CMPK_LT_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x007>; 1909defm S_CMPK_LE_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x008>; 1910defm S_CMPK_EQ_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x009>; 1911defm S_CMPK_LG_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00a>; 1912defm S_CMPK_GT_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00b>; 1913defm S_CMPK_GE_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00c>; 1914defm S_CMPK_LT_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00d>; 1915defm S_CMPK_LE_U32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00e>; 1916defm S_ADDK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x00f>; 1917defm S_MULK_I32 : SOPK_Real32_gfx6_gfx7_gfx10_gfx11<0x010>; 1918defm S_GETREG_B32 : SOPK_Real32_gfx6_gfx7_gfx10<0x012>; 1919defm S_SETREG_B32 : SOPK_Real32_gfx6_gfx7_gfx10<0x013>; 1920defm S_SETREG_IMM32_B32 : SOPK_Real64_gfx6_gfx7_gfx10<0x015>; 1921 1922//===----------------------------------------------------------------------===// 1923// SOPP - GFX11 1924//===----------------------------------------------------------------------===// 1925 1926multiclass SOPP_Real_32_gfx11<bits<7> op> { 1927 def _gfx11 : SOPP_Real_32<op, !cast<SOPP_Pseudo>(NAME), !cast<SOPP_Pseudo>(NAME).Mnemonic>, 1928 Select_gfx11<!cast<SOPP_Pseudo>(NAME).Mnemonic>, 1929 SOPPRelaxTable<0, !cast<SOPP_Pseudo>(NAME).KeyName, "_gfx11">; 1930} 1931 1932multiclass SOPP_Real_64_gfx11<bits<7> op> { 1933 def _gfx11 : SOPP_Real_64<op, !cast<SOPP_Pseudo>(NAME), !cast<SOPP_Pseudo>(NAME).Mnemonic>, 1934 Select_gfx11<!cast<SOPP_Pseudo>(NAME).Mnemonic>, 1935 SOPPRelaxTable<1, !cast<SOPP_Pseudo>(NAME).KeyName, "_gfx11">; 1936} 1937 1938multiclass SOPP_Real_32_Renamed_gfx11<bits<7> op, SOPP_Pseudo backing_pseudo, string real_name> { 1939 def _gfx11 : SOPP_Real_32<op, backing_pseudo, real_name>, 1940 Select_gfx11<backing_pseudo.Mnemonic>, 1941 MnemonicAlias<backing_pseudo.Mnemonic, real_name>, Requires<[isGFX11Plus]>; 1942} 1943 1944multiclass SOPP_Real_With_Relaxation_gfx11<bits<7> op> { 1945 defm "" : SOPP_Real_32_gfx11<op>; 1946 defm _pad_s_nop : SOPP_Real_64_gfx11<op>; 1947} 1948 1949defm S_SETKILL : SOPP_Real_32_gfx11<0x001>; 1950defm S_SETHALT : SOPP_Real_32_gfx11<0x002>; 1951defm S_SLEEP : SOPP_Real_32_gfx11<0x003>; 1952defm S_SET_INST_PREFETCH_DISTANCE : SOPP_Real_32_Renamed_gfx11<0x004, S_INST_PREFETCH, "s_set_inst_prefetch_distance">; 1953defm S_CLAUSE : SOPP_Real_32_gfx11<0x005>; 1954defm S_DELAY_ALU : SOPP_Real_32_gfx11<0x007>; 1955defm S_WAITCNT_DEPCTR : SOPP_Real_32_gfx11<0x008>; 1956defm S_WAITCNT : SOPP_Real_32_gfx11<0x009>; 1957defm S_WAIT_IDLE : SOPP_Real_32_gfx11<0x00a>; 1958defm S_WAIT_EVENT : SOPP_Real_32_gfx11<0x00b>; 1959defm S_TRAP : SOPP_Real_32_gfx11<0x010>; 1960defm S_ROUND_MODE : SOPP_Real_32_gfx11<0x011>; 1961defm S_DENORM_MODE : SOPP_Real_32_gfx11<0x012>; 1962defm S_BRANCH : SOPP_Real_With_Relaxation_gfx11<0x020>; 1963defm S_CBRANCH_SCC0 : SOPP_Real_With_Relaxation_gfx11<0x021>; 1964defm S_CBRANCH_SCC1 : SOPP_Real_With_Relaxation_gfx11<0x022>; 1965defm S_CBRANCH_VCCZ : SOPP_Real_With_Relaxation_gfx11<0x023>; 1966defm S_CBRANCH_VCCNZ : SOPP_Real_With_Relaxation_gfx11<0x024>; 1967defm S_CBRANCH_EXECZ : SOPP_Real_With_Relaxation_gfx11<0x025>; 1968defm S_CBRANCH_EXECNZ : SOPP_Real_With_Relaxation_gfx11<0x026>; 1969defm S_CBRANCH_CDBGSYS : SOPP_Real_With_Relaxation_gfx11<0x027>; 1970defm S_CBRANCH_CDBGUSER : SOPP_Real_With_Relaxation_gfx11<0x028>; 1971defm S_CBRANCH_CDBGSYS_OR_USER : SOPP_Real_With_Relaxation_gfx11<0x029>; 1972defm S_CBRANCH_CDBGSYS_AND_USER : SOPP_Real_With_Relaxation_gfx11<0x02a>; 1973defm S_ENDPGM : SOPP_Real_32_gfx11<0x030>; 1974defm S_ENDPGM_SAVED : SOPP_Real_32_gfx11<0x031>; 1975defm S_WAKEUP : SOPP_Real_32_gfx11<0x034>; 1976defm S_SETPRIO : SOPP_Real_32_gfx11<0x035>; 1977defm S_SENDMSG : SOPP_Real_32_gfx11<0x036>; 1978defm S_SENDMSGHALT : SOPP_Real_32_gfx11<0x037>; 1979defm S_INCPERFLEVEL : SOPP_Real_32_gfx11<0x038>; 1980defm S_DECPERFLEVEL : SOPP_Real_32_gfx11<0x039>; 1981defm S_TTRACEDATA : SOPP_Real_32_gfx11<0x03a>; 1982defm S_TTRACEDATA_IMM : SOPP_Real_32_gfx11<0x03b>; 1983defm S_ICACHE_INV : SOPP_Real_32_gfx11<0x03c>; 1984defm S_BARRIER : SOPP_Real_32_gfx11<0x03d>; 1985 1986//===----------------------------------------------------------------------===// 1987// SOPP - GFX6, GFX7, GFX8, GFX9, GFX10 1988//===----------------------------------------------------------------------===// 1989 1990multiclass SOPP_Real_32_gfx6_gfx7<bits<7> op> { 1991 defvar ps = !cast<SOPP_Pseudo>(NAME); 1992 def _gfx6_gfx7 : SOPP_Real_32<op, ps, !cast<SOPP_Pseudo>(NAME).Mnemonic>, 1993 Select_gfx6_gfx7<ps.Mnemonic>, 1994 SOPPRelaxTable<0, ps.KeyName, "_gfx6_gfx7">; 1995} 1996 1997multiclass SOPP_Real_32_gfx8_gfx9<bits<7> op> { 1998 defvar ps = !cast<SOPP_Pseudo>(NAME); 1999 def _vi : SOPP_Real_32<op, ps>, 2000 Select_vi<ps.Mnemonic>, 2001 SOPPRelaxTable<0, ps.KeyName, "_vi">; 2002} 2003 2004multiclass SOPP_Real_32_gfx10<bits<7> op> { 2005 defvar ps = !cast<SOPP_Pseudo>(NAME); 2006 def _gfx10 : SOPP_Real_32<op, ps>, 2007 Select_gfx10<ps.Mnemonic>, 2008 SOPPRelaxTable<0, ps.KeyName, "_gfx10">; 2009} 2010 2011multiclass SOPP_Real_32_gfx8_gfx9_gfx10<bits<7> op> : 2012 SOPP_Real_32_gfx8_gfx9<op>, SOPP_Real_32_gfx10<op>; 2013 2014multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9<bits<7> op> : 2015 SOPP_Real_32_gfx6_gfx7<op>, SOPP_Real_32_gfx8_gfx9<op>; 2016 2017multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> : 2018 SOPP_Real_32_gfx6_gfx7_gfx8_gfx9<op>, SOPP_Real_32_gfx10<op>; 2019 2020multiclass SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11<bits<7> op> : 2021 SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<op>, SOPP_Real_32_gfx11<op>; 2022 2023multiclass SOPP_Real_32_gfx10_gfx11<bits<7> op> : 2024 SOPP_Real_32_gfx10<op>, SOPP_Real_32_gfx11<op>; 2025 2026//64 bit encodings, for Relaxation 2027multiclass SOPP_Real_64_gfx6_gfx7<bits<7> op> { 2028 defvar ps = !cast<SOPP_Pseudo>(NAME); 2029 def _gfx6_gfx7 : SOPP_Real_64<op, ps>, 2030 Select_gfx6_gfx7<ps.Mnemonic>, 2031 SOPPRelaxTable<1, ps.KeyName, "_gfx6_gfx7">; 2032} 2033 2034multiclass SOPP_Real_64_gfx8_gfx9<bits<7> op> { 2035 defvar ps = !cast<SOPP_Pseudo>(NAME); 2036 def _vi : SOPP_Real_64<op, ps>, 2037 Select_vi<ps.Mnemonic>, 2038 SOPPRelaxTable<1, ps.KeyName, "_vi">; 2039} 2040 2041multiclass SOPP_Real_64_gfx10<bits<7> op> { 2042 defvar ps = !cast<SOPP_Pseudo>(NAME); 2043 def _gfx10 : SOPP_Real_64<op, ps>, 2044 Select_gfx10<ps.Mnemonic>, 2045 SOPPRelaxTable<1, ps.KeyName, "_gfx10">; 2046} 2047 2048multiclass SOPP_Real_64_gfx8_gfx9_gfx10<bits<7> op> : 2049 SOPP_Real_64_gfx8_gfx9<op>, SOPP_Real_64_gfx10<op>; 2050 2051multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9<bits<7> op> : 2052 SOPP_Real_64_gfx6_gfx7<op>, SOPP_Real_64_gfx8_gfx9<op>; 2053 2054multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> : 2055 SOPP_Real_64_gfx6_gfx7_gfx8_gfx9<op>, SOPP_Real_64_gfx10<op>; 2056 2057multiclass SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11<bits<7> op> : 2058 SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10<op>, SOPP_Real_64_gfx11<op>; 2059 2060//relaxation for insts with no operands not implemented 2061multiclass SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> { 2062 defm "" : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<op>; 2063 defm _pad_s_nop : SOPP_Real_64_gfx6_gfx7_gfx8_gfx9_gfx10<op>; 2064} 2065 2066defm S_NOP : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10_gfx11<0x000>; 2067defm S_ENDPGM : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x001>; 2068defm S_WAKEUP : SOPP_Real_32_gfx8_gfx9_gfx10<0x003>; 2069defm S_BARRIER : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00a>; 2070defm S_WAITCNT : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00c>; 2071defm S_SETHALT : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00d>; 2072defm S_SETKILL : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00b>; 2073defm S_SLEEP : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00e>; 2074defm S_SETPRIO : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x00f>; 2075defm S_SENDMSG : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x010>; 2076defm S_SENDMSGHALT : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x011>; 2077defm S_TRAP : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x012>; 2078defm S_ICACHE_INV : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x013>; 2079defm S_INCPERFLEVEL : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x014>; 2080defm S_DECPERFLEVEL : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x015>; 2081defm S_TTRACEDATA : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x016>; 2082defm S_ENDPGM_SAVED : SOPP_Real_32_gfx6_gfx7_gfx8_gfx9_gfx10<0x01B>; 2083defm S_SET_GPR_IDX_OFF : SOPP_Real_32_gfx8_gfx9<0x01c>; 2084defm S_SET_GPR_IDX_MODE : SOPP_Real_32_gfx8_gfx9<0x01d>; 2085defm S_ENDPGM_ORDERED_PS_DONE : SOPP_Real_32_gfx8_gfx9_gfx10<0x01e>; 2086defm S_CODE_END : SOPP_Real_32_gfx10_gfx11<0x01f>; 2087defm S_INST_PREFETCH : SOPP_Real_32_gfx10<0x020>; 2088defm S_CLAUSE : SOPP_Real_32_gfx10<0x021>; 2089defm S_WAIT_IDLE : SOPP_Real_32_gfx10<0x022>; 2090defm S_WAITCNT_DEPCTR : SOPP_Real_32_gfx10<0x023>; 2091defm S_ROUND_MODE : SOPP_Real_32_gfx10<0x024>; 2092defm S_DENORM_MODE : SOPP_Real_32_gfx10<0x025>; 2093defm S_TTRACEDATA_IMM : SOPP_Real_32_gfx10<0x028>; 2094 2095let isBranch = 1 in { 2096defm S_BRANCH : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x002>; 2097defm S_CBRANCH_SCC0 : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x004>; 2098defm S_CBRANCH_SCC1 : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x005>; 2099defm S_CBRANCH_VCCZ : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x006>; 2100defm S_CBRANCH_VCCNZ : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x007>; 2101defm S_CBRANCH_EXECZ : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x008>; 2102defm S_CBRANCH_EXECNZ : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x009>; 2103defm S_CBRANCH_CDBGSYS : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x017>; 2104defm S_CBRANCH_CDBGUSER : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x018>; 2105defm S_CBRANCH_CDBGSYS_OR_USER : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x019>; 2106defm S_CBRANCH_CDBGSYS_AND_USER : SOPP_Real_With_Relaxation_gfx6_gfx7_gfx8_gfx9_gfx10<0x01A>; 2107} 2108 2109//===----------------------------------------------------------------------===// 2110// SOPC - GFX11 2111//===----------------------------------------------------------------------===// 2112 2113multiclass SOPC_Real_gfx11<bits<7> op> { 2114 def _gfx11 : SOPC_Real<op, !cast<SOPC_Pseudo>(NAME)>, 2115 Select_gfx11<!cast<SOPC_Pseudo>(NAME).Mnemonic>; 2116} 2117 2118defm S_CMP_EQ_I32 : SOPC_Real_gfx11<0x00>; 2119defm S_CMP_LG_I32 : SOPC_Real_gfx11<0x01>; 2120defm S_CMP_GT_I32 : SOPC_Real_gfx11<0x02>; 2121defm S_CMP_GE_I32 : SOPC_Real_gfx11<0x03>; 2122defm S_CMP_LT_I32 : SOPC_Real_gfx11<0x04>; 2123defm S_CMP_LE_I32 : SOPC_Real_gfx11<0x05>; 2124defm S_CMP_EQ_U32 : SOPC_Real_gfx11<0x06>; 2125defm S_CMP_LG_U32 : SOPC_Real_gfx11<0x07>; 2126defm S_CMP_GT_U32 : SOPC_Real_gfx11<0x08>; 2127defm S_CMP_GE_U32 : SOPC_Real_gfx11<0x09>; 2128defm S_CMP_LT_U32 : SOPC_Real_gfx11<0x0a>; 2129defm S_CMP_LE_U32 : SOPC_Real_gfx11<0x0b>; 2130defm S_BITCMP0_B32 : SOPC_Real_gfx11<0x0c>; 2131defm S_BITCMP1_B32 : SOPC_Real_gfx11<0x0d>; 2132defm S_BITCMP0_B64 : SOPC_Real_gfx11<0x0e>; 2133defm S_BITCMP1_B64 : SOPC_Real_gfx11<0x0f>; 2134defm S_CMP_EQ_U64 : SOPC_Real_gfx11<0x10>; 2135defm S_CMP_LG_U64 : SOPC_Real_gfx11<0x11>; 2136 2137//===----------------------------------------------------------------------===// 2138// SOPC - GFX6, GFX7, GFX8, GFX9, GFX10 2139//===----------------------------------------------------------------------===// 2140 2141multiclass SOPC_Real_gfx6_gfx7<bits<7> op> { 2142 defvar ps = !cast<SOPC_Pseudo>(NAME); 2143 def _gfx6_gfx7 : SOPC_Real<op, ps>, 2144 Select_gfx6_gfx7<ps.Mnemonic>; 2145} 2146 2147multiclass SOPC_Real_gfx8_gfx9<bits<7> op> { 2148 defvar ps = !cast<SOPC_Pseudo>(NAME); 2149 def _vi : SOPC_Real<op, ps>, 2150 Select_vi<ps.Mnemonic>; 2151} 2152 2153multiclass SOPC_Real_gfx10<bits<7> op> { 2154 defvar ps = !cast<SOPC_Pseudo>(NAME); 2155 def _gfx10 : SOPC_Real<op, ps>, 2156 Select_gfx10<ps.Mnemonic>; 2157} 2158 2159multiclass SOPC_Real_gfx8_gfx9_gfx10<bits<7> op> : 2160 SOPC_Real_gfx8_gfx9<op>, SOPC_Real_gfx10<op>; 2161 2162multiclass SOPC_Real_gfx6_gfx7_gfx8_gfx9<bits<7> op> : 2163 SOPC_Real_gfx6_gfx7<op>, SOPC_Real_gfx8_gfx9<op>; 2164 2165multiclass SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<bits<7> op> : 2166 SOPC_Real_gfx6_gfx7_gfx8_gfx9<op>, SOPC_Real_gfx10<op>; 2167 2168defm S_CMP_EQ_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x00>; 2169defm S_CMP_LG_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x01>; 2170defm S_CMP_GT_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x02>; 2171defm S_CMP_GE_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x03>; 2172defm S_CMP_LT_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x04>; 2173defm S_CMP_LE_I32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x05>; 2174defm S_CMP_EQ_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x06>; 2175defm S_CMP_LG_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x07>; 2176defm S_CMP_GT_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x08>; 2177defm S_CMP_GE_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x09>; 2178defm S_CMP_LT_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0a>; 2179defm S_CMP_LE_U32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0b>; 2180defm S_BITCMP0_B32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0c>; 2181defm S_BITCMP1_B32 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0d>; 2182defm S_BITCMP0_B64 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0e>; 2183defm S_BITCMP1_B64 : SOPC_Real_gfx6_gfx7_gfx8_gfx9_gfx10<0x0f>; 2184defm S_SETVSKIP : SOPC_Real_gfx6_gfx7_gfx8_gfx9<0x10>; 2185defm S_SET_GPR_IDX_ON : SOPC_Real_gfx8_gfx9<0x11>; 2186defm S_CMP_EQ_U64 : SOPC_Real_gfx8_gfx9_gfx10<0x12>; 2187defm S_CMP_LG_U64 : SOPC_Real_gfx8_gfx9_gfx10<0x13>; 2188 2189//===----------------------------------------------------------------------===// 2190// GFX8 (VI), GFX9. 2191//===----------------------------------------------------------------------===// 2192 2193class SOP1_Real_vi<bits<8> op, SOP1_Pseudo ps> : 2194 SOP1_Real<op, ps>, 2195 Select_vi<ps.Mnemonic>; 2196 2197 2198class SOP2_Real_vi<bits<7> op, SOP2_Pseudo ps> : 2199 SOP2_Real<op, ps>, 2200 Select_vi<ps.Mnemonic>; 2201 2202class SOPK_Real_vi<bits<5> op, SOPK_Pseudo ps> : 2203 SOPK_Real32<op, ps>, 2204 Select_vi<ps.Mnemonic>; 2205 2206def S_MOV_B32_vi : SOP1_Real_vi <0x00, S_MOV_B32>; 2207def S_MOV_B64_vi : SOP1_Real_vi <0x01, S_MOV_B64>; 2208def S_CMOV_B32_vi : SOP1_Real_vi <0x02, S_CMOV_B32>; 2209def S_CMOV_B64_vi : SOP1_Real_vi <0x03, S_CMOV_B64>; 2210def S_NOT_B32_vi : SOP1_Real_vi <0x04, S_NOT_B32>; 2211def S_NOT_B64_vi : SOP1_Real_vi <0x05, S_NOT_B64>; 2212def S_WQM_B32_vi : SOP1_Real_vi <0x06, S_WQM_B32>; 2213def S_WQM_B64_vi : SOP1_Real_vi <0x07, S_WQM_B64>; 2214def S_BREV_B32_vi : SOP1_Real_vi <0x08, S_BREV_B32>; 2215def S_BREV_B64_vi : SOP1_Real_vi <0x09, S_BREV_B64>; 2216def S_BCNT0_I32_B32_vi : SOP1_Real_vi <0x0a, S_BCNT0_I32_B32>; 2217def S_BCNT0_I32_B64_vi : SOP1_Real_vi <0x0b, S_BCNT0_I32_B64>; 2218def S_BCNT1_I32_B32_vi : SOP1_Real_vi <0x0c, S_BCNT1_I32_B32>; 2219def S_BCNT1_I32_B64_vi : SOP1_Real_vi <0x0d, S_BCNT1_I32_B64>; 2220def S_FF0_I32_B32_vi : SOP1_Real_vi <0x0e, S_FF0_I32_B32>; 2221def S_FF0_I32_B64_vi : SOP1_Real_vi <0x0f, S_FF0_I32_B64>; 2222def S_FF1_I32_B32_vi : SOP1_Real_vi <0x10, S_FF1_I32_B32>; 2223def S_FF1_I32_B64_vi : SOP1_Real_vi <0x11, S_FF1_I32_B64>; 2224def S_FLBIT_I32_B32_vi : SOP1_Real_vi <0x12, S_FLBIT_I32_B32>; 2225def S_FLBIT_I32_B64_vi : SOP1_Real_vi <0x13, S_FLBIT_I32_B64>; 2226def S_FLBIT_I32_vi : SOP1_Real_vi <0x14, S_FLBIT_I32>; 2227def S_FLBIT_I32_I64_vi : SOP1_Real_vi <0x15, S_FLBIT_I32_I64>; 2228def S_SEXT_I32_I8_vi : SOP1_Real_vi <0x16, S_SEXT_I32_I8>; 2229def S_SEXT_I32_I16_vi : SOP1_Real_vi <0x17, S_SEXT_I32_I16>; 2230def S_BITSET0_B32_vi : SOP1_Real_vi <0x18, S_BITSET0_B32>; 2231def S_BITSET0_B64_vi : SOP1_Real_vi <0x19, S_BITSET0_B64>; 2232def S_BITSET1_B32_vi : SOP1_Real_vi <0x1a, S_BITSET1_B32>; 2233def S_BITSET1_B64_vi : SOP1_Real_vi <0x1b, S_BITSET1_B64>; 2234def S_GETPC_B64_vi : SOP1_Real_vi <0x1c, S_GETPC_B64>; 2235def S_SETPC_B64_vi : SOP1_Real_vi <0x1d, S_SETPC_B64>; 2236def S_SWAPPC_B64_vi : SOP1_Real_vi <0x1e, S_SWAPPC_B64>; 2237def S_RFE_B64_vi : SOP1_Real_vi <0x1f, S_RFE_B64>; 2238def S_AND_SAVEEXEC_B64_vi : SOP1_Real_vi <0x20, S_AND_SAVEEXEC_B64>; 2239def S_OR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x21, S_OR_SAVEEXEC_B64>; 2240def S_XOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x22, S_XOR_SAVEEXEC_B64>; 2241def S_ANDN2_SAVEEXEC_B64_vi: SOP1_Real_vi <0x23, S_ANDN2_SAVEEXEC_B64>; 2242def S_ORN2_SAVEEXEC_B64_vi : SOP1_Real_vi <0x24, S_ORN2_SAVEEXEC_B64>; 2243def S_NAND_SAVEEXEC_B64_vi : SOP1_Real_vi <0x25, S_NAND_SAVEEXEC_B64>; 2244def S_NOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x26, S_NOR_SAVEEXEC_B64>; 2245def S_XNOR_SAVEEXEC_B64_vi : SOP1_Real_vi <0x27, S_XNOR_SAVEEXEC_B64>; 2246def S_QUADMASK_B32_vi : SOP1_Real_vi <0x28, S_QUADMASK_B32>; 2247def S_QUADMASK_B64_vi : SOP1_Real_vi <0x29, S_QUADMASK_B64>; 2248def S_MOVRELS_B32_vi : SOP1_Real_vi <0x2a, S_MOVRELS_B32>; 2249def S_MOVRELS_B64_vi : SOP1_Real_vi <0x2b, S_MOVRELS_B64>; 2250def S_MOVRELD_B32_vi : SOP1_Real_vi <0x2c, S_MOVRELD_B32>; 2251def S_MOVRELD_B64_vi : SOP1_Real_vi <0x2d, S_MOVRELD_B64>; 2252def S_CBRANCH_JOIN_vi : SOP1_Real_vi <0x2e, S_CBRANCH_JOIN>; 2253def S_ABS_I32_vi : SOP1_Real_vi <0x30, S_ABS_I32>; 2254def S_SET_GPR_IDX_IDX_vi : SOP1_Real_vi <0x32, S_SET_GPR_IDX_IDX>; 2255 2256def S_ADD_U32_vi : SOP2_Real_vi <0x00, S_ADD_U32>; 2257def S_ADD_I32_vi : SOP2_Real_vi <0x02, S_ADD_I32>; 2258def S_SUB_U32_vi : SOP2_Real_vi <0x01, S_SUB_U32>; 2259def S_SUB_I32_vi : SOP2_Real_vi <0x03, S_SUB_I32>; 2260def S_ADDC_U32_vi : SOP2_Real_vi <0x04, S_ADDC_U32>; 2261def S_SUBB_U32_vi : SOP2_Real_vi <0x05, S_SUBB_U32>; 2262def S_MIN_I32_vi : SOP2_Real_vi <0x06, S_MIN_I32>; 2263def S_MIN_U32_vi : SOP2_Real_vi <0x07, S_MIN_U32>; 2264def S_MAX_I32_vi : SOP2_Real_vi <0x08, S_MAX_I32>; 2265def S_MAX_U32_vi : SOP2_Real_vi <0x09, S_MAX_U32>; 2266def S_CSELECT_B32_vi : SOP2_Real_vi <0x0a, S_CSELECT_B32>; 2267def S_CSELECT_B64_vi : SOP2_Real_vi <0x0b, S_CSELECT_B64>; 2268def S_AND_B32_vi : SOP2_Real_vi <0x0c, S_AND_B32>; 2269def S_AND_B64_vi : SOP2_Real_vi <0x0d, S_AND_B64>; 2270def S_OR_B32_vi : SOP2_Real_vi <0x0e, S_OR_B32>; 2271def S_OR_B64_vi : SOP2_Real_vi <0x0f, S_OR_B64>; 2272def S_XOR_B32_vi : SOP2_Real_vi <0x10, S_XOR_B32>; 2273def S_XOR_B64_vi : SOP2_Real_vi <0x11, S_XOR_B64>; 2274def S_ANDN2_B32_vi : SOP2_Real_vi <0x12, S_ANDN2_B32>; 2275def S_ANDN2_B64_vi : SOP2_Real_vi <0x13, S_ANDN2_B64>; 2276def S_ORN2_B32_vi : SOP2_Real_vi <0x14, S_ORN2_B32>; 2277def S_ORN2_B64_vi : SOP2_Real_vi <0x15, S_ORN2_B64>; 2278def S_NAND_B32_vi : SOP2_Real_vi <0x16, S_NAND_B32>; 2279def S_NAND_B64_vi : SOP2_Real_vi <0x17, S_NAND_B64>; 2280def S_NOR_B32_vi : SOP2_Real_vi <0x18, S_NOR_B32>; 2281def S_NOR_B64_vi : SOP2_Real_vi <0x19, S_NOR_B64>; 2282def S_XNOR_B32_vi : SOP2_Real_vi <0x1a, S_XNOR_B32>; 2283def S_XNOR_B64_vi : SOP2_Real_vi <0x1b, S_XNOR_B64>; 2284def S_LSHL_B32_vi : SOP2_Real_vi <0x1c, S_LSHL_B32>; 2285def S_LSHL_B64_vi : SOP2_Real_vi <0x1d, S_LSHL_B64>; 2286def S_LSHR_B32_vi : SOP2_Real_vi <0x1e, S_LSHR_B32>; 2287def S_LSHR_B64_vi : SOP2_Real_vi <0x1f, S_LSHR_B64>; 2288def S_ASHR_I32_vi : SOP2_Real_vi <0x20, S_ASHR_I32>; 2289def S_ASHR_I64_vi : SOP2_Real_vi <0x21, S_ASHR_I64>; 2290def S_BFM_B32_vi : SOP2_Real_vi <0x22, S_BFM_B32>; 2291def S_BFM_B64_vi : SOP2_Real_vi <0x23, S_BFM_B64>; 2292def S_MUL_I32_vi : SOP2_Real_vi <0x24, S_MUL_I32>; 2293def S_BFE_U32_vi : SOP2_Real_vi <0x25, S_BFE_U32>; 2294def S_BFE_I32_vi : SOP2_Real_vi <0x26, S_BFE_I32>; 2295def S_BFE_U64_vi : SOP2_Real_vi <0x27, S_BFE_U64>; 2296def S_BFE_I64_vi : SOP2_Real_vi <0x28, S_BFE_I64>; 2297def S_CBRANCH_G_FORK_vi : SOP2_Real_vi <0x29, S_CBRANCH_G_FORK>; 2298def S_ABSDIFF_I32_vi : SOP2_Real_vi <0x2a, S_ABSDIFF_I32>; 2299def S_PACK_LL_B32_B16_vi : SOP2_Real_vi <0x32, S_PACK_LL_B32_B16>; 2300def S_PACK_LH_B32_B16_vi : SOP2_Real_vi <0x33, S_PACK_LH_B32_B16>; 2301def S_PACK_HH_B32_B16_vi : SOP2_Real_vi <0x34, S_PACK_HH_B32_B16>; 2302def S_RFE_RESTORE_B64_vi : SOP2_Real_vi <0x2b, S_RFE_RESTORE_B64>; 2303 2304def S_MOVK_I32_vi : SOPK_Real_vi <0x00, S_MOVK_I32>; 2305def S_CMOVK_I32_vi : SOPK_Real_vi <0x01, S_CMOVK_I32>; 2306def S_CMPK_EQ_I32_vi : SOPK_Real_vi <0x02, S_CMPK_EQ_I32>; 2307def S_CMPK_LG_I32_vi : SOPK_Real_vi <0x03, S_CMPK_LG_I32>; 2308def S_CMPK_GT_I32_vi : SOPK_Real_vi <0x04, S_CMPK_GT_I32>; 2309def S_CMPK_GE_I32_vi : SOPK_Real_vi <0x05, S_CMPK_GE_I32>; 2310def S_CMPK_LT_I32_vi : SOPK_Real_vi <0x06, S_CMPK_LT_I32>; 2311def S_CMPK_LE_I32_vi : SOPK_Real_vi <0x07, S_CMPK_LE_I32>; 2312def S_CMPK_EQ_U32_vi : SOPK_Real_vi <0x08, S_CMPK_EQ_U32>; 2313def S_CMPK_LG_U32_vi : SOPK_Real_vi <0x09, S_CMPK_LG_U32>; 2314def S_CMPK_GT_U32_vi : SOPK_Real_vi <0x0A, S_CMPK_GT_U32>; 2315def S_CMPK_GE_U32_vi : SOPK_Real_vi <0x0B, S_CMPK_GE_U32>; 2316def S_CMPK_LT_U32_vi : SOPK_Real_vi <0x0C, S_CMPK_LT_U32>; 2317def S_CMPK_LE_U32_vi : SOPK_Real_vi <0x0D, S_CMPK_LE_U32>; 2318def S_ADDK_I32_vi : SOPK_Real_vi <0x0E, S_ADDK_I32>; 2319def S_MULK_I32_vi : SOPK_Real_vi <0x0F, S_MULK_I32>; 2320def S_CBRANCH_I_FORK_vi : SOPK_Real_vi <0x10, S_CBRANCH_I_FORK>; 2321def S_GETREG_B32_vi : SOPK_Real_vi <0x11, S_GETREG_B32>; 2322def S_SETREG_B32_vi : SOPK_Real_vi <0x12, S_SETREG_B32>; 2323//def S_GETREG_REGRD_B32_vi : SOPK_Real_vi <0x13, S_GETREG_REGRD_B32>; // see pseudo for comments 2324def S_SETREG_IMM32_B32_vi : SOPK_Real64<0x14, S_SETREG_IMM32_B32>, 2325 Select_vi<S_SETREG_IMM32_B32.Mnemonic>; 2326 2327def S_CALL_B64_vi : SOPK_Real_vi <0x15, S_CALL_B64>; 2328 2329//===----------------------------------------------------------------------===// 2330// SOP1 - GFX9. 2331//===----------------------------------------------------------------------===// 2332 2333def S_ANDN1_SAVEEXEC_B64_vi : SOP1_Real_vi<0x33, S_ANDN1_SAVEEXEC_B64>; 2334def S_ORN1_SAVEEXEC_B64_vi : SOP1_Real_vi<0x34, S_ORN1_SAVEEXEC_B64>; 2335def S_ANDN1_WREXEC_B64_vi : SOP1_Real_vi<0x35, S_ANDN1_WREXEC_B64>; 2336def S_ANDN2_WREXEC_B64_vi : SOP1_Real_vi<0x36, S_ANDN2_WREXEC_B64>; 2337def S_BITREPLICATE_B64_B32_vi : SOP1_Real_vi<0x37, S_BITREPLICATE_B64_B32>; 2338 2339//===----------------------------------------------------------------------===// 2340// SOP2 - GFX9. 2341//===----------------------------------------------------------------------===// 2342 2343def S_LSHL1_ADD_U32_vi : SOP2_Real_vi<0x2e, S_LSHL1_ADD_U32>; 2344def S_LSHL2_ADD_U32_vi : SOP2_Real_vi<0x2f, S_LSHL2_ADD_U32>; 2345def S_LSHL3_ADD_U32_vi : SOP2_Real_vi<0x30, S_LSHL3_ADD_U32>; 2346def S_LSHL4_ADD_U32_vi : SOP2_Real_vi<0x31, S_LSHL4_ADD_U32>; 2347def S_MUL_HI_U32_vi : SOP2_Real_vi<0x2c, S_MUL_HI_U32>; 2348def S_MUL_HI_I32_vi : SOP2_Real_vi<0x2d, S_MUL_HI_I32>; 2349