• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck %s
3
4---
5name: cttz_s32_s32
6
7body: |
8  bb.0:
9    liveins: $vgpr0
10    ; CHECK-LABEL: name: cttz_s32_s32
11    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
12    ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[COPY]](s32)
13    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
14    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
15    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
16    ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C1]], [[CTTZ_ZERO_UNDEF]]
17    ; CHECK: $vgpr0 = COPY [[SELECT]](s32)
18    %0:_(s32) = COPY $vgpr0
19    %1:_(s32) = G_CTTZ %0
20    $vgpr0 = COPY %1
21...
22
23---
24name: cttz_s32_s64
25
26body: |
27  bb.0:
28    liveins: $vgpr0_vgpr1
29    ; CHECK-LABEL: name: cttz_s32_s64
30    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
31    ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[COPY]](s64)
32    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
33    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY]](s64), [[C]]
34    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 64
35    ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C1]], [[CTTZ_ZERO_UNDEF]]
36    ; CHECK: $vgpr0 = COPY [[SELECT]](s32)
37    %0:_(s64) = COPY $vgpr0_vgpr1
38    %1:_(s32) = G_CTTZ %0
39    $vgpr0 = COPY %1
40...
41
42---
43name: cttz_s64_s64
44
45body: |
46  bb.0:
47    liveins: $vgpr0_vgpr1
48    ; CHECK-LABEL: name: cttz_s64_s64
49    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
50    ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[COPY]](s64)
51    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
52    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY]](s64), [[C]]
53    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 64
54    ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C1]], [[CTTZ_ZERO_UNDEF]]
55    ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[SELECT]](s32)
56    ; CHECK: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
57    %0:_(s64) = COPY $vgpr0_vgpr1
58    %1:_(s64) = G_CTTZ %0
59    $vgpr0_vgpr1 = COPY %1
60...
61
62---
63name: cttz_s16_s32
64
65body: |
66  bb.0:
67    liveins: $vgpr0
68    ; CHECK-LABEL: name: cttz_s16_s32
69    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
70    ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[COPY]](s32)
71    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
72    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[C]]
73    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
74    ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C1]], [[CTTZ_ZERO_UNDEF]]
75    ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
76    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32)
77    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C2]]
78    ; CHECK: $vgpr0 = COPY [[AND]](s32)
79    %0:_(s32) = COPY $vgpr0
80    %1:_(s16) = G_CTTZ %0
81    %2:_(s32) = G_ZEXT %1
82    $vgpr0 = COPY %2
83...
84
85---
86name: cttz_s16_s16
87
88body: |
89  bb.0:
90    liveins: $vgpr0
91    ; CHECK-LABEL: name: cttz_s16_s16
92    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
93    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
94    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
95    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
96    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65536
97    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[C1]]
98    ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[OR]](s32)
99    ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
100    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[OR]](s32), [[C2]]
101    ; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
102    ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C3]], [[CTTZ_ZERO_UNDEF]]
103    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32)
104    ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
105    ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
106    ; CHECK: $vgpr0 = COPY [[AND1]](s32)
107    %0:_(s32) = COPY $vgpr0
108    %1:_(s16) = G_TRUNC %0
109    %2:_(s16) = G_CTTZ %1
110    %3:_(s32) = G_ZEXT %2
111    $vgpr0 = COPY %3
112...
113
114---
115name: cttz_v2s32_v2s32
116
117body: |
118  bb.0:
119    liveins: $vgpr0_vgpr1
120    ; CHECK-LABEL: name: cttz_v2s32_v2s32
121    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
122    ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
123    ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV]](s32)
124    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
125    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV]](s32), [[C]]
126    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
127    ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C1]], [[CTTZ_ZERO_UNDEF]]
128    ; CHECK: [[CTTZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV1]](s32)
129    ; CHECK: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV1]](s32), [[C]]
130    ; CHECK: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s1), [[C1]], [[CTTZ_ZERO_UNDEF1]]
131    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[SELECT]](s32), [[SELECT1]](s32)
132    ; CHECK: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
133    %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
134    %1:_(<2 x s32>) = G_CTTZ %0
135    $vgpr0_vgpr1 = COPY %1
136...
137
138---
139name: cttz_v2s32_v2s64
140
141body: |
142  bb.0:
143    liveins: $vgpr0_vgpr1_vgpr2_vgpr3
144    ; CHECK-LABEL: name: cttz_v2s32_v2s64
145    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
146    ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
147    ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV]](s64)
148    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
149    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV]](s64), [[C]]
150    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 64
151    ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C1]], [[CTTZ_ZERO_UNDEF]]
152    ; CHECK: [[CTTZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV1]](s64)
153    ; CHECK: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV1]](s64), [[C]]
154    ; CHECK: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s1), [[C1]], [[CTTZ_ZERO_UNDEF1]]
155    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[SELECT]](s32), [[SELECT1]](s32)
156    ; CHECK: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
157    %0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
158    %1:_(<2 x s32>) = G_CTTZ %0
159    $vgpr0_vgpr1 = COPY %1
160...
161
162---
163name: cttz_v2s16_v2s16
164
165body: |
166  bb.0:
167    liveins: $vgpr0
168    ; CHECK-LABEL: name: cttz_v2s16_v2s16
169    ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
170    ; CHECK: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)
171    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
172    ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITCAST]], [[C]](s32)
173    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
174    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[BITCAST]](s32)
175    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]]
176    ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 65536
177    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[C2]]
178    ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[OR]](s32)
179    ; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
180    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[OR]](s32), [[C3]]
181    ; CHECK: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
182    ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C4]], [[CTTZ_ZERO_UNDEF]]
183    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32)
184    ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32)
185    ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C1]]
186    ; CHECK: [[OR1:%[0-9]+]]:_(s32) = G_OR [[AND1]], [[C2]]
187    ; CHECK: [[CTTZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[OR1]](s32)
188    ; CHECK: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[OR1]](s32), [[C3]]
189    ; CHECK: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s1), [[C4]], [[CTTZ_ZERO_UNDEF1]]
190    ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SELECT1]](s32)
191    ; CHECK: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
192    ; CHECK: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY5]], [[C1]]
193    ; CHECK: [[COPY6:%[0-9]+]]:_(s32) = COPY [[COPY4]](s32)
194    ; CHECK: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY6]], [[C1]]
195    ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND3]], [[C]](s32)
196    ; CHECK: [[OR2:%[0-9]+]]:_(s32) = G_OR [[AND2]], [[SHL]]
197    ; CHECK: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR2]](s32)
198    ; CHECK: $vgpr0 = COPY [[BITCAST1]](<2 x s16>)
199    %0:_(<2 x s16>) = COPY $vgpr0
200    %1:_(<2 x s16>) = G_CTTZ %0
201    $vgpr0 = COPY %1
202...
203
204---
205name: cttz_s7_s7
206
207body: |
208  bb.0:
209    liveins: $vgpr0
210
211    ; CHECK-LABEL: name: cttz_s7_s7
212    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
213    ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127
214    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
215    ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
216    ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 128
217    ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[C1]]
218    ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[OR]](s32)
219    ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
220    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[OR]](s32), [[C2]]
221    ; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
222    ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C3]], [[CTTZ_ZERO_UNDEF]]
223    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[SELECT]](s32)
224    ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
225    ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
226    ; CHECK: $vgpr0 = COPY [[AND1]](s32)
227    %0:_(s32) = COPY $vgpr0
228    %1:_(s7) = G_TRUNC %0
229    %2:_(s7) = G_CTTZ %1
230    %3:_(s32) = G_ZEXT %2
231    $vgpr0 = COPY %3
232...
233
234---
235name: cttz_s33_s33
236
237body: |
238  bb.0:
239    liveins: $vgpr0_vgpr1
240
241    ; CHECK-LABEL: name: cttz_s33_s33
242    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
243    ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934591
244    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
245    ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
246    ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934592
247    ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[AND]], [[C1]]
248    ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[OR]](s64)
249    ; CHECK: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
250    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[OR]](s64), [[C2]]
251    ; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 64
252    ; CHECK: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C3]], [[CTTZ_ZERO_UNDEF]]
253    ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[SELECT]](s32)
254    ; CHECK: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
255    ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY [[ZEXT]](s64)
256    ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY [[C4]](s64)
257    ; CHECK: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[COPY3]]
258    ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY [[AND1]](s64)
259    ; CHECK: $vgpr0_vgpr1 = COPY [[COPY4]](s64)
260    %0:_(s64) = COPY $vgpr0_vgpr1
261    %1:_(s33) = G_TRUNC %0
262    %2:_(s33) = G_CTTZ %1
263    %3:_(s64) = G_ANYEXT %2
264    $vgpr0_vgpr1 = COPY %3
265...
266