1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
5 name: test_scalar_sub_big
8 ; CHECK-LABEL: name: test_scalar_sub_big
9 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
10 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
11 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
12 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x3
13 ; CHECK-NEXT: [[USUBO:%[0-9]+]]:_(s64), [[USUBO1:%[0-9]+]]:_(s32) = G_USUBO [[COPY]], [[COPY2]]
14 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
15 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[USUBO1]], [[C]]
16 ; CHECK-NEXT: [[USUBE:%[0-9]+]]:_(s64), [[USUBE1:%[0-9]+]]:_(s32) = G_USUBE [[COPY1]], [[COPY3]], [[AND]]
17 ; CHECK-NEXT: $x0 = COPY [[USUBO]](s64)
18 ; CHECK-NEXT: $x1 = COPY [[USUBE]](s64)
23 %4:_(s128) = G_MERGE_VALUES %0(s64), %1(s64)
24 %5:_(s128) = G_MERGE_VALUES %2(s64), %3(s64)
25 %6:_(s128) = G_SUB %4, %5
26 %7:_(s64), %8:_(s64) = G_UNMERGE_VALUES %6(s128)
32 name: test_scalar_sub_big_nonpow2
35 ; CHECK-LABEL: name: test_scalar_sub_big_nonpow2
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: [[USUBO:%[0-9]+]]:_(s64), [[USUBO1:%[0-9]+]]:_(s32) = G_USUBO [[COPY]], [[COPY1]]
41 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
42 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[USUBO1]], [[C]]
43 ; CHECK-NEXT: [[USUBE:%[0-9]+]]:_(s64), [[USUBE1:%[0-9]+]]:_(s32) = G_USUBE [[COPY1]], [[COPY2]], [[AND]]
44 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[USUBE1]], [[C]]
45 ; CHECK-NEXT: [[USUBE2:%[0-9]+]]:_(s64), [[USUBE3:%[0-9]+]]:_(s32) = G_USUBE [[COPY2]], [[COPY3]], [[AND1]]
46 ; CHECK-NEXT: $x0 = COPY [[USUBO]](s64)
47 ; CHECK-NEXT: $x1 = COPY [[USUBE]](s64)
48 ; CHECK-NEXT: $x2 = COPY [[USUBE2]](s64)
53 %4:_(s192) = G_MERGE_VALUES %0(s64), %1(s64), %2(s64)
54 %5:_(s192) = G_MERGE_VALUES %1(s64), %2(s64), %3(s64)
55 %6:_(s192) = G_SUB %4, %5
56 %7:_(s64), %8:_(s64), %9:_(s64) = G_UNMERGE_VALUES %6(s192)
63 name: test_scalar_sub_small
66 ; CHECK-LABEL: name: test_scalar_sub_small
67 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
68 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
69 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
70 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
71 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[TRUNC]], [[TRUNC1]]
72 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SUB]](s32)
73 ; CHECK-NEXT: $x0 = COPY [[ANYEXT]](s64)
76 %2:_(s8) = G_TRUNC %0(s64)
77 %3:_(s8) = G_TRUNC %1(s64)
78 %4:_(s8) = G_SUB %2, %3
79 %5:_(s64) = G_ANYEXT %4(s8)
84 name: test_vector_sub_v16s16
87 ; CHECK-LABEL: name: test_vector_sub_v16s16
88 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
89 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
90 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<8 x s16>) = G_SUB [[COPY]], [[COPY]]
91 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(<8 x s16>) = G_SUB [[COPY1]], [[COPY1]]
92 ; CHECK-NEXT: $q0 = COPY [[SUB]](<8 x s16>)
93 ; CHECK-NEXT: $q1 = COPY [[SUB1]](<8 x s16>)
94 %1:_(<8 x s16>) = COPY $q0
95 %2:_(<8 x s16>) = COPY $q1
96 %0:_(<16 x s16>) = G_CONCAT_VECTORS %1(<8 x s16>), %2(<8 x s16>)
97 %3:_(<16 x s16>) = G_SUB %0, %0
98 %4:_(<8 x s16>), %5:_(<8 x s16>) = G_UNMERGE_VALUES %3(<16 x s16>)
99 $q0 = COPY %4(<8 x s16>)
100 $q1 = COPY %5(<8 x s16>)
104 name: test_vector_sub_v32s8
107 ; CHECK-LABEL: name: test_vector_sub_v32s8
108 ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
109 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
110 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<16 x s8>) = G_SUB [[COPY]], [[COPY]]
111 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(<16 x s8>) = G_SUB [[COPY1]], [[COPY1]]
112 ; CHECK-NEXT: $q0 = COPY [[SUB]](<16 x s8>)
113 ; CHECK-NEXT: $q1 = COPY [[SUB1]](<16 x s8>)
114 %0:_(<16 x s8>) = COPY $q0
115 %1:_(<16 x s8>) = COPY $q1
116 %2:_(<32 x s8>) = G_CONCAT_VECTORS %0, %1
117 %3:_(<32 x s8>) = G_SUB %2, %2
118 %7:_(<16 x s8>), %8:_(<16 x s8>) = G_UNMERGE_VALUES %3(<32 x s8>)
119 $q0 = COPY %7(<16 x s8>)
120 $q1 = COPY %8(<16 x s8>)
125 tracksRegLiveness: true
128 liveins: $d0, $d1, $d2, $d3
130 ; CHECK-LABEL: name: sub_v2s1
131 ; CHECK: liveins: $d0, $d1, $d2, $d3
133 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
134 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
135 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<2 x s32>) = COPY $d2
136 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<2 x s32>) = COPY $d3
137 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<2 x s32>) = G_ICMP intpred(eq), [[COPY]](<2 x s32>), [[COPY1]]
138 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<2 x s32>) = G_ICMP intpred(eq), [[COPY2]](<2 x s32>), [[COPY3]]
139 ; CHECK-NEXT: [[sub:%[0-9]+]]:_(<2 x s32>) = G_SUB [[ICMP]], [[ICMP1]]
140 ; CHECK-NEXT: $d0 = COPY [[sub]](<2 x s32>)
141 ; CHECK-NEXT: RET_ReallyLR implicit $d0
142 %0:_(<2 x s32>) = COPY $d0
143 %1:_(<2 x s32>) = COPY $d1
144 %2:_(<2 x s32>) = COPY $d2
145 %3:_(<2 x s32>) = COPY $d3
146 %4:_(<2 x s1>) = G_ICMP intpred(eq), %0(<2 x s32>), %1
147 %5:_(<2 x s1>) = G_ICMP intpred(eq), %2(<2 x s32>), %3
148 %6:_(<2 x s1>) = G_SUB %4, %5
149 %7:_(<2 x s32>) = G_ANYEXT %6
150 $d0 = COPY %7:_(<2 x s32>)
151 RET_ReallyLR implicit $d0
155 tracksRegLiveness: true
158 liveins: $b0, $b1, $b2
160 ; CHECK-LABEL: name: sub_v3s1
161 ; CHECK: liveins: $b0, $b1, $b2
163 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $b0
164 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s8) = COPY $b1
165 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s8) = COPY $b2
166 ; CHECK-NEXT: [[ANYEXT0:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY]](s8)
167 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY1]](s8)
168 ; CHECK-NEXT: [[ANYEXT2:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY2]](s8)
169 ; CHECK-NEXT: [[IMPLICIT_DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
170 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s16>) = G_BUILD_VECTOR [[ANYEXT0]](s16), [[ANYEXT1]](s16), [[ANYEXT2]](s16), [[IMPLICIT_DEF]](s16)
171 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<4 x s16>) = G_SUB [[BUILD_VECTOR]], [[BUILD_VECTOR]]
172 ; CHECK-NEXT: [[VAL0:%[0-9]+]]:_(s16), [[VAL1:%[0-9]+]]:_(s16), [[VAL2:%[0-9]+]]:_(s16), [[VAL3:%[0-9]+]]:_(s16) = G_UNMERGE_VALUES [[SUB]](<4 x s16>)
173 ; CHECK-NEXT: [[TRUNC3:%[0-9]+]]:_(s8) = G_TRUNC [[VAL0]](s16)
174 ; CHECK-NEXT: $b0 = COPY [[TRUNC3]](s8)
175 ; CHECK-NEXT: RET_ReallyLR implicit $b0
179 %4:_(<3 x s8>) = G_BUILD_VECTOR %1(s8), %2(s8), %3(s8)
180 %0:_(<3 x s1>) = G_TRUNC %4(<3 x s8>)
181 %5:_(<3 x s1>) = G_SUB %0, %0
182 %7:_(<3 x s8>) = G_ANYEXT %5(<3 x s1>)
183 %8:_(s8), %9:_(s8), %10:_(s8) = G_UNMERGE_VALUES %7(<3 x s8>)
185 RET_ReallyLR implicit $b0
189 tracksRegLiveness: true
192 liveins: $d0, $d1, $d2, $d3
194 ; CHECK-LABEL: name: sub_v4s1
195 ; CHECK: liveins: $d0, $d1, $d2, $d3
197 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
198 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
199 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<4 x s16>) = COPY $d2
200 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<4 x s16>) = COPY $d3
201 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<4 x s16>) = G_ICMP intpred(eq), [[COPY]](<4 x s16>), [[COPY1]]
202 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<4 x s16>) = G_ICMP intpred(eq), [[COPY2]](<4 x s16>), [[COPY3]]
203 ; CHECK-NEXT: [[sub:%[0-9]+]]:_(<4 x s16>) = G_SUB [[ICMP]], [[ICMP1]]
204 ; CHECK-NEXT: $d0 = COPY [[sub]](<4 x s16>)
205 ; CHECK-NEXT: RET_ReallyLR implicit $d0
206 %0:_(<4 x s16>) = COPY $d0
207 %1:_(<4 x s16>) = COPY $d1
208 %2:_(<4 x s16>) = COPY $d2
209 %3:_(<4 x s16>) = COPY $d3
210 %4:_(<4 x s1>) = G_ICMP intpred(eq), %0(<4 x s16>), %1
211 %5:_(<4 x s1>) = G_ICMP intpred(eq), %2(<4 x s16>), %3
212 %6:_(<4 x s1>) = G_SUB %4, %5
213 %7:_(<4 x s16>) = G_ANYEXT %6
214 $d0 = COPY %7:_(<4 x s16>)
215 RET_ReallyLR implicit $d0
219 tracksRegLiveness: true
222 liveins: $d0, $d1, $d2, $d3
224 ; CHECK-LABEL: name: sub_v8s1
225 ; CHECK: liveins: $d0, $d1, $d2, $d3
227 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
228 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
229 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<8 x s8>) = COPY $d2
230 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<8 x s8>) = COPY $d3
231 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<8 x s8>) = G_ICMP intpred(eq), [[COPY]](<8 x s8>), [[COPY1]]
232 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<8 x s8>) = G_ICMP intpred(eq), [[COPY2]](<8 x s8>), [[COPY3]]
233 ; CHECK-NEXT: [[sub:%[0-9]+]]:_(<8 x s8>) = G_SUB [[ICMP]], [[ICMP1]]
234 ; CHECK-NEXT: $d0 = COPY [[sub]](<8 x s8>)
235 ; CHECK-NEXT: RET_ReallyLR implicit $d0
236 %0:_(<8 x s8>) = COPY $d0
237 %1:_(<8 x s8>) = COPY $d1
238 %2:_(<8 x s8>) = COPY $d2
239 %3:_(<8 x s8>) = COPY $d3
240 %4:_(<8 x s1>) = G_ICMP intpred(eq), %0(<8 x s8>), %1
241 %5:_(<8 x s1>) = G_ICMP intpred(eq), %2(<8 x s8>), %3
242 %6:_(<8 x s1>) = G_SUB %4, %5
243 %7:_(<8 x s8>) = G_ANYEXT %6
244 $d0 = COPY %7:_(<8 x s8>)
245 RET_ReallyLR implicit $d0
249 tracksRegLiveness: true
252 liveins: $q0, $q1, $q2, $q3
254 ; CHECK-LABEL: name: sub_v16s1
255 ; CHECK: liveins: $q0, $q1, $q2, $q3
257 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
258 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
259 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<16 x s8>) = COPY $q2
260 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<16 x s8>) = COPY $q3
261 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<16 x s8>) = G_ICMP intpred(eq), [[COPY]](<16 x s8>), [[COPY1]]
262 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<16 x s8>) = G_ICMP intpred(eq), [[COPY2]](<16 x s8>), [[COPY3]]
263 ; CHECK-NEXT: [[sub:%[0-9]+]]:_(<16 x s8>) = G_SUB [[ICMP]], [[ICMP1]]
264 ; CHECK-NEXT: $q0 = COPY [[sub]](<16 x s8>)
265 ; CHECK-NEXT: RET_ReallyLR implicit $q0
266 %0:_(<16 x s8>) = COPY $q0
267 %1:_(<16 x s8>) = COPY $q1
268 %2:_(<16 x s8>) = COPY $q2
269 %3:_(<16 x s8>) = COPY $q3
270 %4:_(<16 x s1>) = G_ICMP intpred(eq), %0(<16 x s8>), %1
271 %5:_(<16 x s1>) = G_ICMP intpred(eq), %2(<16 x s8>), %3
272 %6:_(<16 x s1>) = G_SUB %4, %5
273 %7:_(<16 x s8>) = G_ANYEXT %6
274 $q0 = COPY %7:_(<16 x s8>)
275 RET_ReallyLR implicit $q0