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
5 name: ctlz_zero_undef_s32_s32
10 ; CHECK-LABEL: name: ctlz_zero_undef_s32_s32
11 ; CHECK: liveins: $vgpr0
13 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
14 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[COPY]](s32)
15 ; CHECK-NEXT: $vgpr0 = COPY [[CTLZ_ZERO_UNDEF]](s32)
16 %0:_(s32) = COPY $vgpr0
17 %1:_(s32) = G_CTLZ_ZERO_UNDEF %0
22 name: ctlz_zero_undef_s32_s64
27 ; CHECK-LABEL: name: ctlz_zero_undef_s32_s64
28 ; CHECK: liveins: $vgpr0_vgpr1
30 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
31 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[COPY]](s64)
32 ; CHECK-NEXT: $vgpr0 = COPY [[CTLZ_ZERO_UNDEF]](s32)
33 %0:_(s64) = COPY $vgpr0_vgpr1
34 %1:_(s32) = G_CTLZ_ZERO_UNDEF %0
39 name: ctlz_zero_undef_s64_s64
44 ; CHECK-LABEL: name: ctlz_zero_undef_s64_s64
45 ; CHECK: liveins: $vgpr0_vgpr1
47 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
48 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[COPY]](s64)
49 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[CTLZ_ZERO_UNDEF]](s32)
50 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
51 %0:_(s64) = COPY $vgpr0_vgpr1
52 %1:_(s64) = G_CTLZ_ZERO_UNDEF %0
53 $vgpr0_vgpr1 = COPY %1
57 name: ctlz_zero_undef_s16_s32
62 ; CHECK-LABEL: name: ctlz_zero_undef_s16_s32
63 ; CHECK: liveins: $vgpr0
65 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
66 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[COPY]](s32)
67 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
68 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[CTLZ_ZERO_UNDEF]], [[C]]
69 ; CHECK-NEXT: $vgpr0 = COPY [[AND]](s32)
70 %0:_(s32) = COPY $vgpr0
71 %1:_(s16) = G_CTLZ_ZERO_UNDEF %0
77 name: ctlz_zero_undef_s16_s16
82 ; CHECK-LABEL: name: ctlz_zero_undef_s16_s16
83 ; CHECK: liveins: $vgpr0
85 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
86 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
87 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
88 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[AND]](s32)
89 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
90 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[CTLZ_ZERO_UNDEF]], [[C1]]
91 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
92 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
93 ; CHECK-NEXT: $vgpr0 = COPY [[AND1]](s32)
94 %0:_(s32) = COPY $vgpr0
95 %1:_(s16) = G_TRUNC %0
96 %2:_(s16) = G_CTLZ_ZERO_UNDEF %1
102 name: ctlz_zero_undef_v2s32_v2s32
106 liveins: $vgpr0_vgpr1
107 ; CHECK-LABEL: name: ctlz_zero_undef_v2s32_v2s32
108 ; CHECK: liveins: $vgpr0_vgpr1
110 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
111 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
112 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[UV]](s32)
113 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[UV1]](s32)
114 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[CTLZ_ZERO_UNDEF]](s32), [[CTLZ_ZERO_UNDEF1]](s32)
115 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
116 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
117 %1:_(<2 x s32>) = G_CTLZ_ZERO_UNDEF %0
118 $vgpr0_vgpr1 = COPY %1
122 name: ctlz_zero_undef_v2s32_v2s64
126 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
127 ; CHECK-LABEL: name: ctlz_zero_undef_v2s32_v2s64
128 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
130 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
131 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
132 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[UV]](s64)
133 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[UV1]](s64)
134 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[CTLZ_ZERO_UNDEF]](s32), [[CTLZ_ZERO_UNDEF1]](s32)
135 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
136 %0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
137 %1:_(<2 x s32>) = G_CTLZ_ZERO_UNDEF %0
138 $vgpr0_vgpr1 = COPY %1
142 name: ctlz_zero_undef_v2s16_v2s16
147 ; CHECK-LABEL: name: ctlz_zero_undef_v2s16_v2s16
148 ; CHECK: liveins: $vgpr0
150 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
151 ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)
152 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
153 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITCAST]], [[C]](s32)
154 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
155 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[BITCAST]], [[C1]]
156 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[AND]](s32)
157 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[CTLZ_ZERO_UNDEF]], [[C]]
158 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
159 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[LSHR]], [[C1]]
160 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[AND1]](s32)
161 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[CTLZ_ZERO_UNDEF1]], [[C]]
162 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY [[SUB1]](s32)
163 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]]
164 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C1]]
165 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND3]], [[C]](s32)
166 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND2]], [[SHL]]
167 ; CHECK-NEXT: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
168 ; CHECK-NEXT: $vgpr0 = COPY [[BITCAST1]](<2 x s16>)
169 %0:_(<2 x s16>) = COPY $vgpr0
170 %1:_(<2 x s16>) = G_CTLZ_ZERO_UNDEF %0
175 name: ctlz_zero_undef_s7_s7
181 ; CHECK-LABEL: name: ctlz_zero_undef_s7_s7
182 ; CHECK: liveins: $vgpr0
184 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
185 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127
186 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
187 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[AND]](s32)
188 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 25
189 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[CTLZ_ZERO_UNDEF]], [[C1]]
190 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
191 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
192 ; CHECK-NEXT: $vgpr0 = COPY [[AND1]](s32)
193 %0:_(s32) = COPY $vgpr0
194 %1:_(s7) = G_TRUNC %0
195 %2:_(s7) = G_CTLZ_ZERO_UNDEF %1
196 %3:_(s32) = G_ZEXT %2
201 name: ctlz_zero_undef_s33_s33
205 liveins: $vgpr0_vgpr1
207 ; CHECK-LABEL: name: ctlz_zero_undef_s33_s33
208 ; CHECK: liveins: $vgpr0_vgpr1
210 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
211 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934591
212 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
213 ; CHECK-NEXT: [[CTLZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTLZ_ZERO_UNDEF [[AND]](s64)
214 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 31
215 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[C1]](s64)
216 ; CHECK-NEXT: [[USUBO:%[0-9]+]]:_(s32), [[USUBO1:%[0-9]+]]:_(s1) = G_USUBO [[CTLZ_ZERO_UNDEF]], [[UV]]
217 ; CHECK-NEXT: [[ZEXT1:%[0-9]+]]:_(s64) = G_ZEXT [[USUBO]](s32)
218 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[ZEXT1]](s64)
219 %0:_(s64) = COPY $vgpr0_vgpr1
220 %1:_(s33) = G_TRUNC %0
221 %2:_(s33) = G_CTLZ_ZERO_UNDEF %1
222 %3:_(s64) = G_ANYEXT %2
223 $vgpr0_vgpr1 = COPY %3