1 ; RUN: opt -mtriple amdgcn-unknown-amdhsa -analyze -divergence -use-gpu-divergence-analysis %s | FileCheck %s
3 ; CHECK: for function 'readfirstlane':
4 define amdgpu_kernel void @readfirstlane() {
5 %id.x = call i32 @llvm.amdgcn.workitem.id.x()
6 ; CHECK: DIVERGENT: %id.x = call i32 @llvm.amdgcn.workitem.id.x()
7 %first.lane = call i32 @llvm.amdgcn.readfirstlane(i32 %id.x)
8 ; CHECK-NOT: DIVERGENT: %first.lane = call i32 @llvm.amdgcn.readfirstlane(i32 %id.x)
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)
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)
26 declare i32 @llvm.amdgcn.workitem.id.x() #0
27 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
31 attributes #0 = { nounwind readnone }
32 attributes #1 = { nounwind readnone convergent }