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