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: [[USUBE:%[0-9]+]]:_(s64), [[USUBE1:%[0-9]+]]:_(s32) = G_USUBE [[COPY1]], [[COPY3]], [[USUBO1]]
15 ; CHECK-NEXT: $x0 = COPY [[USUBO]](s64)
16 ; CHECK-NEXT: $x1 = COPY [[USUBE]](s64)
21 %4:_(s128) = G_MERGE_VALUES %0(s64), %1(s64)
22 %5:_(s128) = G_MERGE_VALUES %2(s64), %3(s64)
23 %6:_(s128) = G_SUB %4, %5
24 %7:_(s64), %8:_(s64) = G_UNMERGE_VALUES %6(s128)
30 name: test_scalar_sub_big_nonpow2
33 ; CHECK-LABEL: name: test_scalar_sub_big_nonpow2
34 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
35 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
36 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x2
37 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x3
38 ; CHECK-NEXT: [[USUBO:%[0-9]+]]:_(s64), [[USUBO1:%[0-9]+]]:_(s32) = G_USUBO [[COPY]], [[COPY1]]
39 ; CHECK-NEXT: [[USUBE:%[0-9]+]]:_(s64), [[USUBE1:%[0-9]+]]:_(s32) = G_USUBE [[COPY1]], [[COPY2]], [[USUBO1]]
40 ; CHECK-NEXT: [[USUBE2:%[0-9]+]]:_(s64), [[USUBE3:%[0-9]+]]:_(s32) = G_USUBE [[COPY2]], [[COPY3]], [[USUBE1]]
41 ; CHECK-NEXT: $x0 = COPY [[USUBO]](s64)
42 ; CHECK-NEXT: $x1 = COPY [[USUBE]](s64)
43 ; CHECK-NEXT: $x2 = COPY [[USUBE2]](s64)
48 %4:_(s192) = G_MERGE_VALUES %0(s64), %1(s64), %2(s64)
49 %5:_(s192) = G_MERGE_VALUES %1(s64), %2(s64), %3(s64)
50 %6:_(s192) = G_SUB %4, %5
51 %7:_(s64), %8:_(s64), %9:_(s64) = G_UNMERGE_VALUES %6(s192)
58 name: test_scalar_sub_small
61 ; CHECK-LABEL: name: test_scalar_sub_small
62 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
63 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
64 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
65 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
66 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[TRUNC]], [[TRUNC1]]
67 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SUB]](s32)
68 ; CHECK-NEXT: $x0 = COPY [[ANYEXT]](s64)
71 %2:_(s8) = G_TRUNC %0(s64)
72 %3:_(s8) = G_TRUNC %1(s64)
73 %4:_(s8) = G_SUB %2, %3
74 %5:_(s64) = G_ANYEXT %4(s8)
79 name: test_vector_sub_v16s16
82 ; CHECK-LABEL: name: test_vector_sub_v16s16
83 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
84 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s16>) = COPY $q1
85 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<8 x s16>) = G_SUB [[COPY]], [[COPY]]
86 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(<8 x s16>) = G_SUB [[COPY1]], [[COPY1]]
87 ; CHECK-NEXT: $q0 = COPY [[SUB]](<8 x s16>)
88 ; CHECK-NEXT: $q1 = COPY [[SUB1]](<8 x s16>)
89 %1:_(<8 x s16>) = COPY $q0
90 %2:_(<8 x s16>) = COPY $q1
91 %0:_(<16 x s16>) = G_CONCAT_VECTORS %1(<8 x s16>), %2(<8 x s16>)
92 %3:_(<16 x s16>) = G_SUB %0, %0
93 %4:_(<8 x s16>), %5:_(<8 x s16>) = G_UNMERGE_VALUES %3(<16 x s16>)
94 $q0 = COPY %4(<8 x s16>)
95 $q1 = COPY %5(<8 x s16>)
99 name: test_vector_sub_v32s8
102 ; CHECK-LABEL: name: test_vector_sub_v32s8
103 ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
104 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
105 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<16 x s8>) = G_SUB [[COPY]], [[COPY]]
106 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(<16 x s8>) = G_SUB [[COPY1]], [[COPY1]]
107 ; CHECK-NEXT: $q0 = COPY [[SUB]](<16 x s8>)
108 ; CHECK-NEXT: $q1 = COPY [[SUB1]](<16 x s8>)
109 %0:_(<16 x s8>) = COPY $q0
110 %1:_(<16 x s8>) = COPY $q1
111 %2:_(<32 x s8>) = G_CONCAT_VECTORS %0, %1
112 %3:_(<32 x s8>) = G_SUB %2, %2
113 %7:_(<16 x s8>), %8:_(<16 x s8>) = G_UNMERGE_VALUES %3(<32 x s8>)
114 $q0 = COPY %7(<16 x s8>)
115 $q1 = COPY %8(<16 x s8>)
120 tracksRegLiveness: true
123 liveins: $d0, $d1, $d2, $d3
125 ; CHECK-LABEL: name: sub_v2s1
126 ; CHECK: liveins: $d0, $d1, $d2, $d3
128 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
129 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
130 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<2 x s32>) = COPY $d2
131 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<2 x s32>) = COPY $d3
132 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<2 x s32>) = G_ICMP intpred(eq), [[COPY]](<2 x s32>), [[COPY1]]
133 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<2 x s32>) = G_ICMP intpred(eq), [[COPY2]](<2 x s32>), [[COPY3]]
134 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<2 x s32>) = G_SUB [[ICMP]], [[ICMP1]]
135 ; CHECK-NEXT: $d0 = COPY [[SUB]](<2 x s32>)
136 ; CHECK-NEXT: RET_ReallyLR implicit $d0
137 %0:_(<2 x s32>) = COPY $d0
138 %1:_(<2 x s32>) = COPY $d1
139 %2:_(<2 x s32>) = COPY $d2
140 %3:_(<2 x s32>) = COPY $d3
141 %4:_(<2 x s1>) = G_ICMP intpred(eq), %0(<2 x s32>), %1
142 %5:_(<2 x s1>) = G_ICMP intpred(eq), %2(<2 x s32>), %3
143 %6:_(<2 x s1>) = G_SUB %4, %5
144 %7:_(<2 x s32>) = G_ANYEXT %6
145 $d0 = COPY %7:_(<2 x s32>)
146 RET_ReallyLR implicit $d0
150 tracksRegLiveness: true
153 liveins: $b0, $b1, $b2
155 ; CHECK-LABEL: name: sub_v3s1
156 ; CHECK: liveins: $b0, $b1, $b2
158 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s8) = COPY $b0
159 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s8) = COPY $b1
160 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s8) = COPY $b2
161 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY]](s8)
162 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY1]](s8)
163 ; CHECK-NEXT: [[ANYEXT2:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY2]](s8)
164 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s16) = G_IMPLICIT_DEF
165 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s16>) = G_BUILD_VECTOR [[ANYEXT]](s16), [[ANYEXT1]](s16), [[ANYEXT2]](s16), [[DEF]](s16)
166 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<4 x s16>) = G_SUB [[BUILD_VECTOR]], [[BUILD_VECTOR]]
167 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s16), [[UV1:%[0-9]+]]:_(s16), [[UV2:%[0-9]+]]:_(s16), [[UV3:%[0-9]+]]:_(s16) = G_UNMERGE_VALUES [[SUB]](<4 x s16>)
168 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[UV]](s16)
169 ; CHECK-NEXT: $b0 = COPY [[TRUNC]](s8)
170 ; CHECK-NEXT: RET_ReallyLR implicit $b0
174 %4:_(<3 x s8>) = G_BUILD_VECTOR %1(s8), %2(s8), %3(s8)
175 %0:_(<3 x s1>) = G_TRUNC %4(<3 x s8>)
176 %5:_(<3 x s1>) = G_SUB %0, %0
177 %7:_(<3 x s8>) = G_ANYEXT %5(<3 x s1>)
178 %8:_(s8), %9:_(s8), %10:_(s8) = G_UNMERGE_VALUES %7(<3 x s8>)
180 RET_ReallyLR implicit $b0
184 tracksRegLiveness: true
187 liveins: $d0, $d1, $d2, $d3
189 ; CHECK-LABEL: name: sub_v4s1
190 ; CHECK: liveins: $d0, $d1, $d2, $d3
192 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
193 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s16>) = COPY $d1
194 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<4 x s16>) = COPY $d2
195 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<4 x s16>) = COPY $d3
196 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<4 x s16>) = G_ICMP intpred(eq), [[COPY]](<4 x s16>), [[COPY1]]
197 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<4 x s16>) = G_ICMP intpred(eq), [[COPY2]](<4 x s16>), [[COPY3]]
198 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<4 x s16>) = G_SUB [[ICMP]], [[ICMP1]]
199 ; CHECK-NEXT: $d0 = COPY [[SUB]](<4 x s16>)
200 ; CHECK-NEXT: RET_ReallyLR implicit $d0
201 %0:_(<4 x s16>) = COPY $d0
202 %1:_(<4 x s16>) = COPY $d1
203 %2:_(<4 x s16>) = COPY $d2
204 %3:_(<4 x s16>) = COPY $d3
205 %4:_(<4 x s1>) = G_ICMP intpred(eq), %0(<4 x s16>), %1
206 %5:_(<4 x s1>) = G_ICMP intpred(eq), %2(<4 x s16>), %3
207 %6:_(<4 x s1>) = G_SUB %4, %5
208 %7:_(<4 x s16>) = G_ANYEXT %6
209 $d0 = COPY %7:_(<4 x s16>)
210 RET_ReallyLR implicit $d0
214 tracksRegLiveness: true
217 liveins: $d0, $d1, $d2, $d3
219 ; CHECK-LABEL: name: sub_v8s1
220 ; CHECK: liveins: $d0, $d1, $d2, $d3
222 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<8 x s8>) = COPY $d0
223 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<8 x s8>) = COPY $d1
224 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<8 x s8>) = COPY $d2
225 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<8 x s8>) = COPY $d3
226 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<8 x s8>) = G_ICMP intpred(eq), [[COPY]](<8 x s8>), [[COPY1]]
227 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<8 x s8>) = G_ICMP intpred(eq), [[COPY2]](<8 x s8>), [[COPY3]]
228 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<8 x s8>) = G_SUB [[ICMP]], [[ICMP1]]
229 ; CHECK-NEXT: $d0 = COPY [[SUB]](<8 x s8>)
230 ; CHECK-NEXT: RET_ReallyLR implicit $d0
231 %0:_(<8 x s8>) = COPY $d0
232 %1:_(<8 x s8>) = COPY $d1
233 %2:_(<8 x s8>) = COPY $d2
234 %3:_(<8 x s8>) = COPY $d3
235 %4:_(<8 x s1>) = G_ICMP intpred(eq), %0(<8 x s8>), %1
236 %5:_(<8 x s1>) = G_ICMP intpred(eq), %2(<8 x s8>), %3
237 %6:_(<8 x s1>) = G_SUB %4, %5
238 %7:_(<8 x s8>) = G_ANYEXT %6
239 $d0 = COPY %7:_(<8 x s8>)
240 RET_ReallyLR implicit $d0
244 tracksRegLiveness: true
247 liveins: $q0, $q1, $q2, $q3
249 ; CHECK-LABEL: name: sub_v16s1
250 ; CHECK: liveins: $q0, $q1, $q2, $q3
252 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
253 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<16 x s8>) = COPY $q1
254 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(<16 x s8>) = COPY $q2
255 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(<16 x s8>) = COPY $q3
256 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<16 x s8>) = G_ICMP intpred(eq), [[COPY]](<16 x s8>), [[COPY1]]
257 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<16 x s8>) = G_ICMP intpred(eq), [[COPY2]](<16 x s8>), [[COPY3]]
258 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(<16 x s8>) = G_SUB [[ICMP]], [[ICMP1]]
259 ; CHECK-NEXT: $q0 = COPY [[SUB]](<16 x s8>)
260 ; CHECK-NEXT: RET_ReallyLR implicit $q0
261 %0:_(<16 x s8>) = COPY $q0
262 %1:_(<16 x s8>) = COPY $q1
263 %2:_(<16 x s8>) = COPY $q2
264 %3:_(<16 x s8>) = COPY $q3
265 %4:_(<16 x s1>) = G_ICMP intpred(eq), %0(<16 x s8>), %1
266 %5:_(<16 x s1>) = G_ICMP intpred(eq), %2(<16 x s8>), %3
267 %6:_(<16 x s1>) = G_SUB %4, %5
268 %7:_(<16 x s8>) = G_ANYEXT %6
269 $q0 = COPY %7:_(<16 x s8>)
270 RET_ReallyLR implicit $q0