]> granicus.if.org Git - llvm/commitdiff
Merging r268259:
authorTom Stellard <thomas.stellard@amd.com>
Sat, 4 Jun 2016 03:43:05 +0000 (03:43 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Sat, 4 Jun 2016 03:43:05 +0000 (03:43 +0000)
------------------------------------------------------------------------
r268259 | nhaehnle | 2016-05-02 10:37:01 -0700 (Mon, 02 May 2016) | 14 lines

AMDGPU: llvm.SI.fs.constant is a source of divergence

Summary:
This intrinsic is used to get flat-shaded fragment shader inputs. Those are
uniform across a primitive, but a fragment shader wave may process pixels from
multiple primitives (as indicated by the prim_mask), and so that's where
divergence can arise.

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D19747

------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_38@271769 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
test/Analysis/DivergenceAnalysis/AMDGPU/interp-intrinsics.ll [new file with mode: 0644]

index 54a003d6a9cf9c98c968bc3bdcb81beb4b06b013..5d347722363a0e5ca0ab495550dc909e02c0f0a7 100644 (file)
@@ -131,6 +131,7 @@ static bool isIntrinsicSourceOfDivergence(const TargetIntrinsicInfo *TII,
     return false;
   case AMDGPUIntrinsic::SI_tid:
   case AMDGPUIntrinsic::SI_fs_interp:
+  case AMDGPUIntrinsic::SI_fs_constant:
     return true;
   }
 }
diff --git a/test/Analysis/DivergenceAnalysis/AMDGPU/interp-intrinsics.ll b/test/Analysis/DivergenceAnalysis/AMDGPU/interp-intrinsics.ll
new file mode 100644 (file)
index 0000000..902cf0e
--- /dev/null
@@ -0,0 +1,23 @@
+; RUN: opt  -mtriple amdgcn--- -analyze -divergence %s | FileCheck %s
+
+; CHECK-LABEL: 'fs_interp'
+; CHECK: DIVERGENT: %v = call float @llvm.SI.fs.interp(
+define void @fs_interp(i32 inreg %prim_mask, <2 x i32> %interp_param) #1 {
+  %v = call float @llvm.SI.fs.interp(i32 0, i32 0, i32 %prim_mask, <2 x i32> %interp_param)
+  store volatile float %v, float addrspace(1)* undef
+  ret void
+}
+
+; CHECK-LABEL: 'fs_constant'
+; CHECK: DIVERGENT: %v = call float @llvm.SI.fs.constant(
+define void @fs_constant(i32 inreg %prim_mask, <2 x i32> %interp_param) #1 {
+  %v = call float @llvm.SI.fs.constant(i32 0, i32 0, i32 %prim_mask)
+  store volatile float %v, float addrspace(1)* undef
+  ret void
+}
+
+declare float @llvm.SI.fs.interp(i32, i32, i32, <2 x i32>) #0
+declare float @llvm.SI.fs.constant(i32, i32, i32) #0
+
+attributes #0 = { nounwind readnone }
+attributes #1 = { "ShaderType"="1"}