]> granicus.if.org Git - llvm/commitdiff
[AMDGPU] Add some missing always-uniform values.
authorNeil Henning <neil.henning@amd.com>
Fri, 18 Jan 2019 16:39:27 +0000 (16:39 +0000)
committerNeil Henning <neil.henning@amd.com>
Fri, 18 Jan 2019 16:39:27 +0000 (16:39 +0000)
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

lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
test/Analysis/DivergenceAnalysis/AMDGPU/always_uniform.ll

index 62e7e44ddb80c660c65cb08f3c5ada7a3d7fdbc3..674230c366b456fa481fbe1c88590fb51d9b1e7d 100644 (file)
@@ -579,6 +579,8 @@ bool GCNTTIImpl::isAlwaysUniform(const Value *V) const {
       return false;
     case Intrinsic::amdgcn_readfirstlane:
     case Intrinsic::amdgcn_readlane:
+    case Intrinsic::amdgcn_icmp:
+    case Intrinsic::amdgcn_fcmp:
       return true;
     }
   }
index eaac9ce526c4be351ad813c4ce6392cd2e445f32..b5e8e49c68768252dab16c3268a4621b59f50160 100644 (file)
@@ -1,6 +1,7 @@
 ; RUN: opt  -mtriple amdgcn-unknown-amdhsa -analyze -divergence -use-gpu-divergence-analysis %s | FileCheck %s
 
-define amdgpu_kernel void @workitem_id_x() #1 {
+; CHECK: for function 'readfirstlane':
+define amdgpu_kernel void @readfirstlane() {
   %id.x = call i32 @llvm.amdgcn.workitem.id.x()
 ; CHECK: DIVERGENT:  %id.x = call i32 @llvm.amdgcn.workitem.id.x()
   %first.lane = call i32 @llvm.amdgcn.readfirstlane(i32 %id.x)
@@ -8,7 +9,24 @@ define amdgpu_kernel void @workitem_id_x() #1 {
   ret void
 }
 
+; CHECK: for function 'icmp':
+define amdgpu_kernel void @icmp(i32 inreg %x) {
+; CHECK-NOT: DIVERGENT:  %icmp = call i64 @llvm.amdgcn.icmp.i32
+  %icmp = call i64 @llvm.amdgcn.icmp.i32(i32 %x, i32 0, i32 33)
+  ret void
+}
+
+; CHECK: for function 'fcmp':
+define amdgpu_kernel void @fcmp(float inreg %x, float inreg %y) {
+; CHECK-NOT: DIVERGENT:  %fcmp = call i64 @llvm.amdgcn.fcmp.i32
+  %fcmp = call i64 @llvm.amdgcn.fcmp.i32(float %x, float %y, i32 33)
+  ret void
+}
+
 declare i32 @llvm.amdgcn.workitem.id.x() #0
 declare i32 @llvm.amdgcn.readfirstlane(i32) #0
+declare i64 @llvm.amdgcn.icmp.i32(i32, i32, i32) #1
+declare i64 @llvm.amdgcn.fcmp.i32(float, float, i32) #1
 
 attributes #0 = { nounwind readnone }
+attributes #1 = { nounwind readnone convergent }