Skip to content

Commit c55ee4b

Browse files
arsenmgithub-actions[bot]
authored andcommitted
Automerge: AMDGPU: Remove getLdStRegisterOperandForSize (#157216)
The AV operand classes should be used directly at the top level of the load/store definitions. Inline the remaining use into the strange MUBUF TFE vs. non-TFE usecase, which needed a special case for 16-bit operands anyway.
2 parents 465d5cf + 4c6a562 commit c55ee4b

File tree

2 files changed

+12
-34
lines changed

2 files changed

+12
-34
lines changed

llvm/lib/Target/AMDGPU/BUFInstructions.td

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,25 +393,29 @@ class MUBUF_Invalidate <string opName, SDPatternOperator node = null_frag> :
393393
let sccb_value = 0;
394394
}
395395

396-
class getLdStVDataRegisterOperand<int Size, bit isTFE> {
397-
RegisterOperand tfeVDataOp =
396+
class getBUFVDataRegisterOperand<int Size, bit isTFE> {
397+
defvar tfeVDataOp =
398398
!cond(!eq(Size, 16) : AVLdSt_64,
399399
!eq(Size, 32) : AVLdSt_64,
400400
!eq(Size, 64) : AVLdSt_96,
401401
!eq(Size, 96) : AVLdSt_128,
402402
!eq(Size, 128) : AVLdSt_160);
403403

404-
RegisterOperand ret = !if(isTFE,
405-
tfeVDataOp,
406-
!if(!eq(Size, 16), AVLdSt_32,
407-
getLdStRegisterOperandForSize<Size>.ret));
404+
defvar VDataOp =
405+
!cond(!eq(Size, 16) : AVLdSt_32,
406+
!eq(Size, 32) : AVLdSt_32,
407+
!eq(Size, 64) : AVLdSt_64,
408+
!eq(Size, 96) : AVLdSt_96,
409+
!eq(Size, 128) : AVLdSt_128);
410+
411+
RegisterOperand ret = !if(isTFE, tfeVDataOp, VDataOp);
408412
}
409413

410414
class getMUBUFInsDA<list<RegisterOperand> vdataList,
411415
list<RegisterClass> vaddrList, bit isTFE, bit hasRestrictedSOffset> {
412416
RegisterOperand vdataClass = !if(!empty(vdataList), ?, !head(vdataList));
413417
RegisterClass vaddrClass = !if(!empty(vaddrList), ?, !head(vaddrList));
414-
RegisterOperand vdata_op = getLdStVDataRegisterOperand<vdataClass.RegClass.Size, isTFE>.ret;
418+
RegisterOperand vdata_op = getBUFVDataRegisterOperand<vdataClass.RegClass.Size, isTFE>.ret;
415419

416420
dag SOffset = !if(hasRestrictedSOffset, (ins SReg_32:$soffset), (ins SCSrc_b32:$soffset));
417421
dag NonVaddrInputs = !con((ins SReg_128_XNULL:$srsrc), SOffset, (ins Offset:$offset, CPol_0:$cpol, i1imm_0:$swz));
@@ -487,7 +491,7 @@ class MUBUF_Load_Pseudo <string opName,
487491
bit isTFE = 0,
488492
bit hasRestrictedSOffset = 0,
489493
list<dag> pattern=[],
490-
RegisterOperand vdata_op = getLdStVDataRegisterOperand<vdata_vt.Size, isTFE>.ret>
494+
RegisterOperand vdata_op = getBUFVDataRegisterOperand<vdata_vt.Size, isTFE>.ret>
491495
: MUBUF_Pseudo<opName,
492496
!if(!or(isLds, isLdsOpc), (outs), (outs vdata_op:$vdata)),
493497
!con(getMUBUFIns<addrKind, [], isTFE, hasRestrictedSOffset>.ret,

llvm/lib/Target/AMDGPU/SIInstrInfo.td

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,32 +2578,6 @@ class getHasExt <int NumSrcArgs, ValueType DstVT = i32, ValueType Src0VT = i32,
25782578
getHasSDWA<NumSrcArgs, DstVT, Src0VT, Src1VT>.ret);
25792579
}
25802580

2581-
class getLdStRegisterOperandForSize<int Size> {
2582-
// This type of operands is only used in pseudo instructions helping
2583-
// code generation and thus doesn't need encoding and decoding methods.
2584-
// It also doesn't need to support AGPRs, because GFX908/A/40 do not
2585-
// support True16.
2586-
defvar VLdSt_16 = RegisterOperand<VGPR_16>;
2587-
2588-
RegisterOperand ret =
2589-
!cond(!eq(Size, 16) : VLdSt_16,
2590-
!eq(Size, 32) : AVLdSt_32,
2591-
!eq(Size, 64) : AVLdSt_64,
2592-
!eq(Size, 96) : AVLdSt_96,
2593-
!eq(Size, 128) : AVLdSt_128,
2594-
!eq(Size, 160) : AVLdSt_160,
2595-
!eq(Size, 1024) : AVLdSt_1024);
2596-
}
2597-
2598-
// Return an AGPR+VGPR operand class for the given VGPR register class.
2599-
class getLdStRegisterOperand<RegisterClass RC> {
2600-
RegisterOperand ret = getLdStRegisterOperandForSize<RC.Size>.ret;
2601-
}
2602-
2603-
class getLdStRegisterOperandForVT<ValueType VT> {
2604-
RegisterOperand ret = getLdStRegisterOperandForSize<VT.Size>.ret;
2605-
}
2606-
26072581
class getAlign2RegOp<RegisterOperand RC> {
26082582
RegisterOperand ret =
26092583
!cond(!eq(RC, VGPROp_16) : VGPROp_16,

0 commit comments

Comments
 (0)