1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: opt -mtriple=amdgcn-amd-amdhsa -p simplifycfg,amdgpu-unify-divergent-exit-nodes %s -S -o - | FileCheck %s --check-prefix=OPT
; RUN: llc -mtriple=amdgcn-amd-amdhsa %s -o - | FileCheck %s --check-prefix=ISA
define void @nested_inf_loop(i1 %0, i1 %1) {
; OPT-LABEL: @nested_inf_loop(
; OPT-NEXT: BB:
; OPT-NEXT: br label [[BB1:%.*]]
; OPT: BB1:
; OPT-NEXT: [[BRMERGE:%.*]] = select i1 [[TMP0:%.*]], i1 true, i1 [[TMP1:%.*]]
; OPT-NEXT: br i1 [[BRMERGE]], label [[BB1]], label [[INFLOOP:%.*]]
; OPT: infloop:
; OPT-NEXT: br i1 true, label [[INFLOOP]], label [[DUMMYRETURNBLOCK:%.*]]
; OPT: DummyReturnBlock:
; OPT-NEXT: ret void
;
; ISA-LABEL: nested_inf_loop:
; ISA: ; %bb.0: ; %BB
; ISA-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; ISA-NEXT: v_and_b32_e32 v1, 1, v1
; ISA-NEXT: v_and_b32_e32 v0, 1, v0
; ISA-NEXT: v_cmp_eq_u32_e64 s[4:5], 1, v1
; ISA-NEXT: v_cmp_ne_u32_e64 s[6:7], 1, v0
; ISA-NEXT: s_mov_b64 s[8:9], 0
; ISA-NEXT: .LBB0_1: ; %BB1
; ISA-NEXT: ; =>This Loop Header: Depth=1
; ISA-NEXT: ; Child Loop BB0_3 Depth 2
; ISA-NEXT: s_and_b64 s[10:11], exec, s[6:7]
; ISA-NEXT: s_or_b64 s[8:9], s[10:11], s[8:9]
; ISA-NEXT: s_andn2_b64 exec, exec, s[8:9]
; ISA-NEXT: s_cbranch_execnz .LBB0_1
; ISA-NEXT: ; %bb.2: ; %BB2
; ISA-NEXT: ; in Loop: Header=BB0_1 Depth=1
; ISA-NEXT: s_or_b64 exec, exec, s[8:9]
; ISA-NEXT: s_mov_b64 s[8:9], 0
; ISA-NEXT: .LBB0_3: ; %BB4
; ISA-NEXT: ; Parent Loop BB0_1 Depth=1
; ISA-NEXT: ; => This Inner Loop Header: Depth=2
; ISA-NEXT: s_and_b64 s[10:11], exec, s[4:5]
; ISA-NEXT: s_or_b64 s[8:9], s[10:11], s[8:9]
; ISA-NEXT: s_andn2_b64 exec, exec, s[8:9]
; ISA-NEXT: s_cbranch_execnz .LBB0_3
; ISA-NEXT: ; %bb.4: ; %loop.exit.guard
; ISA-NEXT: ; in Loop: Header=BB0_1 Depth=1
; ISA-NEXT: s_or_b64 exec, exec, s[8:9]
; ISA-NEXT: s_mov_b64 vcc, 0
; ISA-NEXT: s_mov_b64 s[8:9], 0
; ISA-NEXT: s_branch .LBB0_1
; ISA-NEXT: ; %bb.5: ; %DummyReturnBlock
; ISA-NEXT: s_setpc_b64 s[30:31]
BB:
br label %BB1
BB1:
br i1 %0, label %BB3, label %BB2
BB2:
br label %BB4
BB4:
br i1 %1, label %BB3, label %BB4
BB3:
br label %BB1
}
|