1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=legalizer %s -o - | FileCheck %s
5 name: test_zext_trunc_v2s32_to_v2s16_to_v2s32
10 ; CHECK-LABEL: name: test_zext_trunc_v2s32_to_v2s16_to_v2s32
11 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
12 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
13 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32)
14 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(<2 x s32>) = G_AND [[COPY]], [[BUILD_VECTOR]]
15 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[AND]](<2 x s32>)
16 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
17 %1:_(<2 x s16>) = G_TRUNC %0
18 %2:_(<2 x s32>) = G_ZEXT %1
19 $vgpr0_vgpr1 = COPY %2
23 name: test_zext_trunc_v2s32_to_v2s16_to_v2s64
28 ; CHECK-LABEL: name: test_zext_trunc_v2s32_to_v2s16_to_v2s64
29 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
30 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
31 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
32 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[UV]](s32)
33 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s64) = G_ANYEXT [[UV1]](s32)
34 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ANYEXT]], [[C]]
35 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[ANYEXT1]], [[C]]
36 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[AND]](s64), [[AND1]](s64)
37 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x s64>)
38 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
39 %1:_(<2 x s16>) = G_TRUNC %0
40 %2:_(<2 x s64>) = G_ZEXT %1
41 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %2
45 name: test_zext_trunc_v2s32_to_v2s8_to_v2s16
50 ; CHECK-LABEL: name: test_zext_trunc_v2s32_to_v2s8_to_v2s16
51 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
52 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
53 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[C]](s32)
54 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
55 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[C]], [[C1]](s32)
56 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[COPY1]], [[SHL]]
57 ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
58 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(<2 x s16>) = G_TRUNC [[COPY]](<2 x s32>)
59 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(<2 x s16>) = G_AND [[TRUNC]], [[BITCAST]]
60 ; CHECK-NEXT: $vgpr0 = COPY [[AND]](<2 x s16>)
61 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
62 %1:_(<2 x s8>) = G_TRUNC %0
63 %2:_(<2 x s16>) = G_ZEXT %1
68 name: test_zext_trunc_v3s32_to_v3s16_to_v3s32
71 liveins: $vgpr0_vgpr1_vgpr2
73 ; CHECK-LABEL: name: test_zext_trunc_v3s32_to_v3s16_to_v3s32
74 ; CHECK: [[COPY:%[0-9]+]]:_(<3 x s32>) = COPY $vgpr0_vgpr1_vgpr2
75 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
76 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32), [[UV2:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<3 x s32>)
77 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[UV]](s32), [[UV1]](s32)
78 ; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32)
79 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(<2 x s32>) = G_AND [[BUILD_VECTOR]], [[BUILD_VECTOR1]]
80 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[UV2]], [[C]]
81 ; CHECK-NEXT: [[UV3:%[0-9]+]]:_(s32), [[UV4:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[AND]](<2 x s32>)
82 ; CHECK-NEXT: [[BUILD_VECTOR2:%[0-9]+]]:_(<3 x s32>) = G_BUILD_VECTOR [[UV3]](s32), [[UV4]](s32), [[AND1]](s32)
83 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2 = COPY [[BUILD_VECTOR2]](<3 x s32>)
84 %0:_(<3 x s32>) = COPY $vgpr0_vgpr1_vgpr2
85 %1:_(<3 x s16>) = G_TRUNC %0
86 %2:_(<3 x s32>) = G_ZEXT %1
87 $vgpr0_vgpr1_vgpr2 = COPY %2
90 # Test for "Too many bits for uint64_t" assertion when combining
91 # zexts with wide sources.
93 name: test_zext_128_trunc_s128_merge
98 ; CHECK-LABEL: name: test_zext_128_trunc_s128_merge
99 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
100 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
101 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
102 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
103 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
104 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]]
105 ; CHECK-NEXT: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[AND]](s64), [[AND1]](s64)
106 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[MV]](s128)
107 %0:_(s64) = COPY $vgpr0_vgpr1
108 %1:_(s64) = COPY $vgpr0_vgpr1
109 %2:_(s128) = G_MERGE_VALUES %0, %1
110 %3:_(s96) = G_TRUNC %2
111 %4:_(s128) = G_ZEXT %3
112 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %4
116 name: test_zext_s8_to_s32_of_sext_s1_to_s8
119 liveins: $vgpr0, $vgpr1
121 ; CHECK-LABEL: name: test_zext_s8_to_s32_of_sext_s1_to_s8
122 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
123 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
124 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]]
125 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
126 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[ICMP]](s1)
127 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SEXT]], [[C]]
128 ; CHECK-NEXT: $vgpr0 = COPY [[AND]](s32)
129 %0:_(s32) = COPY $vgpr0
130 %1:_(s32) = COPY $vgpr1
131 %2:_(s1) = G_ICMP intpred(eq), %0, %1
133 %4:_(s32) = G_ZEXT %3
138 name: test_zext_s8_to_s32_of_sext_s1_to_s16
141 liveins: $vgpr0, $vgpr1
143 ; CHECK-LABEL: name: test_zext_s8_to_s32_of_sext_s1_to_s16
144 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
145 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
146 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY]](s32), [[COPY1]]
147 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
148 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[ICMP]](s1)
149 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SEXT]], [[C]]
150 ; CHECK-NEXT: $vgpr0 = COPY [[AND]](s32)
151 %0:_(s32) = COPY $vgpr0
152 %1:_(s32) = COPY $vgpr1
153 %2:_(s1) = G_ICMP intpred(eq), %0, %1
154 %3:_(s16) = G_SEXT %2
155 %4:_(s32) = G_ZEXT %3
160 name: test_zext_s8_to_s32_of_sext_s8_to_s16
163 liveins: $vgpr0_vgpr1
165 ; CHECK-LABEL: name: test_zext_s8_to_s32_of_sext_s8_to_s16
166 ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
167 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load (s8), addrspace 1)
168 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
169 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[LOAD]], 8
170 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SEXT_INREG]], [[C]]
171 ; CHECK-NEXT: $vgpr0 = COPY [[AND]](s32)
172 %0:_(p1) = COPY $vgpr0_vgpr1
173 %1:_(s8) = G_LOAD %0 :: (load (s8), addrspace 1)
174 %2:_(s16) = G_SEXT %1
175 %3:_(s32) = G_ZEXT %2
180 name: test_zext_v2s8_to_v2s32_of_sext_v2s1_to_v2s8
183 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
185 ; CHECK-LABEL: name: test_zext_v2s8_to_v2s32_of_sext_v2s1_to_v2s8
186 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
187 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr2_vgpr3
188 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
189 ; CHECK-NEXT: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY1]](<2 x s32>)
190 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV]](s32), [[UV2]]
191 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV1]](s32), [[UV3]]
192 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s1)
193 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP1]](s1)
194 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
195 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32)
196 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ANYEXT]], 1
197 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ANYEXT1]], 1
198 ; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[SEXT_INREG]](s32), [[SEXT_INREG1]](s32)
199 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(<2 x s32>) = G_AND [[BUILD_VECTOR1]], [[BUILD_VECTOR]]
200 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[AND]](<2 x s32>)
201 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
202 %1:_(<2 x s32>) = COPY $vgpr2_vgpr3
203 %2:_(<2 x s1>) = G_ICMP intpred(eq), %0, %1
204 %3:_(<2 x s8>) = G_SEXT %2
205 %4:_(<2 x s32>) = G_ZEXT %3
206 $vgpr0_vgpr1 = COPY %4
210 name: test_zext_v2s8_to_v2s32_of_sext_v2s1_to_v2s16
213 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3
215 ; CHECK-LABEL: name: test_zext_v2s8_to_v2s32_of_sext_v2s1_to_v2s16
216 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
217 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr2_vgpr3
218 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
219 ; CHECK-NEXT: [[UV2:%[0-9]+]]:_(s32), [[UV3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY1]](<2 x s32>)
220 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV]](s32), [[UV2]]
221 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[UV1]](s32), [[UV3]]
222 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP]](s1)
223 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[ICMP1]](s1)
224 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
225 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32)
226 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ANYEXT]], 1
227 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ANYEXT1]], 1
228 ; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[SEXT_INREG]](s32), [[SEXT_INREG1]](s32)
229 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(<2 x s32>) = G_AND [[BUILD_VECTOR1]], [[BUILD_VECTOR]]
230 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[AND]](<2 x s32>)
231 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
232 %1:_(<2 x s32>) = COPY $vgpr2_vgpr3
233 %2:_(<2 x s1>) = G_ICMP intpred(eq), %0, %1
234 %3:_(<2 x s16>) = G_SEXT %2
235 %4:_(<2 x s32>) = G_ZEXT %3
236 $vgpr0_vgpr1 = COPY %4
240 name: test_zext_v2s8_to_v2s32_of_sext_v2s8_to_v2s16
243 liveins: $vgpr0_vgpr1
245 ; CHECK-LABEL: name: test_zext_v2s8_to_v2s32_of_sext_v2s8_to_v2s16
246 ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
247 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load (s16), addrspace 1)
248 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
249 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[LOAD]], [[C]](s32)
250 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
251 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[C1]](s32), [[C1]](s32)
252 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[LOAD]], 8
253 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[LSHR]], 8
254 ; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[SEXT_INREG]](s32), [[SEXT_INREG1]](s32)
255 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(<2 x s32>) = G_AND [[BUILD_VECTOR1]], [[BUILD_VECTOR]]
256 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[AND]](<2 x s32>)
257 %0:_(p1) = COPY $vgpr0_vgpr1
258 %1:_(<2 x s8>) = G_LOAD %0 :: (load (<2 x s8>), addrspace 1)
259 %2:_(<2 x s16>) = G_SEXT %1
260 %3:_(<2 x s32>) = G_ZEXT %2
261 $vgpr0_vgpr1 = COPY %3