blob: 0a4a99b5bdcc78811a2541524c8bf568f8eddc57 [file] [log] [blame]
Nicolai Haehnle3ffd3832018-04-04 10:57:58 +00001; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
2; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
3
4; SI-LABEL: {{^}}i1_copy_from_loop:
5;
6; Cannot use an SGPR mask to copy %cc out of the loop, since the mask would
7; only contain the lanes that were active during the last loop iteration.
8;
9; SI: ; %for.body
10; SI: v_cmp_gt_u32_e64 [[SREG:s\[[0-9]+:[0-9]+\]]], 4,
11; SI: v_cndmask_b32_e64 [[VREG:v[0-9]+]], 0, -1, [[SREG]]
12; SI-NOT: [[VREG]]
13; SI: ; %for.end
14; SI: v_cmp_ne_u32_e32 vcc, 0, [[VREG]]
15define amdgpu_ps void @i1_copy_from_loop(<4 x i32> inreg %rsrc, i32 %tid) {
16entry:
17 br label %for.body
18
19for.body:
20 %i = phi i32 [0, %entry], [%i.inc, %end.loop]
21 %cc = icmp ult i32 %i, 4
22 br i1 %cc, label %mid.loop, label %for.end
23
24mid.loop:
25 %v = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> %rsrc, i32 %tid, i32 %i, i1 false, i1 false)
26 %cc2 = fcmp oge float %v, 0.0
27 br i1 %cc2, label %end.loop, label %for.end
28
29end.loop:
30 %i.inc = add i32 %i, 1
31 br label %for.body
32
33for.end:
34 br i1 %cc, label %if, label %end
35
36if:
37 call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float undef, float undef, float undef, float undef, i1 true, i1 true)
38 br label %end
39
40end:
41 ret void
42}
43
44declare float @llvm.amdgcn.buffer.load.f32(<4 x i32>, i32, i32, i1, i1) #0
45declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #1
46
47attributes #0 = { nounwind readonly }
48attributes #1 = { nounwind inaccessiblememonly }