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: cttz_zero_undef_s32_s32
10 ; CHECK-LABEL: name: cttz_zero_undef_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: $vgpr0 = COPY [[CTTZ_ZERO_UNDEF]](s32)
14 %0:_(s32) = COPY $vgpr0
15 %1:_(s32) = G_CTTZ_ZERO_UNDEF %0
20 name: cttz_zero_undef_s32_s64
25 ; CHECK-LABEL: name: cttz_zero_undef_s32_s64
26 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
27 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[COPY]](s64)
28 ; CHECK: $vgpr0 = COPY [[CTTZ_ZERO_UNDEF]](s32)
29 %0:_(s64) = COPY $vgpr0_vgpr1
30 %1:_(s32) = G_CTTZ_ZERO_UNDEF %0
35 name: cttz_zero_undef_s64_s64
40 ; CHECK-LABEL: name: cttz_zero_undef_s64_s64
41 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
42 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[COPY]](s64)
43 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[CTTZ_ZERO_UNDEF]](s32)
44 ; CHECK: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
45 %0:_(s64) = COPY $vgpr0_vgpr1
46 %1:_(s64) = G_CTTZ_ZERO_UNDEF %0
47 $vgpr0_vgpr1 = COPY %1
51 name: cttz_zero_undef_s16_s32
56 ; CHECK-LABEL: name: cttz_zero_undef_s16_s32
57 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
58 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[COPY]](s32)
59 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
60 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[CTTZ_ZERO_UNDEF]](s32)
61 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
62 ; CHECK: $vgpr0 = COPY [[AND]](s32)
63 %0:_(s32) = COPY $vgpr0
64 %1:_(s16) = G_CTTZ_ZERO_UNDEF %0
70 name: cttz_zero_undef_s16_s16
75 ; CHECK-LABEL: name: cttz_zero_undef_s16_s16
76 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
77 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
78 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
79 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
80 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[AND]](s32)
81 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[CTTZ_ZERO_UNDEF]](s32)
82 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
83 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
84 ; CHECK: $vgpr0 = COPY [[AND1]](s32)
85 %0:_(s32) = COPY $vgpr0
86 %1:_(s16) = G_TRUNC %0
87 %2:_(s16) = G_CTTZ_ZERO_UNDEF %1
93 name: cttz_zero_undef_v2s32_v2s32
98 ; CHECK-LABEL: name: cttz_zero_undef_v2s32_v2s32
99 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
100 ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
101 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV]](s32)
102 ; CHECK: [[CTTZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV1]](s32)
103 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[CTTZ_ZERO_UNDEF]](s32), [[CTTZ_ZERO_UNDEF1]](s32)
104 ; CHECK: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
105 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
106 %1:_(<2 x s32>) = G_CTTZ_ZERO_UNDEF %0
107 $vgpr0_vgpr1 = COPY %1
111 name: cttz_zero_undef_v2s32_v2s64
115 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
116 ; CHECK-LABEL: name: cttz_zero_undef_v2s32_v2s64
117 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
118 ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
119 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV]](s64)
120 ; CHECK: [[CTTZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[UV1]](s64)
121 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[CTTZ_ZERO_UNDEF]](s32), [[CTTZ_ZERO_UNDEF1]](s32)
122 ; CHECK: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
123 %0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
124 %1:_(<2 x s32>) = G_CTTZ_ZERO_UNDEF %0
125 $vgpr0_vgpr1 = COPY %1
129 name: cttz_zero_undef_v2s16_v2s16
134 ; CHECK-LABEL: name: cttz_zero_undef_v2s16_v2s16
135 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
136 ; CHECK: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)
137 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
138 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITCAST]], [[C]](s32)
139 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
140 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[BITCAST]](s32)
141 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]]
142 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[AND]](s32)
143 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[CTTZ_ZERO_UNDEF]](s32)
144 ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY2]](s32)
145 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32)
146 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C1]]
147 ; CHECK: [[CTTZ_ZERO_UNDEF1:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[AND1]](s32)
148 ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[CTTZ_ZERO_UNDEF1]](s32)
149 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY4]](s32)
150 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR [[TRUNC]](s16), [[TRUNC1]](s16)
151 ; CHECK: $vgpr0 = COPY [[BUILD_VECTOR]](<2 x s16>)
152 %0:_(<2 x s16>) = COPY $vgpr0
153 %1:_(<2 x s16>) = G_CTTZ_ZERO_UNDEF %0
158 name: cttz_zero_undef_s7_s7
164 ; CHECK-LABEL: name: cttz_zero_undef_s7_s7
165 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
166 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127
167 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
168 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
169 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[AND]](s32)
170 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[CTTZ_ZERO_UNDEF]](s32)
171 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
172 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
173 ; CHECK: $vgpr0 = COPY [[AND1]](s32)
174 %0:_(s32) = COPY $vgpr0
175 %1:_(s7) = G_TRUNC %0
176 %2:_(s7) = G_CTTZ_ZERO_UNDEF %1
177 %3:_(s32) = G_ZEXT %2
182 name: cttz_zero_undef_s33_s33
186 liveins: $vgpr0_vgpr1
188 ; CHECK-LABEL: name: cttz_zero_undef_s33_s33
189 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
190 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934591
191 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
192 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
193 ; CHECK: [[CTTZ_ZERO_UNDEF:%[0-9]+]]:_(s32) = G_CTTZ_ZERO_UNDEF [[AND]](s64)
194 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[CTTZ_ZERO_UNDEF]](s32)
195 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
196 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY [[ZEXT]](s64)
197 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY [[C1]](s64)
198 ; CHECK: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[COPY3]]
199 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY [[AND1]](s64)
200 ; CHECK: $vgpr0_vgpr1 = COPY [[COPY4]](s64)
201 %0:_(s64) = COPY $vgpr0_vgpr1
202 %1:_(s33) = G_TRUNC %0
203 %2:_(s33) = G_CTTZ_ZERO_UNDEF %1
204 %3:_(s64) = G_ANYEXT %2
205 $vgpr0_vgpr1 = COPY %3