[llvm] [AMDGPU] Support merging 16-bit TBUFFER load/store instruction (PR #145078)
Harrison Hao via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 9 21:28:39 PDT 2025
================
@@ -839,8 +839,16 @@ void SILoadStoreOptimizer::CombineInfo::setMI(MachineBasicBlock::iterator MI,
Offset = I->getOperand(OffsetIdx).getImm();
}
- if (InstClass == TBUFFER_LOAD || InstClass == TBUFFER_STORE)
+ if (InstClass == TBUFFER_LOAD || InstClass == TBUFFER_STORE) {
Format = LSO.TII->getNamedOperand(*I, AMDGPU::OpName::format)->getImm();
+ const AMDGPU::GcnBufferFormatInfo *Info =
+ AMDGPU::getGcnBufferFormatInfo(Format, *LSO.STM);
+
+ // TODO: Support merging 8-bit tbuffer load/store instructions
+ // Use 2-byte element size if the tbuffer format is 16-bit.
+ if (Info && Info->BitsPerComp == 16)
+ EltSize = 2;
----------------
harrisonGPU wrote:
Thanks! I've updated it. If we make this change, the 8-bit tbuffer will also be merged, so I've added an 8-bit lit test as well. I've also updated the commit title and message.
https://github.com/llvm/llvm-project/pull/145078
More information about the llvm-commits
mailing list