Skip to content

Commit 3e3ea54

Browse files
authored
AMDGPU: Add some leaf intrinsics to isAlwaysUniform (#101925)
These would always be uniform anyway, but it shouldn't hurt to mark them as always uniform. This will help use TTI::isAlwaysUniform in place of proper uniformity analysis in trivial situations.
1 parent c826c07 commit 3e3ea54

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,3 +381,7 @@ def : AlwaysUniform<int_amdgcn_if_break>;
381381
def : AlwaysUniform<int_amdgcn_workgroup_id_x>;
382382
def : AlwaysUniform<int_amdgcn_workgroup_id_y>;
383383
def : AlwaysUniform<int_amdgcn_workgroup_id_z>;
384+
def : AlwaysUniform<int_amdgcn_s_getpc>;
385+
def : AlwaysUniform<int_amdgcn_s_getreg>;
386+
def : AlwaysUniform<int_amdgcn_s_memrealtime>;
387+
def : AlwaysUniform<int_amdgcn_s_memtime>;

llvm/test/Analysis/UniformityAnalysis/AMDGPU/always_uniform.ll

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,39 @@ define void @workgroup_id_z(ptr addrspace(1) inreg %out) {
103103
ret void
104104
}
105105

106+
; CHECK-LABEL: for function 's_getpc':
107+
; CHECK: ALL VALUES UNIFORM
108+
define void @s_getpc(ptr addrspace(1) inreg %out) {
109+
%result = call i64 @llvm.amdgcn.s.getpc()
110+
store i64 %result, ptr addrspace(1) %out, align 8
111+
ret void
112+
}
113+
114+
; CHECK-LABEL: for function 's_getreg':
115+
; CHECK: ALL VALUES UNIFORM
116+
define void @s_getreg(ptr addrspace(1) inreg %out) {
117+
%result = call i32 @llvm.amdgcn.s.getreg(i32 123)
118+
store i32 %result, ptr addrspace(1) %out, align 4
119+
ret void
120+
}
121+
122+
; CHECK-LABEL: for function 's_memtime':
123+
; CHECK: ALL VALUES UNIFORM
124+
define void @s_memtime(ptr addrspace(1) inreg %out) {
125+
%result = call i64 @llvm.amdgcn.s.memtime()
126+
store i64 %result, ptr addrspace(1) %out, align 8
127+
ret void
128+
}
129+
130+
; CHECK-LABEL: for function 's_memrealtime':
131+
; CHECK: ALL VALUES UNIFORM
132+
define void @s_memrealtime(ptr addrspace(1) inreg %out) {
133+
%result = call i64 @llvm.amdgcn.s.memrealtime()
134+
store i64 %result, ptr addrspace(1) %out, align 8
135+
ret void
136+
}
137+
138+
106139
declare i32 @llvm.amdgcn.workitem.id.x() #0
107140
declare i32 @llvm.amdgcn.readfirstlane(i32) #0
108141
declare i64 @llvm.amdgcn.icmp.i32(i32, i32, i32) #1

0 commit comments

Comments
 (0)