Skip to content

Commit 7c328d8

Browse files
authored
[AMDGPU][GCNHazardRecognizer] Remove instances of hardcoded S_WAITCNT_DEPCTR operand values (#171811)
Two S_WAITCNT_DEPCTR instructions are constructed with hardcoded operand values. Replace these with appropriate calls to AMDGPU::DepCtr::encodeFieldVmVsrc(). NFC, except that the original code was setting reserved operand bits that should-be-zero, and this is now corrected.
1 parent f406210 commit 7c328d8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3659,10 +3659,10 @@ bool GCNHazardRecognizer::fixDsAtomicAsyncBarrierArriveB64(MachineInstr *MI) {
36593659
const SIInstrInfo *TII = ST.getInstrInfo();
36603660
BuildMI(*MI->getParent(), MI, MI->getDebugLoc(),
36613661
TII->get(AMDGPU::S_WAITCNT_DEPCTR))
3662-
.addImm(0xFFE3);
3662+
.addImm(AMDGPU::DepCtr::encodeFieldVmVsrc(0, ST));
36633663
BuildMI(*MI->getParent(), std::next(MI->getIterator()), MI->getDebugLoc(),
36643664
TII->get(AMDGPU::S_WAITCNT_DEPCTR))
3665-
.addImm(0xFFE3);
3665+
.addImm(AMDGPU::DepCtr::encodeFieldVmVsrc(0, ST));
36663666

36673667
return true;
36683668
}

llvm/test/CodeGen/AMDGPU/hazards-gfx1250.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ body: |
1010
; GCN-LABEL: name: ds_atomic_async_barrier_arrive_b64
1111
; GCN: liveins: $vgpr0, $vgpr1
1212
; GCN-NEXT: {{ $}}
13-
; GCN-NEXT: S_WAITCNT_DEPCTR 65507
13+
; GCN-NEXT: S_WAITCNT_DEPCTR 65411
1414
; GCN-NEXT: DS_ATOMIC_ASYNC_BARRIER_ARRIVE_B64 $vgpr1, 0, 0, implicit-def $asynccnt, implicit $asynccnt, implicit $exec
15-
; GCN-NEXT: S_WAITCNT_DEPCTR 65507
15+
; GCN-NEXT: S_WAITCNT_DEPCTR 65411
1616
DS_ATOMIC_ASYNC_BARRIER_ARRIVE_B64 $vgpr1, 0, 0, implicit-def $asynccnt, implicit $asynccnt, implicit $exec
1717
...
1818

0 commit comments

Comments
 (0)