Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 3040d97

Browse files
author
Neil Henning
committed
[AMDGPU] Add some missing always-uniform values.
This commit adds some missing intrinsics into the isAlwaysUniform list for the AMDGPU backend. Differential Revision: https://reviews.llvm.org/D56845 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351562 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent d255002 commit 3040d97

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,8 @@ bool GCNTTIImpl::isAlwaysUniform(const Value *V) const {
579579
return false;
580580
case Intrinsic::amdgcn_readfirstlane:
581581
case Intrinsic::amdgcn_readlane:
582+
case Intrinsic::amdgcn_icmp:
583+
case Intrinsic::amdgcn_fcmp:
582584
return true;
583585
}
584586
}
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
; RUN: opt -mtriple amdgcn-unknown-amdhsa -analyze -divergence -use-gpu-divergence-analysis %s | FileCheck %s
22

3-
define amdgpu_kernel void @workitem_id_x() #1 {
3+
; CHECK: for function 'readfirstlane':
4+
define amdgpu_kernel void @readfirstlane() {
45
%id.x = call i32 @llvm.amdgcn.workitem.id.x()
56
; CHECK: DIVERGENT: %id.x = call i32 @llvm.amdgcn.workitem.id.x()
67
%first.lane = call i32 @llvm.amdgcn.readfirstlane(i32 %id.x)
78
; CHECK-NOT: DIVERGENT: %first.lane = call i32 @llvm.amdgcn.readfirstlane(i32 %id.x)
89
ret void
910
}
1011

12+
; CHECK: for function 'icmp':
13+
define amdgpu_kernel void @icmp(i32 inreg %x) {
14+
; CHECK-NOT: DIVERGENT: %icmp = call i64 @llvm.amdgcn.icmp.i32
15+
%icmp = call i64 @llvm.amdgcn.icmp.i32(i32 %x, i32 0, i32 33)
16+
ret void
17+
}
18+
19+
; CHECK: for function 'fcmp':
20+
define amdgpu_kernel void @fcmp(float inreg %x, float inreg %y) {
21+
; CHECK-NOT: DIVERGENT: %fcmp = call i64 @llvm.amdgcn.fcmp.i32
22+
%fcmp = call i64 @llvm.amdgcn.fcmp.i32(float %x, float %y, i32 33)
23+
ret void
24+
}
25+
1126
declare i32 @llvm.amdgcn.workitem.id.x() #0
1227
declare i32 @llvm.amdgcn.readfirstlane(i32) #0
28+
declare i64 @llvm.amdgcn.icmp.i32(i32, i32, i32) #1
29+
declare i64 @llvm.amdgcn.fcmp.i32(float, float, i32) #1
1330

1431
attributes #0 = { nounwind readnone }
32+
attributes #1 = { nounwind readnone convergent }

0 commit comments

Comments
 (0)