1 //===- GISelUtilsTest.cpp -------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "GISelMITest.h"
10 #include "llvm/CodeGen/GlobalISel/Utils.h"
11 #include "gtest/gtest.h"
16 static const LLT S1
= LLT::scalar(1);
17 static const LLT S8
= LLT::scalar(8);
18 static const LLT S16
= LLT::scalar(16);
19 static const LLT S32
= LLT::scalar(32);
20 static const LLT S64
= LLT::scalar(64);
21 static const LLT P0
= LLT::pointer(0, 64);
22 static const LLT P1
= LLT::pointer(1, 32);
24 static const LLT V2S8
= LLT::fixed_vector(2, 8);
25 static const LLT V4S8
= LLT::fixed_vector(4, 8);
26 static const LLT V8S8
= LLT::fixed_vector(8, 8);
28 static const LLT V2S16
= LLT::fixed_vector(2, 16);
29 static const LLT V3S16
= LLT::fixed_vector(3, 16);
30 static const LLT V4S16
= LLT::fixed_vector(4, 16);
32 static const LLT V2S32
= LLT::fixed_vector(2, 32);
33 static const LLT V3S32
= LLT::fixed_vector(3, 32);
34 static const LLT V4S32
= LLT::fixed_vector(4, 32);
35 static const LLT V6S32
= LLT::fixed_vector(6, 32);
37 static const LLT V2S64
= LLT::fixed_vector(2, 64);
38 static const LLT V3S64
= LLT::fixed_vector(3, 64);
39 static const LLT V4S64
= LLT::fixed_vector(4, 64);
41 static const LLT V2P0
= LLT::fixed_vector(2, P0
);
42 static const LLT V3P0
= LLT::fixed_vector(3, P0
);
43 static const LLT V4P0
= LLT::fixed_vector(4, P0
);
44 static const LLT V6P0
= LLT::fixed_vector(6, P0
);
46 static const LLT V2P1
= LLT::fixed_vector(2, P1
);
47 static const LLT V4P1
= LLT::fixed_vector(4, P1
);
49 static const LLT NXV1S1
= LLT::scalable_vector(1, S1
);
50 static const LLT NXV2S1
= LLT::scalable_vector(2, S1
);
51 static const LLT NXV3S1
= LLT::scalable_vector(3, S1
);
52 static const LLT NXV4S1
= LLT::scalable_vector(4, S1
);
53 static const LLT NXV12S1
= LLT::scalable_vector(12, S1
);
54 static const LLT NXV32S1
= LLT::scalable_vector(32, S1
);
55 static const LLT NXV64S1
= LLT::scalable_vector(64, S1
);
56 static const LLT NXV128S1
= LLT::scalable_vector(128, S1
);
57 static const LLT NXV384S1
= LLT::scalable_vector(384, S1
);
59 static const LLT NXV1S32
= LLT::scalable_vector(1, S32
);
60 static const LLT NXV2S32
= LLT::scalable_vector(2, S32
);
61 static const LLT NXV3S32
= LLT::scalable_vector(3, S32
);
62 static const LLT NXV4S32
= LLT::scalable_vector(4, S32
);
63 static const LLT NXV8S32
= LLT::scalable_vector(8, S32
);
64 static const LLT NXV12S32
= LLT::scalable_vector(12, S32
);
65 static const LLT NXV24S32
= LLT::scalable_vector(24, S32
);
67 static const LLT NXV1S64
= LLT::scalable_vector(1, S64
);
68 static const LLT NXV2S64
= LLT::scalable_vector(2, S64
);
69 static const LLT NXV3S64
= LLT::scalable_vector(3, S64
);
70 static const LLT NXV4S64
= LLT::scalable_vector(4, S64
);
71 static const LLT NXV6S64
= LLT::scalable_vector(6, S64
);
72 static const LLT NXV12S64
= LLT::scalable_vector(12, S64
);
74 static const LLT NXV1P0
= LLT::scalable_vector(1, P0
);
75 static const LLT NXV2P0
= LLT::scalable_vector(2, P0
);
76 static const LLT NXV3P0
= LLT::scalable_vector(3, P0
);
77 static const LLT NXV4P0
= LLT::scalable_vector(4, P0
);
78 static const LLT NXV12P0
= LLT::scalable_vector(12, P0
);
80 TEST(GISelUtilsTest
, getGCDType
) {
81 EXPECT_EQ(S1
, getGCDType(S1
, S1
));
82 EXPECT_EQ(S32
, getGCDType(S32
, S32
));
83 EXPECT_EQ(S1
, getGCDType(S1
, S32
));
84 EXPECT_EQ(S1
, getGCDType(S32
, S1
));
85 EXPECT_EQ(S16
, getGCDType(S16
, S32
));
86 EXPECT_EQ(S16
, getGCDType(S32
, S16
));
88 EXPECT_EQ(V2S32
, getGCDType(V2S32
, V2S32
));
89 EXPECT_EQ(S32
, getGCDType(V3S32
, V2S32
));
90 EXPECT_EQ(S32
, getGCDType(V2S32
, V3S32
));
92 EXPECT_EQ(V2S16
, getGCDType(V4S16
, V2S16
));
93 EXPECT_EQ(V2S16
, getGCDType(V2S16
, V4S16
));
95 EXPECT_EQ(V2S32
, getGCDType(V4S32
, V2S32
));
96 EXPECT_EQ(V2S32
, getGCDType(V2S32
, V4S32
));
98 EXPECT_EQ(S16
, getGCDType(P0
, S16
));
99 EXPECT_EQ(S16
, getGCDType(S16
, P0
));
101 EXPECT_EQ(S32
, getGCDType(P0
, S32
));
102 EXPECT_EQ(S32
, getGCDType(S32
, P0
));
104 EXPECT_EQ(P0
, getGCDType(P0
, S64
));
105 EXPECT_EQ(S64
, getGCDType(S64
, P0
));
107 EXPECT_EQ(S32
, getGCDType(P0
, P1
));
108 EXPECT_EQ(S32
, getGCDType(P1
, P0
));
110 EXPECT_EQ(P0
, getGCDType(V3P0
, V2P0
));
111 EXPECT_EQ(P0
, getGCDType(V2P0
, V3P0
));
113 EXPECT_EQ(P0
, getGCDType(P0
, V2P0
));
114 EXPECT_EQ(P0
, getGCDType(V2P0
, P0
));
117 EXPECT_EQ(V2P0
, getGCDType(V2P0
, V2P0
));
118 EXPECT_EQ(P0
, getGCDType(V3P0
, V2P0
));
119 EXPECT_EQ(P0
, getGCDType(V2P0
, V3P0
));
120 EXPECT_EQ(V2P0
, getGCDType(V4P0
, V2P0
));
122 EXPECT_EQ(V2P0
, getGCDType(V2P0
, V4P1
));
123 EXPECT_EQ(V4P1
, getGCDType(V4P1
, V2P0
));
125 EXPECT_EQ(V2P0
, getGCDType(V4P0
, V4P1
));
126 EXPECT_EQ(V4P1
, getGCDType(V4P1
, V4P0
));
128 // Elements have same size, but have different pointeriness, so prefer the
129 // original element type.
130 EXPECT_EQ(V2P0
, getGCDType(V2P0
, V4S64
));
131 EXPECT_EQ(V2S64
, getGCDType(V4S64
, V2P0
));
133 EXPECT_EQ(V2S16
, getGCDType(V2S16
, V4P1
));
134 EXPECT_EQ(P1
, getGCDType(V4P1
, V2S16
));
135 EXPECT_EQ(V2P1
, getGCDType(V4P1
, V4S16
));
136 EXPECT_EQ(V4S16
, getGCDType(V4S16
, V2P1
));
138 EXPECT_EQ(P0
, getGCDType(P0
, V2S64
));
139 EXPECT_EQ(S64
, getGCDType(V2S64
, P0
));
141 EXPECT_EQ(S16
, getGCDType(V2S16
, V3S16
));
142 EXPECT_EQ(S16
, getGCDType(V3S16
, V2S16
));
143 EXPECT_EQ(S16
, getGCDType(V3S16
, S16
));
144 EXPECT_EQ(S16
, getGCDType(S16
, V3S16
));
146 EXPECT_EQ(V2S16
, getGCDType(V2S16
, V2S32
));
147 EXPECT_EQ(S32
, getGCDType(V2S32
, V2S16
));
149 EXPECT_EQ(V4S8
, getGCDType(V4S8
, V2S32
));
150 EXPECT_EQ(S32
, getGCDType(V2S32
, V4S8
));
152 // Test cases where neither element type nicely divides.
153 EXPECT_EQ(LLT::scalar(3),
154 getGCDType(LLT::fixed_vector(3, 5), LLT::fixed_vector(2, 6)));
155 EXPECT_EQ(LLT::scalar(3),
156 getGCDType(LLT::fixed_vector(2, 6), LLT::fixed_vector(3, 5)));
158 // Have to go smaller than a pointer element.
159 EXPECT_EQ(LLT::scalar(3), getGCDType(LLT::fixed_vector(2, LLT::pointer(3, 6)),
160 LLT::fixed_vector(3, 5)));
161 EXPECT_EQ(LLT::scalar(3),
162 getGCDType(LLT::fixed_vector(3, 5),
163 LLT::fixed_vector(2, LLT::pointer(3, 6))));
165 EXPECT_EQ(V4S8
, getGCDType(V4S8
, S32
));
166 EXPECT_EQ(S32
, getGCDType(S32
, V4S8
));
167 EXPECT_EQ(V4S8
, getGCDType(V4S8
, P1
));
168 EXPECT_EQ(P1
, getGCDType(P1
, V4S8
));
170 EXPECT_EQ(V2S8
, getGCDType(V2S8
, V4S16
));
171 EXPECT_EQ(S16
, getGCDType(V4S16
, V2S8
));
173 EXPECT_EQ(S8
, getGCDType(V2S8
, LLT::fixed_vector(4, 2)));
174 EXPECT_EQ(LLT::fixed_vector(4, 2), getGCDType(LLT::fixed_vector(4, 2), S8
));
176 EXPECT_EQ(LLT::pointer(4, 8),
177 getGCDType(LLT::fixed_vector(2, LLT::pointer(4, 8)),
178 LLT::fixed_vector(4, 2)));
180 EXPECT_EQ(LLT::fixed_vector(4, 2),
181 getGCDType(LLT::fixed_vector(4, 2),
182 LLT::fixed_vector(2, LLT::pointer(4, 8))));
184 EXPECT_EQ(LLT::scalar(4), getGCDType(LLT::fixed_vector(3, 4), S8
));
185 EXPECT_EQ(LLT::scalar(4), getGCDType(S8
, LLT::fixed_vector(3, 4)));
187 // Scalable -> Scalable
188 EXPECT_EQ(NXV1S1
, getGCDType(NXV1S1
, NXV1S32
));
189 EXPECT_EQ(NXV1S32
, getGCDType(NXV1S64
, NXV1S32
));
190 EXPECT_EQ(NXV1S32
, getGCDType(NXV1S32
, NXV1S64
));
191 EXPECT_EQ(NXV1P0
, getGCDType(NXV1P0
, NXV1S64
));
192 EXPECT_EQ(NXV1S64
, getGCDType(NXV1S64
, NXV1P0
));
194 EXPECT_EQ(NXV4S1
, getGCDType(NXV4S1
, NXV4S32
));
195 EXPECT_EQ(NXV2S64
, getGCDType(NXV4S64
, NXV4S32
));
196 EXPECT_EQ(NXV4S32
, getGCDType(NXV4S32
, NXV4S64
));
197 EXPECT_EQ(NXV4P0
, getGCDType(NXV4P0
, NXV4S64
));
198 EXPECT_EQ(NXV4S64
, getGCDType(NXV4S64
, NXV4P0
));
200 EXPECT_EQ(NXV4S1
, getGCDType(NXV4S1
, NXV2S32
));
201 EXPECT_EQ(NXV1S64
, getGCDType(NXV4S64
, NXV2S32
));
202 EXPECT_EQ(NXV4S32
, getGCDType(NXV4S32
, NXV2S64
));
203 EXPECT_EQ(NXV2P0
, getGCDType(NXV4P0
, NXV2S64
));
204 EXPECT_EQ(NXV2S64
, getGCDType(NXV4S64
, NXV2P0
));
206 EXPECT_EQ(NXV2S1
, getGCDType(NXV2S1
, NXV4S32
));
207 EXPECT_EQ(NXV2S64
, getGCDType(NXV2S64
, NXV4S32
));
208 EXPECT_EQ(NXV2S32
, getGCDType(NXV2S32
, NXV4S64
));
209 EXPECT_EQ(NXV2P0
, getGCDType(NXV2P0
, NXV4S64
));
210 EXPECT_EQ(NXV2S64
, getGCDType(NXV2S64
, NXV4P0
));
212 EXPECT_EQ(NXV1S1
, getGCDType(NXV3S1
, NXV4S32
));
213 EXPECT_EQ(NXV1S64
, getGCDType(NXV3S64
, NXV4S32
));
214 EXPECT_EQ(NXV1S32
, getGCDType(NXV3S32
, NXV4S64
));
215 EXPECT_EQ(NXV1P0
, getGCDType(NXV3P0
, NXV4S64
));
216 EXPECT_EQ(NXV1S64
, getGCDType(NXV3S64
, NXV4P0
));
218 EXPECT_EQ(NXV1S1
, getGCDType(NXV3S1
, NXV4S1
));
219 EXPECT_EQ(NXV1S32
, getGCDType(NXV3S32
, NXV4S32
));
220 EXPECT_EQ(NXV1S64
, getGCDType(NXV3S64
, NXV4S64
));
221 EXPECT_EQ(NXV1P0
, getGCDType(NXV3P0
, NXV4P0
));
225 EXPECT_EQ(S1
, getGCDType(NXV1S1
, S1
));
226 EXPECT_EQ(S1
, getGCDType(NXV1S1
, S32
));
227 EXPECT_EQ(S1
, getGCDType(NXV1S32
, S1
));
228 EXPECT_EQ(S32
, getGCDType(NXV1S32
, S32
));
229 EXPECT_EQ(S32
, getGCDType(NXV1S32
, S64
));
230 EXPECT_EQ(S1
, getGCDType(NXV2S32
, S1
));
231 EXPECT_EQ(S32
, getGCDType(NXV2S32
, S32
));
232 EXPECT_EQ(S32
, getGCDType(NXV2S32
, S64
));
234 EXPECT_EQ(S1
, getGCDType(S1
, NXV1S1
));
235 EXPECT_EQ(S1
, getGCDType(S32
, NXV1S1
));
236 EXPECT_EQ(S1
, getGCDType(S1
, NXV1S32
));
237 EXPECT_EQ(S32
, getGCDType(S32
, NXV1S32
));
238 EXPECT_EQ(S32
, getGCDType(S64
, NXV1S32
));
239 EXPECT_EQ(S1
, getGCDType(S1
, NXV2S32
));
240 EXPECT_EQ(S32
, getGCDType(S32
, NXV2S32
));
241 EXPECT_EQ(S32
, getGCDType(S64
, NXV2S32
));
244 TEST(GISelUtilsTest
, getLCMType
) {
245 EXPECT_EQ(S1
, getLCMType(S1
, S1
));
246 EXPECT_EQ(S32
, getLCMType(S32
, S1
));
247 EXPECT_EQ(S32
, getLCMType(S1
, S32
));
248 EXPECT_EQ(S32
, getLCMType(S32
, S32
));
250 EXPECT_EQ(S32
, getLCMType(S32
, S16
));
251 EXPECT_EQ(S32
, getLCMType(S16
, S32
));
253 EXPECT_EQ(S64
, getLCMType(S64
, P0
));
254 EXPECT_EQ(P0
, getLCMType(P0
, S64
));
256 EXPECT_EQ(P0
, getLCMType(S32
, P0
));
257 EXPECT_EQ(P0
, getLCMType(P0
, S32
));
259 EXPECT_EQ(S32
, getLCMType(S32
, P1
));
260 EXPECT_EQ(P1
, getLCMType(P1
, S32
));
261 EXPECT_EQ(P0
, getLCMType(P0
, P0
));
262 EXPECT_EQ(P1
, getLCMType(P1
, P1
));
264 EXPECT_EQ(P0
, getLCMType(P0
, P1
));
265 EXPECT_EQ(P0
, getLCMType(P1
, P0
));
267 EXPECT_EQ(V2S32
, getLCMType(V2S32
, V2S32
));
268 EXPECT_EQ(V2S32
, getLCMType(V2S32
, S32
));
269 EXPECT_EQ(V2S32
, getLCMType(S32
, V2S32
));
270 EXPECT_EQ(V2S32
, getLCMType(V2S32
, V2S32
));
271 EXPECT_EQ(V6S32
, getLCMType(V2S32
, V3S32
));
272 EXPECT_EQ(V6S32
, getLCMType(V3S32
, V2S32
));
273 EXPECT_EQ(LLT::fixed_vector(12, S32
), getLCMType(V4S32
, V3S32
));
274 EXPECT_EQ(LLT::fixed_vector(12, S32
), getLCMType(V3S32
, V4S32
));
276 EXPECT_EQ(V2P0
, getLCMType(V2P0
, V2P0
));
277 EXPECT_EQ(V2P0
, getLCMType(V2P0
, P0
));
278 EXPECT_EQ(V2P0
, getLCMType(P0
, V2P0
));
279 EXPECT_EQ(V2P0
, getLCMType(V2P0
, V2P0
));
280 EXPECT_EQ(V6P0
, getLCMType(V2P0
, V3P0
));
281 EXPECT_EQ(V6P0
, getLCMType(V3P0
, V2P0
));
282 EXPECT_EQ(LLT::fixed_vector(12, P0
), getLCMType(V4P0
, V3P0
));
283 EXPECT_EQ(LLT::fixed_vector(12, P0
), getLCMType(V3P0
, V4P0
));
285 EXPECT_EQ(LLT::fixed_vector(12, S64
), getLCMType(V4S64
, V3P0
));
286 EXPECT_EQ(LLT::fixed_vector(12, P0
), getLCMType(V3P0
, V4S64
));
288 EXPECT_EQ(LLT::fixed_vector(12, P0
), getLCMType(V4P0
, V3S64
));
289 EXPECT_EQ(LLT::fixed_vector(12, S64
), getLCMType(V3S64
, V4P0
));
291 EXPECT_EQ(V2P0
, getLCMType(V2P0
, S32
));
292 EXPECT_EQ(V4S32
, getLCMType(S32
, V2P0
));
293 EXPECT_EQ(V2P0
, getLCMType(V2P0
, S64
));
294 EXPECT_EQ(V2S64
, getLCMType(S64
, V2P0
));
297 EXPECT_EQ(V2P0
, getLCMType(V2P0
, V2P1
));
298 EXPECT_EQ(V4P1
, getLCMType(V2P1
, V2P0
));
300 EXPECT_EQ(V2P0
, getLCMType(V2P0
, V4P1
));
301 EXPECT_EQ(V4P1
, getLCMType(V4P1
, V2P0
));
304 EXPECT_EQ(V2S32
, getLCMType(V2S32
, S64
));
305 EXPECT_EQ(S64
, getLCMType(S64
, V2S32
));
307 EXPECT_EQ(V4S16
, getLCMType(V4S16
, V2S32
));
308 EXPECT_EQ(V2S32
, getLCMType(V2S32
, V4S16
));
310 EXPECT_EQ(V2S32
, getLCMType(V2S32
, V4S8
));
311 EXPECT_EQ(V8S8
, getLCMType(V4S8
, V2S32
));
313 EXPECT_EQ(V2S16
, getLCMType(V2S16
, V4S8
));
314 EXPECT_EQ(V4S8
, getLCMType(V4S8
, V2S16
));
316 EXPECT_EQ(LLT::fixed_vector(6, S16
), getLCMType(V3S16
, V4S8
));
317 EXPECT_EQ(LLT::fixed_vector(12, S8
), getLCMType(V4S8
, V3S16
));
318 EXPECT_EQ(V4S16
, getLCMType(V4S16
, V4S8
));
319 EXPECT_EQ(V8S8
, getLCMType(V4S8
, V4S16
));
321 EXPECT_EQ(LLT::fixed_vector(6, 4), getLCMType(LLT::fixed_vector(3, 4), S8
));
322 EXPECT_EQ(LLT::fixed_vector(3, 8), getLCMType(S8
, LLT::fixed_vector(3, 4)));
324 EXPECT_EQ(LLT::fixed_vector(6, 4),
325 getLCMType(LLT::fixed_vector(3, 4), LLT::pointer(4, 8)));
326 EXPECT_EQ(LLT::fixed_vector(3, LLT::pointer(4, 8)),
327 getLCMType(LLT::pointer(4, 8), LLT::fixed_vector(3, 4)));
329 EXPECT_EQ(V2S64
, getLCMType(V2S64
, P0
));
330 EXPECT_EQ(V2P0
, getLCMType(P0
, V2S64
));
332 EXPECT_EQ(V2S64
, getLCMType(V2S64
, P1
));
333 EXPECT_EQ(V4P1
, getLCMType(P1
, V2S64
));
335 // Scalable, Scalable
336 EXPECT_EQ(NXV32S1
, getLCMType(NXV1S1
, NXV1S32
));
337 EXPECT_EQ(NXV1S64
, getLCMType(NXV1S64
, NXV1S32
));
338 EXPECT_EQ(NXV2S32
, getLCMType(NXV1S32
, NXV1S64
));
339 EXPECT_EQ(NXV1P0
, getLCMType(NXV1P0
, NXV1S64
));
340 EXPECT_EQ(NXV1S64
, getLCMType(NXV1S64
, NXV1P0
));
342 EXPECT_EQ(NXV128S1
, getLCMType(NXV4S1
, NXV4S32
));
343 EXPECT_EQ(NXV4S64
, getLCMType(NXV4S64
, NXV4S32
));
344 EXPECT_EQ(NXV8S32
, getLCMType(NXV4S32
, NXV4S64
));
345 EXPECT_EQ(NXV4P0
, getLCMType(NXV4P0
, NXV4S64
));
346 EXPECT_EQ(NXV4S64
, getLCMType(NXV4S64
, NXV4P0
));
348 EXPECT_EQ(NXV64S1
, getLCMType(NXV4S1
, NXV2S32
));
349 EXPECT_EQ(NXV4S64
, getLCMType(NXV4S64
, NXV2S32
));
350 EXPECT_EQ(NXV4S32
, getLCMType(NXV4S32
, NXV2S64
));
351 EXPECT_EQ(NXV4P0
, getLCMType(NXV4P0
, NXV2S64
));
352 EXPECT_EQ(NXV4S64
, getLCMType(NXV4S64
, NXV2P0
));
354 EXPECT_EQ(NXV128S1
, getLCMType(NXV2S1
, NXV4S32
));
355 EXPECT_EQ(NXV2S64
, getLCMType(NXV2S64
, NXV4S32
));
356 EXPECT_EQ(NXV8S32
, getLCMType(NXV2S32
, NXV4S64
));
357 EXPECT_EQ(NXV4P0
, getLCMType(NXV2P0
, NXV4S64
));
358 EXPECT_EQ(NXV4S64
, getLCMType(NXV2S64
, NXV4P0
));
360 EXPECT_EQ(NXV384S1
, getLCMType(NXV3S1
, NXV4S32
));
361 EXPECT_EQ(NXV6S64
, getLCMType(NXV3S64
, NXV4S32
));
362 EXPECT_EQ(NXV24S32
, getLCMType(NXV3S32
, NXV4S64
));
363 EXPECT_EQ(NXV12P0
, getLCMType(NXV3P0
, NXV4S64
));
364 EXPECT_EQ(NXV12S64
, getLCMType(NXV3S64
, NXV4P0
));
366 EXPECT_EQ(NXV12S1
, getLCMType(NXV3S1
, NXV4S1
));
367 EXPECT_EQ(NXV12S32
, getLCMType(NXV3S32
, NXV4S32
));
368 EXPECT_EQ(NXV12S64
, getLCMType(NXV3S64
, NXV4S64
));
369 EXPECT_EQ(NXV12P0
, getLCMType(NXV3P0
, NXV4P0
));
373 EXPECT_EQ(NXV1S1
, getLCMType(NXV1S1
, S1
));
374 EXPECT_EQ(NXV32S1
, getLCMType(NXV1S1
, S32
));
375 EXPECT_EQ(NXV1S32
, getLCMType(NXV1S32
, S1
));
376 EXPECT_EQ(NXV1S32
, getLCMType(NXV1S32
, S32
));
377 EXPECT_EQ(NXV2S32
, getLCMType(NXV1S32
, S64
));
378 EXPECT_EQ(NXV2S32
, getLCMType(NXV2S32
, S1
));
379 EXPECT_EQ(NXV2S32
, getLCMType(NXV2S32
, S32
));
380 EXPECT_EQ(NXV2S32
, getLCMType(NXV2S32
, S64
));
382 EXPECT_EQ(NXV1S1
, getLCMType(S1
, NXV1S1
));
383 EXPECT_EQ(NXV1S32
, getLCMType(S32
, NXV1S1
));
384 EXPECT_EQ(NXV32S1
, getLCMType(S1
, NXV1S32
));
385 EXPECT_EQ(NXV1S32
, getLCMType(S32
, NXV1S32
));
386 EXPECT_EQ(NXV1S64
, getLCMType(S64
, NXV1S32
));
387 EXPECT_EQ(NXV64S1
, getLCMType(S1
, NXV2S32
));
388 EXPECT_EQ(NXV2S32
, getLCMType(S32
, NXV2S32
));
389 EXPECT_EQ(NXV1S64
, getLCMType(S64
, NXV2S32
));
392 TEST_F(AArch64GISelMITest
, ConstFalseTest
) {
396 const auto &TLI
= *B
.getMF().getSubtarget().getTargetLowering();
397 bool BooleanChoices
[2] = {true, false};
399 // AArch64 uses ZeroOrOneBooleanContent for scalars, and
400 // ZeroOrNegativeOneBooleanContent for vectors.
401 for (auto IsVec
: BooleanChoices
) {
402 for (auto IsFP
: BooleanChoices
) {
403 EXPECT_TRUE(isConstFalseVal(TLI
, 0, IsVec
, IsFP
));
404 EXPECT_FALSE(isConstFalseVal(TLI
, 1, IsVec
, IsFP
));
406 // This would be true with UndefinedBooleanContent.
407 EXPECT_FALSE(isConstFalseVal(TLI
, 2, IsVec
, IsFP
));