1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -march=amdgcn -run-pass=instruction-select -global-isel-abort=2 -pass-remarks-missed='gisel*'  -verify-machineinstrs %s -o - 2> %t  | FileCheck -check-prefixes=GCN %s
3# RUN: FileCheck -check-prefix=ERR  %s < %t
4
5# ERR-NOT: remark:
6# ERR: remark: <unknown>:0:0: cannot select: G_BRCOND %1:sgpr(s1), %bb.1 (in function: brcond_sgpr)
7# ERR-NEXT: remark: <unknown>:0:0: cannot select: G_BRCOND %1:vgpr(s1), %bb.1 (in function: brcond_vgpr)
8# ERR-NOT: remark:
9
10---
11
12name:            brcond_scc
13legalized:       true
14regBankSelected: true
15
16body: |
17  ; GCN-LABEL: name: brcond_scc
18  ; GCN: bb.0:
19  ; GCN:   successors: %bb.1(0x80000000)
20  ; GCN:   [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
21  ; GCN:   [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
22  ; GCN:   S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
23  ; GCN:   [[COPY2:%[0-9]+]]:sreg_32 = COPY $scc
24  ; GCN:   $scc = COPY [[COPY2]]
25  ; GCN:   S_CBRANCH_SCC1 %bb.1, implicit $scc
26  ; GCN: bb.1:
27  bb.0:
28    liveins: $sgpr0, $sgpr1
29
30    %0:sgpr(s32) = COPY $sgpr0
31    %1:sgpr(s32) = COPY $sgpr1
32    %2:sgpr(s32) = G_ICMP intpred(eq), %0, %1
33    G_BRCOND %2, %bb.1
34
35  bb.1:
36
37...
38
39---
40
41name:            brcond_scc_impdef
42legalized:       true
43regBankSelected: true
44
45body: |
46  ; GCN-LABEL: name: brcond_scc_impdef
47  ; GCN: bb.0:
48  ; GCN:   successors: %bb.1(0x80000000)
49  ; GCN:   [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
50  ; GCN:   $scc = COPY [[DEF]]
51  ; GCN:   S_CBRANCH_SCC1 %bb.1, implicit $scc
52  ; GCN: bb.1:
53  bb.0:
54    liveins: $sgpr0, $sgpr1
55
56    %0:sgpr(s32) = G_IMPLICIT_DEF
57    G_BRCOND %0, %bb.1
58
59  bb.1:
60
61...
62
63---
64
65name:            brcond_scc_br
66legalized:       true
67regBankSelected: true
68
69body: |
70  ; GCN-LABEL: name: brcond_scc_br
71  ; GCN: bb.0:
72  ; GCN:   successors: %bb.1(0x80000000)
73  ; GCN:   [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
74  ; GCN:   [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
75  ; GCN:   S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
76  ; GCN:   [[COPY2:%[0-9]+]]:sreg_32 = COPY $scc
77  ; GCN:   $scc = COPY [[COPY2]]
78  ; GCN:   S_CBRANCH_SCC1 %bb.1, implicit $scc
79  ; GCN:   S_BRANCH %bb.1
80  ; GCN: bb.1:
81  ; GCN:   successors: %bb.2(0x80000000)
82  ; GCN: bb.2:
83  bb.0:
84    liveins: $sgpr0, $sgpr1
85
86    %0:sgpr(s32) = COPY $sgpr0
87    %1:sgpr(s32) = COPY $sgpr1
88    %2:sgpr(s32) = G_ICMP intpred(eq), %0, %1
89    G_BRCOND %2, %bb.1
90    G_BR %bb.1
91
92  bb.1:
93
94  bb.2:
95
96...
97
98---
99
100name:            brcond_vcc
101legalized:       true
102regBankSelected: true
103
104body: |
105  ; GCN-LABEL: name: brcond_vcc
106  ; GCN: bb.0:
107  ; GCN:   successors: %bb.1(0x80000000)
108  ; GCN:   [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
109  ; GCN:   [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
110  ; GCN:   [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64 = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
111  ; GCN:   $vcc = COPY [[V_CMP_EQ_U32_e64_]]
112  ; GCN:   S_CBRANCH_VCCNZ %bb.1, implicit $vcc
113  ; GCN: bb.1:
114  bb.0:
115    liveins: $vgpr0, $vgpr1
116
117    %0:vgpr(s32) = COPY $vgpr0
118    %1:vgpr(s32) = COPY $vgpr1
119    %2:vcc(s1) = G_ICMP intpred(eq), %0, %1
120    G_BRCOND %2, %bb.1
121
122  bb.1:
123
124...
125
126# Don't try to select this.
127---
128
129name:            brcond_sgpr
130legalized:       true
131regBankSelected: true
132
133body: |
134  ; GCN-LABEL: name: brcond_sgpr
135  ; GCN: bb.0:
136  ; GCN:   successors: %bb.1(0x80000000)
137  ; GCN:   [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
138  ; GCN:   [[TRUNC:%[0-9]+]]:sgpr(s1) = G_TRUNC [[COPY]](s32)
139  ; GCN:   G_BRCOND [[TRUNC]](s1), %bb.1
140  ; GCN: bb.1:
141  bb.0:
142    liveins: $sgpr0, $sgpr1
143
144    %0:sgpr(s32) = COPY $sgpr0
145    %1:sgpr(s1) = G_TRUNC %0
146    G_BRCOND %1, %bb.1
147
148  bb.1:
149
150...
151
152# Don't try to select this.
153---
154
155name:            brcond_vgpr
156legalized:       true
157regBankSelected: true
158
159body: |
160  ; GCN-LABEL: name: brcond_vgpr
161  ; GCN: bb.0:
162  ; GCN:   successors: %bb.1(0x80000000)
163  ; GCN:   [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0
164  ; GCN:   [[TRUNC:%[0-9]+]]:vgpr(s1) = G_TRUNC [[COPY]](s32)
165  ; GCN:   G_BRCOND [[TRUNC]](s1), %bb.1
166  ; GCN: bb.1:
167  bb.0:
168    liveins: $vgpr0, $vgpr1
169
170    %0:vgpr(s32) = COPY $vgpr0
171    %1:vgpr(s1) = G_TRUNC %0
172    G_BRCOND %1, %bb.1
173
174  bb.1:
175
176...
177