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