1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -global-isel -O0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck -check-prefix=WAVE64 %s
3 ; RUN: llc -global-isel -O0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1031 < %s | FileCheck -check-prefix=WAVE32 %s
5 ; This was mishandling the constant true and false values used as a
6 ; scalar branch condition.
8 define void @br_false() {
9 ; WAVE64-LABEL: br_false:
10 ; WAVE64: ; %bb.0: ; %.exit
11 ; WAVE64-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
12 ; WAVE64-NEXT: .LBB0_1: ; %bb0
13 ; WAVE64-NEXT: ; =>This Inner Loop Header: Depth=1
14 ; WAVE64-NEXT: s_mov_b32 s4, 1
15 ; WAVE64-NEXT: s_cmp_lg_u32 s4, 0
16 ; WAVE64-NEXT: s_cbranch_scc1 .LBB0_1
17 ; WAVE64-NEXT: ; %bb.2: ; %.exit5
18 ; WAVE64-NEXT: s_setpc_b64 s[30:31]
20 ; WAVE32-LABEL: br_false:
21 ; WAVE32: ; %bb.0: ; %.exit
22 ; WAVE32-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
23 ; WAVE32-NEXT: .LBB0_1: ; %bb0
24 ; WAVE32-NEXT: ; =>This Inner Loop Header: Depth=1
25 ; WAVE32-NEXT: s_mov_b32 s4, 1
26 ; WAVE32-NEXT: s_cmp_lg_u32 s4, 0
27 ; WAVE32-NEXT: s_cbranch_scc1 .LBB0_1
28 ; WAVE32-NEXT: ; %bb.2: ; %.exit5
29 ; WAVE32-NEXT: s_setpc_b64 s[30:31]
34 br i1 false, label %.exit5, label %bb0
40 define void @br_true() {
41 ; WAVE64-LABEL: br_true:
42 ; WAVE64: ; %bb.0: ; %.exit
43 ; WAVE64-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
44 ; WAVE64-NEXT: .LBB1_1: ; %bb0
45 ; WAVE64-NEXT: ; =>This Inner Loop Header: Depth=1
46 ; WAVE64-NEXT: s_mov_b32 s4, 0
47 ; WAVE64-NEXT: s_cmp_lg_u32 s4, 0
48 ; WAVE64-NEXT: s_cbranch_scc1 .LBB1_1
49 ; WAVE64-NEXT: ; %bb.2: ; %.exit5
50 ; WAVE64-NEXT: s_setpc_b64 s[30:31]
52 ; WAVE32-LABEL: br_true:
53 ; WAVE32: ; %bb.0: ; %.exit
54 ; WAVE32-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
55 ; WAVE32-NEXT: .LBB1_1: ; %bb0
56 ; WAVE32-NEXT: ; =>This Inner Loop Header: Depth=1
57 ; WAVE32-NEXT: s_mov_b32 s4, 0
58 ; WAVE32-NEXT: s_cmp_lg_u32 s4, 0
59 ; WAVE32-NEXT: s_cbranch_scc1 .LBB1_1
60 ; WAVE32-NEXT: ; %bb.2: ; %.exit5
61 ; WAVE32-NEXT: s_setpc_b64 s[30:31]
66 br i1 true, label %.exit5, label %bb0
72 define void @br_undef() {
73 ; WAVE64-LABEL: br_undef:
74 ; WAVE64: ; %bb.0: ; %.exit
75 ; WAVE64-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
76 ; WAVE64-NEXT: .LBB2_1: ; %bb0
77 ; WAVE64-NEXT: ; =>This Inner Loop Header: Depth=1
78 ; WAVE64-NEXT: ; implicit-def: $sgpr4
79 ; WAVE64-NEXT: s_and_b32 s4, s4, 1
80 ; WAVE64-NEXT: s_cmp_lg_u32 s4, 0
81 ; WAVE64-NEXT: s_cbranch_scc1 .LBB2_1
82 ; WAVE64-NEXT: ; %bb.2: ; %.exit5
83 ; WAVE64-NEXT: s_setpc_b64 s[30:31]
85 ; WAVE32-LABEL: br_undef:
86 ; WAVE32: ; %bb.0: ; %.exit
87 ; WAVE32-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
88 ; WAVE32-NEXT: .LBB2_1: ; %bb0
89 ; WAVE32-NEXT: ; =>This Inner Loop Header: Depth=1
90 ; WAVE32-NEXT: ; implicit-def: $sgpr4
91 ; WAVE32-NEXT: s_and_b32 s4, s4, 1
92 ; WAVE32-NEXT: s_cmp_lg_u32 s4, 0
93 ; WAVE32-NEXT: s_cbranch_scc1 .LBB2_1
94 ; WAVE32-NEXT: ; %bb.2: ; %.exit5
95 ; WAVE32-NEXT: s_setpc_b64 s[30:31]
100 br i1 undef, label %.exit5, label %bb0
106 define void @br_poison() {
107 ; WAVE64-LABEL: br_poison:
108 ; WAVE64: ; %bb.0: ; %.exit
109 ; WAVE64-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
110 ; WAVE64-NEXT: .LBB3_1: ; %bb0
111 ; WAVE64-NEXT: ; =>This Inner Loop Header: Depth=1
112 ; WAVE64-NEXT: ; implicit-def: $sgpr4
113 ; WAVE64-NEXT: s_and_b32 s4, s4, 1
114 ; WAVE64-NEXT: s_cmp_lg_u32 s4, 0
115 ; WAVE64-NEXT: s_cbranch_scc1 .LBB3_1
116 ; WAVE64-NEXT: ; %bb.2: ; %.exit5
117 ; WAVE64-NEXT: s_setpc_b64 s[30:31]
119 ; WAVE32-LABEL: br_poison:
120 ; WAVE32: ; %bb.0: ; %.exit
121 ; WAVE32-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
122 ; WAVE32-NEXT: .LBB3_1: ; %bb0
123 ; WAVE32-NEXT: ; =>This Inner Loop Header: Depth=1
124 ; WAVE32-NEXT: ; implicit-def: $sgpr4
125 ; WAVE32-NEXT: s_and_b32 s4, s4, 1
126 ; WAVE32-NEXT: s_cmp_lg_u32 s4, 0
127 ; WAVE32-NEXT: s_cbranch_scc1 .LBB3_1
128 ; WAVE32-NEXT: ; %bb.2: ; %.exit5
129 ; WAVE32-NEXT: s_setpc_b64 s[30:31]
134 br i1 poison, label %.exit5, label %bb0