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
10 ; CHECK-LABEL: name: cttz_s32_s32
11 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
12 ; CHECK: [[CTTZ:%[0-9]+]]:_(s32) = G_CTTZ [[COPY]](s32)
13 ; CHECK: $vgpr0 = COPY [[CTTZ]](s32)
14 %0:_(s32) = COPY $vgpr0
25 ; CHECK-LABEL: name: cttz_s32_s64
26 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
27 ; CHECK: [[CTTZ:%[0-9]+]]:_(s32) = G_CTTZ [[COPY]](s64)
28 ; CHECK: $vgpr0 = COPY [[CTTZ]](s32)
29 %0:_(s64) = COPY $vgpr0_vgpr1
40 ; CHECK-LABEL: name: cttz_s64_s64
41 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
42 ; CHECK: [[CTTZ:%[0-9]+]]:_(s32) = G_CTTZ [[COPY]](s64)
43 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[CTTZ]](s32)
44 ; CHECK: $vgpr0_vgpr1 = COPY [[ZEXT]](s64)
45 %0:_(s64) = COPY $vgpr0_vgpr1
47 $vgpr0_vgpr1 = COPY %1
56 ; CHECK-LABEL: name: cttz_s16_s32
57 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
58 ; CHECK: [[CTTZ:%[0-9]+]]:_(s32) = G_CTTZ [[COPY]](s32)
59 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
60 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[CTTZ]](s32)
61 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
62 ; CHECK: $vgpr0 = COPY [[AND]](s32)
63 %0:_(s32) = COPY $vgpr0
75 ; CHECK-LABEL: name: cttz_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: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65536
81 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[C1]]
82 ; CHECK: [[CTTZ:%[0-9]+]]:_(s32) = G_CTTZ [[OR]](s32)
83 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[CTTZ]](s32)
84 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
85 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
86 ; CHECK: $vgpr0 = COPY [[AND1]](s32)
87 %0:_(s32) = COPY $vgpr0
88 %1:_(s16) = G_TRUNC %0
95 name: cttz_v2s32_v2s32
100 ; CHECK-LABEL: name: cttz_v2s32_v2s32
101 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
102 ; CHECK: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
103 ; CHECK: [[CTTZ:%[0-9]+]]:_(s32) = G_CTTZ [[UV]](s32)
104 ; CHECK: [[CTTZ1:%[0-9]+]]:_(s32) = G_CTTZ [[UV1]](s32)
105 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[CTTZ]](s32), [[CTTZ1]](s32)
106 ; CHECK: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
107 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
108 %1:_(<2 x s32>) = G_CTTZ %0
109 $vgpr0_vgpr1 = COPY %1
113 name: cttz_v2s32_v2s64
117 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
118 ; CHECK-LABEL: name: cttz_v2s32_v2s64
119 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
120 ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
121 ; CHECK: [[CTTZ:%[0-9]+]]:_(s32) = G_CTTZ [[UV]](s64)
122 ; CHECK: [[CTTZ1:%[0-9]+]]:_(s32) = G_CTTZ [[UV1]](s64)
123 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[CTTZ]](s32), [[CTTZ1]](s32)
124 ; CHECK: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
125 %0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
126 %1:_(<2 x s32>) = G_CTTZ %0
127 $vgpr0_vgpr1 = COPY %1
131 name: cttz_v2s16_v2s16
136 ; CHECK-LABEL: name: cttz_v2s16_v2s16
137 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
138 ; CHECK: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)
139 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
140 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITCAST]], [[C]](s32)
141 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
142 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[BITCAST]](s32)
143 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C1]]
144 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 65536
145 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[C2]]
146 ; CHECK: [[CTTZ:%[0-9]+]]:_(s32) = G_CTTZ [[OR]](s32)
147 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[CTTZ]](s32)
148 ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY2]](s32)
149 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32)
150 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C1]]
151 ; CHECK: [[OR1:%[0-9]+]]:_(s32) = G_OR [[AND1]], [[C2]]
152 ; CHECK: [[CTTZ1:%[0-9]+]]:_(s32) = G_CTTZ [[OR1]](s32)
153 ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[CTTZ1]](s32)
154 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY4]](s32)
155 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR [[TRUNC]](s16), [[TRUNC1]](s16)
156 ; CHECK: $vgpr0 = COPY [[BUILD_VECTOR]](<2 x s16>)
157 %0:_(<2 x s16>) = COPY $vgpr0
158 %1:_(<2 x s16>) = G_CTTZ %0
169 ; CHECK-LABEL: name: cttz_s7_s7
170 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
171 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127
172 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
173 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
174 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 128
175 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[C1]]
176 ; CHECK: [[CTTZ:%[0-9]+]]:_(s32) = G_CTTZ [[OR]](s32)
177 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[CTTZ]](s32)
178 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
179 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
180 ; CHECK: $vgpr0 = COPY [[AND1]](s32)
181 %0:_(s32) = COPY $vgpr0
182 %1:_(s7) = G_TRUNC %0
184 %3:_(s32) = G_ZEXT %2
193 liveins: $vgpr0_vgpr1
195 ; CHECK-LABEL: name: cttz_s33_s33
196 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
197 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934591
198 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY [[COPY]](s64)
199 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
200 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 8589934592
201 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[AND]], [[C1]]
202 ; CHECK: [[CTTZ:%[0-9]+]]:_(s32) = G_CTTZ [[OR]](s64)
203 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[CTTZ]](s32)
204 ; CHECK: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
205 ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY [[ZEXT]](s64)
206 ; CHECK: [[COPY3:%[0-9]+]]:_(s64) = COPY [[C2]](s64)
207 ; CHECK: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[COPY3]]
208 ; CHECK: [[COPY4:%[0-9]+]]:_(s64) = COPY [[AND1]](s64)
209 ; CHECK: $vgpr0_vgpr1 = COPY [[COPY4]](s64)
210 %0:_(s64) = COPY $vgpr0_vgpr1
211 %1:_(s33) = G_TRUNC %0
212 %2:_(s33) = G_CTTZ %1
213 %3:_(s64) = G_ANYEXT %2
214 $vgpr0_vgpr1 = COPY %3