[llvm] [AMDGPU] CodeGen for GFX12 S_WAIT_* instructions (PR #77438)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 12 04:51:40 PST 2024
================
@@ -905,29 +905,24 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
}
static unsigned getNonSoftWaitcntOpcode(unsigned Opcode) {
- if (isWaitcnt(Opcode))
+ switch (Opcode) {
+ case AMDGPU::S_WAITCNT_soft:
return AMDGPU::S_WAITCNT;
-
- if (isWaitcntVsCnt(Opcode))
+ case AMDGPU::S_WAITCNT_VSCNT_soft:
return AMDGPU::S_WAITCNT_VSCNT;
-
- llvm_unreachable("Expected opcode S_WAITCNT/S_WAITCNT_VSCNT");
- }
-
- static bool isWaitcnt(unsigned Opcode) {
- return Opcode == AMDGPU::S_WAITCNT || Opcode == AMDGPU::S_WAITCNT_soft;
- }
-
- static bool isWaitcntVsCnt(unsigned Opcode) {
- return Opcode == AMDGPU::S_WAITCNT_VSCNT ||
- Opcode == AMDGPU::S_WAITCNT_VSCNT_soft;
- }
-
- // "Soft" waitcnt instructions can be relaxed/optimized out by
- // SIInsertWaitcnts.
- static bool isSoftWaitcnt(unsigned Opcode) {
- return Opcode == AMDGPU::S_WAITCNT_soft ||
- Opcode == AMDGPU::S_WAITCNT_VSCNT_soft;
+ case AMDGPU::S_WAIT_LOADCNT_soft:
+ return AMDGPU::S_WAIT_LOADCNT;
+ case AMDGPU::S_WAIT_STORECNT_soft:
+ return AMDGPU::S_WAIT_STORECNT;
+ case AMDGPU::S_WAIT_SAMPLECNT_soft:
+ return AMDGPU::S_WAIT_SAMPLECNT;
+ case AMDGPU::S_WAIT_BVHCNT_soft:
+ return AMDGPU::S_WAIT_BVHCNT;
+ case AMDGPU::S_WAIT_DSCNT_soft:
+ return AMDGPU::S_WAIT_DSCNT;
+ default:
+ return Opcode;
----------------
Pierre-vh wrote:
Why return the opcode now instead of having an unreachable like before?
https://github.com/llvm/llvm-project/pull/77438
More information about the llvm-commits
mailing list