Skip to content

Commit 4cb8308

Browse files
authored
AMDGPU: Avoid report_fatal_error for unsupported ds_ordered_count (#145172)
1 parent 8b7fc64 commit 4cb8308

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10098,8 +10098,12 @@ unsigned SIInstrInfo::getDSShaderTypeValue(const MachineFunction &MF) {
1009810098
return 3;
1009910099
case CallingConv::AMDGPU_HS:
1010010100
case CallingConv::AMDGPU_LS:
10101-
case CallingConv::AMDGPU_ES:
10102-
report_fatal_error("ds_ordered_count unsupported for this calling conv");
10101+
case CallingConv::AMDGPU_ES: {
10102+
const Function &F = MF.getFunction();
10103+
F.getContext().diagnose(DiagnosticInfoUnsupported(
10104+
F, "ds_ordered_count unsupported for this calling conv"));
10105+
[[fallthrough]];
10106+
}
1010310107
case CallingConv::AMDGPU_CS:
1010410108
case CallingConv::AMDGPU_KERNEL:
1010510109
case CallingConv::C:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
; RUN: not llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 -filetype=null 2>&1 %s | FileCheck %s
2+
3+
; CHECK: error: <unknown>:0:0: in function ds_ordered_add_amdgpu_hs void (ptr addrspace(2), ptr addrspace(1)): ds_ordered_count unsupported for this calling conv
4+
define amdgpu_hs void @ds_ordered_add_amdgpu_hs(ptr addrspace(2) inreg %gds, ptr addrspace(1) %out) {
5+
%val = call i32 @llvm.amdgcn.ds.ordered.add(ptr addrspace(2) %gds, i32 31, i32 0, i32 0, i1 false, i32 1, i1 true, i1 true)
6+
store i32 %val, ptr addrspace(1) %out
7+
ret void
8+
}
9+
10+
; CHECK: error: <unknown>:0:0: in function ds_ordered_add_amdgpu_ls void (ptr addrspace(2), ptr addrspace(1)): ds_ordered_count unsupported for this calling conv
11+
define amdgpu_ls void @ds_ordered_add_amdgpu_ls(ptr addrspace(2) inreg %gds, ptr addrspace(1) %out) {
12+
%val = call i32 @llvm.amdgcn.ds.ordered.add(ptr addrspace(2) %gds, i32 31, i32 0, i32 0, i1 false, i32 1, i1 true, i1 true)
13+
store i32 %val, ptr addrspace(1) %out
14+
ret void
15+
}
16+
17+
; CHECK: error: <unknown>:0:0: in function ds_ordered_add_amdgpu_es void (ptr addrspace(2), ptr addrspace(1)): ds_ordered_count unsupported for this calling conv
18+
define amdgpu_es void @ds_ordered_add_amdgpu_es(ptr addrspace(2) inreg %gds, ptr addrspace(1) %out) {
19+
%val = call i32 @llvm.amdgcn.ds.ordered.add(ptr addrspace(2) %gds, i32 31, i32 0, i32 0, i1 false, i32 1, i1 true, i1 true)
20+
store i32 %val, ptr addrspace(1) %out
21+
ret void
22+
}

0 commit comments

Comments
 (0)