1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=aarch64-apple-ios -run-pass=legalizer %s -o - | FileCheck %s
5 name: test_scalar_or_small
8 liveins: $x0, $x1, $x2, $x3
9 ; CHECK-LABEL: name: test_scalar_or_small
10 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
11 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
12 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
13 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
14 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[TRUNC]], [[TRUNC1]]
15 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[OR]](s32)
16 ; CHECK-NEXT: $x0 = COPY [[ANYEXT]](s64)
21 %4:_(s8) = G_OR %2, %3
22 %5:_(s64) = G_ANYEXT %4
27 name: test_big_scalar_power_of_2
30 liveins: $x0, $x1, $x2, $x3
31 ; We have a temporary G_MERGE_VALUES in the legalizer that gets
32 ; cleaned up with the G_UNMERGE_VALUES, so we end up directly
33 ; copying the results of the G_OR ops.
35 ; CHECK-LABEL: name: test_big_scalar_power_of_2
36 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
37 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
38 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
39 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x3
40 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[COPY]], [[COPY2]]
41 ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s64) = G_OR [[COPY1]], [[COPY3]]
42 ; CHECK-NEXT: $x0 = COPY [[OR]](s64)
43 ; CHECK-NEXT: $x1 = COPY [[OR1]](s64)
44 ; CHECK-NEXT: RET_ReallyLR implicit $x0, implicit $x1
49 %4:_(s128) = G_MERGE_VALUES %0, %1
50 %5:_(s128) = G_MERGE_VALUES %2, %3
51 %6:_(s128) = G_OR %4, %5
52 %7:_(s64), %8:_(s64) = G_UNMERGE_VALUES %6
55 RET_ReallyLR implicit $x0, implicit $x1
59 tracksRegLiveness: true
64 ; CHECK-LABEL: name: test_s318_or
67 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
68 ; CHECK-NEXT: %ptr:_(p0) = COPY $x0
69 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[DEF]], [[DEF]]
70 ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s64) = G_OR [[DEF]], [[DEF]]
71 ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s64) = G_OR [[DEF]], [[DEF]]
72 ; CHECK-NEXT: [[OR3:%[0-9]+]]:_(s64) = G_OR [[DEF]], [[DEF]]
73 ; CHECK-NEXT: [[OR4:%[0-9]+]]:_(s64) = G_OR [[DEF]], [[DEF]]
74 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
75 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4611686018427387903
76 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[OR]], [[C]]
77 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[OR1]], [[C]]
78 ; CHECK-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND [[OR2]], [[C]]
79 ; CHECK-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND [[OR3]], [[C]]
80 ; CHECK-NEXT: [[AND4:%[0-9]+]]:_(s64) = G_AND [[OR4]], [[C1]]
81 ; CHECK-NEXT: G_STORE [[AND]](s64), %ptr(p0) :: (store (s64), align 64)
82 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
83 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C2]](s64)
84 ; CHECK-NEXT: G_STORE [[AND1]](s64), [[PTR_ADD]](p0) :: (store (s64) into unknown-address + 8)
85 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
86 ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C3]](s64)
87 ; CHECK-NEXT: G_STORE [[AND2]](s64), [[PTR_ADD1]](p0) :: (store (s64) into unknown-address + 16, align 16)
88 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
89 ; CHECK-NEXT: [[PTR_ADD2:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C4]](s64)
90 ; CHECK-NEXT: G_STORE [[AND3]](s64), [[PTR_ADD2]](p0) :: (store (s64) into unknown-address + 24)
91 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
92 ; CHECK-NEXT: [[PTR_ADD3:%[0-9]+]]:_(p0) = G_PTR_ADD %ptr, [[C5]](s64)
93 ; CHECK-NEXT: G_STORE [[AND4]](s64), [[PTR_ADD3]](p0) :: (store (s64) into unknown-address + 32, align 32)
94 ; CHECK-NEXT: RET_ReallyLR implicit $x0
95 %a:_(s318) = G_IMPLICIT_DEF
96 %b:_(s318) = G_IMPLICIT_DEF
98 %or:_(s318) = G_OR %a, %b
99 G_STORE %or(s318), %ptr(p0) :: (store (s318))
100 RET_ReallyLR implicit $x0
104 name: test_vector_or_v16s16
107 ; CHECK-LABEL: name: test_vector_or_v16s16
108 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
109 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
110 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(<8 x s16>) = G_OR [[COPY]], [[COPY]]
111 ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(<8 x s16>) = G_OR [[COPY1]], [[COPY1]]
112 ; CHECK-NEXT: $q0 = COPY [[OR]](<8 x s16>)
113 ; CHECK-NEXT: $q1 = COPY [[OR1]](<8 x s16>)
114 %1:_(<8 x s16>) = COPY $q0
115 %2:_(<8 x s16>) = COPY $q1
116 %0:_(<16 x s16>) = G_CONCAT_VECTORS %1(<8 x s16>), %2(<8 x s16>)
117 %3:_(<16 x s16>) = G_OR %0, %0
118 %4:_(<8 x s16>), %5:_(<8 x s16>) = G_UNMERGE_VALUES %3(<16 x s16>)
119 $q0 = COPY %4(<8 x s16>)
120 $q1 = COPY %5(<8 x s16>)
124 name: test_vector_or_v32s8
127 ; CHECK-LABEL: name: test_vector_or_v32s8
128 ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
129 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
130 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(<16 x s8>) = G_OR [[COPY]], [[COPY]]
131 ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(<16 x s8>) = G_OR [[COPY1]], [[COPY1]]
132 ; CHECK-NEXT: $q0 = COPY [[OR]](<16 x s8>)
133 ; CHECK-NEXT: $q1 = COPY [[OR1]](<16 x s8>)
134 %0:_(<16 x s8>) = COPY $q0
135 %1:_(<16 x s8>) = COPY $q1
136 %2:_(<32 x s8>) = G_CONCAT_VECTORS %0, %1
137 %3:_(<32 x s8>) = G_OR %2, %2
138 %7:_(<16 x s8>), %8:_(<16 x s8>) = G_UNMERGE_VALUES %3(<32 x s8>)
139 $q0 = COPY %7(<16 x s8>)
140 $q1 = COPY %8(<16 x s8>)
145 tracksRegLiveness: true
148 liveins: $d0, $d1, $d2, $d3
150 ; CHECK-LABEL: name: or_v2s1
151 ; CHECK: liveins: $d0, $d1, $d2, $d3
153 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
154 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
155 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<2 x s32>) = COPY $d2
156 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<2 x s32>) = COPY $d3
157 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<2 x s32>) = G_ICMP intpred(eq), [[COPY]](<2 x s32>), [[COPY1]]
158 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<2 x s32>) = G_ICMP intpred(eq), [[COPY2]](<2 x s32>), [[COPY3]]
159 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(<2 x s32>) = G_OR [[ICMP]], [[ICMP1]]
160 ; CHECK-NEXT: $d0 = COPY [[OR]](<2 x s32>)
161 ; CHECK-NEXT: RET_ReallyLR implicit $d0
162 %0:_(<2 x s32>) = COPY $d0
163 %1:_(<2 x s32>) = COPY $d1
164 %2:_(<2 x s32>) = COPY $d2
165 %3:_(<2 x s32>) = COPY $d3
166 %4:_(<2 x s1>) = G_ICMP intpred(eq), %0(<2 x s32>), %1
167 %5:_(<2 x s1>) = G_ICMP intpred(eq), %2(<2 x s32>), %3
168 %6:_(<2 x s1>) = G_OR %4, %5
169 %7:_(<2 x s32>) = G_ANYEXT %6
170 $d0 = COPY %7:_(<2 x s32>)
171 RET_ReallyLR implicit $d0
175 tracksRegLiveness: true
178 liveins: $b0, $b1, $b2
180 ; CHECK-LABEL: name: or_v3s1
181 ; CHECK: liveins: $b0, $b1, $b2
183 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $b0
184 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s8) = COPY $b1
185 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s8) = COPY $b2
186 ; CHECK-NEXT: [[ANYEXT0:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY]](s8)
187 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY1]](s8)
188 ; CHECK-NEXT: [[ANYEXT2:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY2]](s8)
189 ; CHECK-NEXT: [[IMPLICIT_DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
190 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s16>) = G_BUILD_VECTOR [[ANYEXT0]](s16), [[ANYEXT1]](s16), [[ANYEXT2]](s16), [[IMPLICIT_DEF]](s16)
191 ; CHECK-NEXT: [[ANYEXT3:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY]](s8)
192 ; CHECK-NEXT: [[ANYEXT4:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY1]](s8)
193 ; CHECK-NEXT: [[ANYEXT5:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY2]](s8)
194 ; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<4 x s16>) = G_BUILD_VECTOR [[ANYEXT3]](s16), [[ANYEXT4]](s16), [[ANYEXT5]](s16), [[IMPLICIT_DEF]](s16)
195 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(<4 x s16>) = G_OR [[BUILD_VECTOR]], [[BUILD_VECTOR1]]
196 ; CHECK-NEXT: [[VAL0:%[0-9]+]]:_(s16), [[VAL1:%[0-9]+]]:_(s16), [[VAL2:%[0-9]+]]:_(s16), [[VAL3:%[0-9]+]]:_(s16) = G_UNMERGE_VALUES [[OR]](<4 x s16>)
197 ; CHECK-NEXT: [[TRUNC3:%[0-9]+]]:_(s8) = G_TRUNC [[VAL0]](s16)
198 ; CHECK-NEXT: $b0 = COPY [[TRUNC3]](s8)
199 ; CHECK-NEXT: RET_ReallyLR implicit $b0
203 %4:_(<3 x s8>) = G_BUILD_VECTOR %1(s8), %2(s8), %3(s8)
204 %0:_(<3 x s1>) = G_TRUNC %4(<3 x s8>)
205 %5:_(<3 x s1>) = G_OR %0, %0
206 %7:_(<3 x s8>) = G_ANYEXT %5(<3 x s1>)
207 %8:_(s8), %9:_(s8), %10:_(s8) = G_UNMERGE_VALUES %7(<3 x s8>)
209 RET_ReallyLR implicit $b0
213 tracksRegLiveness: true
216 liveins: $d0, $d1, $d2, $d3
218 ; CHECK-LABEL: name: or_v4s1
219 ; CHECK: liveins: $d0, $d1, $d2, $d3
221 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
222 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
223 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<4 x s16>) = COPY $d2
224 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<4 x s16>) = COPY $d3
225 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<4 x s16>) = G_ICMP intpred(eq), [[COPY]](<4 x s16>), [[COPY1]]
226 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<4 x s16>) = G_ICMP intpred(eq), [[COPY2]](<4 x s16>), [[COPY3]]
227 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(<4 x s16>) = G_OR [[ICMP]], [[ICMP1]]
228 ; CHECK-NEXT: $d0 = COPY [[OR]](<4 x s16>)
229 ; CHECK-NEXT: RET_ReallyLR implicit $d0
230 %0:_(<4 x s16>) = COPY $d0
231 %1:_(<4 x s16>) = COPY $d1
232 %2:_(<4 x s16>) = COPY $d2
233 %3:_(<4 x s16>) = COPY $d3
234 %4:_(<4 x s1>) = G_ICMP intpred(eq), %0(<4 x s16>), %1
235 %5:_(<4 x s1>) = G_ICMP intpred(eq), %2(<4 x s16>), %3
236 %6:_(<4 x s1>) = G_OR %4, %5
237 %7:_(<4 x s16>) = G_ANYEXT %6
238 $d0 = COPY %7:_(<4 x s16>)
239 RET_ReallyLR implicit $d0
243 tracksRegLiveness: true
246 liveins: $d0, $d1, $d2, $d3
248 ; CHECK-LABEL: name: or_v8s1
249 ; CHECK: liveins: $d0, $d1, $d2, $d3
251 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
252 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
253 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<8 x s8>) = COPY $d2
254 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<8 x s8>) = COPY $d3
255 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<8 x s8>) = G_ICMP intpred(eq), [[COPY]](<8 x s8>), [[COPY1]]
256 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<8 x s8>) = G_ICMP intpred(eq), [[COPY2]](<8 x s8>), [[COPY3]]
257 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(<8 x s8>) = G_OR [[ICMP]], [[ICMP1]]
258 ; CHECK-NEXT: $d0 = COPY [[OR]](<8 x s8>)
259 ; CHECK-NEXT: RET_ReallyLR implicit $d0
260 %0:_(<8 x s8>) = COPY $d0
261 %1:_(<8 x s8>) = COPY $d1
262 %2:_(<8 x s8>) = COPY $d2
263 %3:_(<8 x s8>) = COPY $d3
264 %4:_(<8 x s1>) = G_ICMP intpred(eq), %0(<8 x s8>), %1
265 %5:_(<8 x s1>) = G_ICMP intpred(eq), %2(<8 x s8>), %3
266 %6:_(<8 x s1>) = G_OR %4, %5
267 %7:_(<8 x s8>) = G_ANYEXT %6
268 $d0 = COPY %7:_(<8 x s8>)
269 RET_ReallyLR implicit $d0
273 tracksRegLiveness: true
276 liveins: $q0, $q1, $q2, $q3
278 ; CHECK-LABEL: name: or_v16s1
279 ; CHECK: liveins: $q0, $q1, $q2, $q3
281 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
282 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
283 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<16 x s8>) = COPY $q2
284 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<16 x s8>) = COPY $q3
285 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<16 x s8>) = G_ICMP intpred(eq), [[COPY]](<16 x s8>), [[COPY1]]
286 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<16 x s8>) = G_ICMP intpred(eq), [[COPY2]](<16 x s8>), [[COPY3]]
287 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(<16 x s8>) = G_OR [[ICMP]], [[ICMP1]]
288 ; CHECK-NEXT: $q0 = COPY [[OR]](<16 x s8>)
289 ; CHECK-NEXT: RET_ReallyLR implicit $q0
290 %0:_(<16 x s8>) = COPY $q0
291 %1:_(<16 x s8>) = COPY $q1
292 %2:_(<16 x s8>) = COPY $q2
293 %3:_(<16 x s8>) = COPY $q3
294 %4:_(<16 x s1>) = G_ICMP intpred(eq), %0(<16 x s8>), %1
295 %5:_(<16 x s1>) = G_ICMP intpred(eq), %2(<16 x s8>), %3
296 %6:_(<16 x s1>) = G_OR %4, %5
297 %7:_(<16 x s8>) = G_ANYEXT %6
298 $q0 = COPY %7:_(<16 x s8>)
299 RET_ReallyLR implicit $q0