1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | |* *| |
3 | |* AArch64PostLegalizerLoweringImpl Combiner Match Table *| |
4 | |* *| |
5 | |* Automatically generated file, do not edit! *| |
6 | |* *| |
7 | \*===----------------------------------------------------------------------===*/ |
8 | |
9 | #ifdef GET_GICOMBINER_DEPS |
10 | #include "llvm/ADT/SparseBitVector.h" |
11 | namespace llvm { |
12 | extern cl::OptionCategory GICombinerOptionCategory; |
13 | } // end namespace llvm |
14 | #endif // ifdef GET_GICOMBINER_DEPS |
15 | |
16 | #ifdef GET_GICOMBINER_TYPES |
17 | struct AArch64PostLegalizerLoweringImplRuleConfig { |
18 | SparseBitVector<> DisabledRules; |
19 | |
20 | bool isRuleEnabled(unsigned RuleID) const; |
21 | bool parseCommandLineOption(); |
22 | bool setRuleEnabled(StringRef RuleIdentifier); |
23 | bool setRuleDisabled(StringRef RuleIdentifier); |
24 | }; |
25 | |
26 | static std::optional<uint64_t> getRuleIdxForIdentifier(StringRef RuleIdentifier) { |
27 | uint64_t I; |
28 | // getAtInteger(...) returns false on success |
29 | bool Parsed = !RuleIdentifier.getAsInteger(0, I); |
30 | if (Parsed) |
31 | return I; |
32 | |
33 | #ifndef NDEBUG |
34 | switch (RuleIdentifier.size()) { |
35 | default: break; |
36 | case 3: // 6 strings to match. |
37 | switch (RuleIdentifier[0]) { |
38 | default: break; |
39 | case 'd': // 1 string to match. |
40 | if (memcmp(RuleIdentifier.data()+1, "up" , 2) != 0) |
41 | break; |
42 | return 0; // "dup" |
43 | case 'e': // 1 string to match. |
44 | if (memcmp(RuleIdentifier.data()+1, "xt" , 2) != 0) |
45 | break; |
46 | return 2; // "ext" |
47 | case 'r': // 1 string to match. |
48 | if (memcmp(RuleIdentifier.data()+1, "ev" , 2) != 0) |
49 | break; |
50 | return 1; // "rev" |
51 | case 't': // 1 string to match. |
52 | if (memcmp(RuleIdentifier.data()+1, "rn" , 2) != 0) |
53 | break; |
54 | return 5; // "trn" |
55 | case 'u': // 1 string to match. |
56 | if (memcmp(RuleIdentifier.data()+1, "zp" , 2) != 0) |
57 | break; |
58 | return 4; // "uzp" |
59 | case 'z': // 1 string to match. |
60 | if (memcmp(RuleIdentifier.data()+1, "ip" , 2) != 0) |
61 | break; |
62 | return 3; // "zip" |
63 | } |
64 | break; |
65 | case 10: // 1 string to match. |
66 | if (memcmp(RuleIdentifier.data()+0, "lower_mull" , 10) != 0) |
67 | break; |
68 | return 16; // "lower_mull" |
69 | case 11: // 1 string to match. |
70 | if (memcmp(RuleIdentifier.data()+0, "shuf_to_ins" , 11) != 0) |
71 | break; |
72 | return 7; // "shuf_to_ins" |
73 | case 12: // 1 string to match. |
74 | if (memcmp(RuleIdentifier.data()+0, "form_duplane" , 12) != 0) |
75 | break; |
76 | return 6; // "form_duplane" |
77 | case 15: // 3 strings to match. |
78 | switch (RuleIdentifier[0]) { |
79 | default: break; |
80 | case 'a': // 1 string to match. |
81 | if (memcmp(RuleIdentifier.data()+1, "djust_icmp_imm" , 14) != 0) |
82 | break; |
83 | return 9; // "adjust_icmp_imm" |
84 | case 'f': // 1 string to match. |
85 | if (memcmp(RuleIdentifier.data()+1, "orm_truncstore" , 14) != 0) |
86 | break; |
87 | return 13; // "form_truncstore" |
88 | case 'v': // 1 string to match. |
89 | if (memcmp(RuleIdentifier.data()+1, "ashr_vlshr_imm" , 14) != 0) |
90 | break; |
91 | return 8; // "vashr_vlshr_imm" |
92 | } |
93 | break; |
94 | case 17: // 1 string to match. |
95 | if (memcmp(RuleIdentifier.data()+0, "lower_vector_fcmp" , 17) != 0) |
96 | break; |
97 | return 12; // "lower_vector_fcmp" |
98 | case 18: // 2 strings to match. |
99 | switch (RuleIdentifier[0]) { |
100 | default: break; |
101 | case 'i': // 1 string to match. |
102 | if (memcmp(RuleIdentifier.data()+1, "nsertelt_nonconst" , 17) != 0) |
103 | break; |
104 | return 18; // "insertelt_nonconst" |
105 | case 's': // 1 string to match. |
106 | if (memcmp(RuleIdentifier.data()+1, "wap_icmp_operands" , 17) != 0) |
107 | break; |
108 | return 10; // "swap_icmp_operands" |
109 | } |
110 | break; |
111 | case 19: // 1 string to match. |
112 | if (memcmp(RuleIdentifier.data()+0, "build_vector_to_dup" , 19) != 0) |
113 | break; |
114 | return 11; // "build_vector_to_dup" |
115 | case 22: // 1 string to match. |
116 | if (memcmp(RuleIdentifier.data()+0, "unmerge_ext_to_unmerge" , 22) != 0) |
117 | break; |
118 | return 15; // "unmerge_ext_to_unmerge" |
119 | case 23: // 1 string to match. |
120 | if (memcmp(RuleIdentifier.data()+0, "vector_unmerge_lowering" , 23) != 0) |
121 | break; |
122 | return 17; // "vector_unmerge_lowering" |
123 | case 26: // 1 string to match. |
124 | if (memcmp(RuleIdentifier.data()+0, "vector_sext_inreg_to_shift" , 26) != 0) |
125 | break; |
126 | return 14; // "vector_sext_inreg_to_shift" |
127 | } |
128 | #endif // ifndef NDEBUG |
129 | |
130 | return std::nullopt; |
131 | } |
132 | static std::optional<std::pair<uint64_t, uint64_t>> getRuleRangeForIdentifier(StringRef RuleIdentifier) { |
133 | std::pair<StringRef, StringRef> RangePair = RuleIdentifier.split('-'); |
134 | if (!RangePair.second.empty()) { |
135 | const auto First = getRuleIdxForIdentifier(RangePair.first); |
136 | const auto Last = getRuleIdxForIdentifier(RangePair.second); |
137 | if (!First || !Last) |
138 | return std::nullopt; |
139 | if (First >= Last) |
140 | report_fatal_error("Beginning of range should be before end of range" ); |
141 | return {{*First, *Last + 1}}; |
142 | } |
143 | if (RangePair.first == "*" ) { |
144 | return {{0, 19}}; |
145 | } |
146 | const auto I = getRuleIdxForIdentifier(RangePair.first); |
147 | if (!I) |
148 | return std::nullopt; |
149 | return {{*I, *I + 1}}; |
150 | } |
151 | |
152 | bool AArch64PostLegalizerLoweringImplRuleConfig::setRuleEnabled(StringRef RuleIdentifier) { |
153 | auto MaybeRange = getRuleRangeForIdentifier(RuleIdentifier); |
154 | if (!MaybeRange) |
155 | return false; |
156 | for (auto I = MaybeRange->first; I < MaybeRange->second; ++I) |
157 | DisabledRules.reset(I); |
158 | return true; |
159 | } |
160 | |
161 | bool AArch64PostLegalizerLoweringImplRuleConfig::setRuleDisabled(StringRef RuleIdentifier) { |
162 | auto MaybeRange = getRuleRangeForIdentifier(RuleIdentifier); |
163 | if (!MaybeRange) |
164 | return false; |
165 | for (auto I = MaybeRange->first; I < MaybeRange->second; ++I) |
166 | DisabledRules.set(I); |
167 | return true; |
168 | } |
169 | |
170 | static std::vector<std::string> AArch64PostLegalizerLoweringOption; |
171 | static cl::list<std::string> AArch64PostLegalizerLoweringDisableOption( |
172 | "aarch64postlegalizerlowering-disable-rule" , |
173 | cl::desc("Disable one or more combiner rules temporarily in the AArch64PostLegalizerLowering pass" ), |
174 | cl::CommaSeparated, |
175 | cl::Hidden, |
176 | cl::cat(GICombinerOptionCategory), |
177 | cl::callback([](const std::string &Str) { |
178 | AArch64PostLegalizerLoweringOption.push_back(Str); |
179 | })); |
180 | static cl::list<std::string> AArch64PostLegalizerLoweringOnlyEnableOption( |
181 | "aarch64postlegalizerlowering-only-enable-rule" , |
182 | cl::desc("Disable all rules in the AArch64PostLegalizerLowering pass then re-enable the specified ones" ), |
183 | cl::Hidden, |
184 | cl::cat(GICombinerOptionCategory), |
185 | cl::callback([](const std::string &CommaSeparatedArg) { |
186 | StringRef Str = CommaSeparatedArg; |
187 | AArch64PostLegalizerLoweringOption.push_back("*" ); |
188 | do { |
189 | auto X = Str.split("," ); |
190 | AArch64PostLegalizerLoweringOption.push_back(("!" + X.first).str()); |
191 | Str = X.second; |
192 | } while (!Str.empty()); |
193 | })); |
194 | |
195 | |
196 | bool AArch64PostLegalizerLoweringImplRuleConfig::isRuleEnabled(unsigned RuleID) const { |
197 | return !DisabledRules.test(RuleID); |
198 | } |
199 | bool AArch64PostLegalizerLoweringImplRuleConfig::parseCommandLineOption() { |
200 | for (StringRef Identifier : AArch64PostLegalizerLoweringOption) { |
201 | bool Enabled = Identifier.consume_front("!" ); |
202 | if (Enabled && !setRuleEnabled(Identifier)) |
203 | return false; |
204 | if (!Enabled && !setRuleDisabled(Identifier)) |
205 | return false; |
206 | } |
207 | return true; |
208 | } |
209 | |
210 | #endif // ifdef GET_GICOMBINER_TYPES |
211 | |
212 | #ifdef GET_GICOMBINER_TYPES |
213 | const unsigned MAX_SUBTARGET_PREDICATES = 0; |
214 | using PredicateBitset = llvm::Bitset<MAX_SUBTARGET_PREDICATES>; |
215 | #endif // ifdef GET_GICOMBINER_TYPES |
216 | |
217 | #ifdef GET_GICOMBINER_CLASS_MEMBERS |
218 | PredicateBitset AvailableModuleFeatures; |
219 | mutable PredicateBitset AvailableFunctionFeatures; |
220 | PredicateBitset getAvailableFeatures() const { |
221 | return AvailableModuleFeatures | AvailableFunctionFeatures; |
222 | } |
223 | PredicateBitset |
224 | computeAvailableModuleFeatures(const AArch64Subtarget *Subtarget) const; |
225 | PredicateBitset |
226 | computeAvailableFunctionFeatures(const AArch64Subtarget *Subtarget, |
227 | const MachineFunction *MF) const; |
228 | void setupGeneratedPerFunctionState(MachineFunction &MF) override; |
229 | #endif // ifdef GET_GICOMBINER_CLASS_MEMBERS |
230 | #ifdef GET_GICOMBINER_CLASS_MEMBERS |
231 | mutable MatcherState State; |
232 | typedef ComplexRendererFns(AArch64PostLegalizerLoweringImpl::*ComplexMatcherMemFn)(MachineOperand &) const; |
233 | typedef void(AArch64PostLegalizerLoweringImpl::*CustomRendererFn)(MachineInstrBuilder &, const MachineInstr &, int) const; |
234 | const ExecInfoTy<PredicateBitset, ComplexMatcherMemFn, CustomRendererFn> ExecInfo; |
235 | static AArch64PostLegalizerLoweringImpl::ComplexMatcherMemFn ComplexPredicateFns[]; |
236 | static AArch64PostLegalizerLoweringImpl::CustomRendererFn CustomRenderers[]; |
237 | bool testImmPredicate_I64(unsigned PredicateID, int64_t Imm) const override; |
238 | bool testImmPredicate_APInt(unsigned PredicateID, const APInt &Imm) const override; |
239 | bool testImmPredicate_APFloat(unsigned PredicateID, const APFloat &Imm) const override; |
240 | const uint8_t *getMatchTable() const override; |
241 | bool testMIPredicate_MI(unsigned PredicateID, const MachineInstr &MI, const MatcherState &State) const override; |
242 | bool testSimplePredicate(unsigned PredicateID) const override; |
243 | bool runCustomAction(unsigned FnID, const MatcherState &State, NewMIVector &OutMIs) const override; |
244 | #endif // ifdef GET_GICOMBINER_CLASS_MEMBERS |
245 | |
246 | #ifdef GET_GICOMBINER_IMPL |
247 | // LLT Objects. |
248 | enum { |
249 | GILLT_s1, |
250 | }; |
251 | const static size_t NumTypeObjects = 1; |
252 | const static LLT TypeObjects[] = { |
253 | LLT::scalar(1), |
254 | }; |
255 | |
256 | // Bits for subtarget features that participate in instruction matching. |
257 | enum SubtargetFeatureBits : uint8_t { |
258 | }; |
259 | |
260 | PredicateBitset AArch64PostLegalizerLoweringImpl:: |
261 | computeAvailableModuleFeatures(const AArch64Subtarget *Subtarget) const { |
262 | PredicateBitset Features{}; |
263 | return Features; |
264 | } |
265 | |
266 | void AArch64PostLegalizerLoweringImpl::setupGeneratedPerFunctionState(MachineFunction &MF) { |
267 | AvailableFunctionFeatures = computeAvailableFunctionFeatures((const AArch64Subtarget *)&MF.getSubtarget(), &MF); |
268 | } |
269 | PredicateBitset AArch64PostLegalizerLoweringImpl:: |
270 | computeAvailableFunctionFeatures(const AArch64Subtarget *Subtarget, const MachineFunction *MF) const { |
271 | PredicateBitset Features{}; |
272 | return Features; |
273 | } |
274 | |
275 | // Feature bitsets. |
276 | enum { |
277 | GIFBS_Invalid, |
278 | }; |
279 | constexpr static PredicateBitset FeatureBitsets[] { |
280 | {}, // GIFBS_Invalid |
281 | }; |
282 | |
283 | // ComplexPattern predicates. |
284 | enum { |
285 | GICP_Invalid, |
286 | }; |
287 | // See constructor for table contents |
288 | |
289 | AArch64PostLegalizerLoweringImpl::ComplexMatcherMemFn |
290 | AArch64PostLegalizerLoweringImpl::ComplexPredicateFns[] = { |
291 | nullptr, // GICP_Invalid |
292 | }; |
293 | |
294 | bool AArch64PostLegalizerLoweringImpl::testMIPredicate_MI(unsigned PredicateID, const MachineInstr & MI, const MatcherState &State) const { |
295 | llvm_unreachable("Unknown predicate" ); |
296 | return false; |
297 | } |
298 | bool AArch64PostLegalizerLoweringImpl::testImmPredicate_I64(unsigned PredicateID, int64_t Imm) const { |
299 | llvm_unreachable("Unknown predicate" ); |
300 | return false; |
301 | } |
302 | bool AArch64PostLegalizerLoweringImpl::testImmPredicate_APFloat(unsigned PredicateID, const APFloat & Imm) const { |
303 | llvm_unreachable("Unknown predicate" ); |
304 | return false; |
305 | } |
306 | bool AArch64PostLegalizerLoweringImpl::testImmPredicate_APInt(unsigned PredicateID, const APInt & Imm) const { |
307 | llvm_unreachable("Unknown predicate" ); |
308 | return false; |
309 | } |
310 | enum { |
311 | GICXXPred_Simple_IsRule0Enabled = GICXXPred_Invalid + 1, |
312 | GICXXPred_Simple_IsRule1Enabled, |
313 | GICXXPred_Simple_IsRule2Enabled, |
314 | GICXXPred_Simple_IsRule3Enabled, |
315 | GICXXPred_Simple_IsRule4Enabled, |
316 | GICXXPred_Simple_IsRule5Enabled, |
317 | GICXXPred_Simple_IsRule6Enabled, |
318 | GICXXPred_Simple_IsRule7Enabled, |
319 | GICXXPred_Simple_IsRule8Enabled, |
320 | GICXXPred_Simple_IsRule9Enabled, |
321 | GICXXPred_Simple_IsRule10Enabled, |
322 | GICXXPred_Simple_IsRule11Enabled, |
323 | GICXXPred_Simple_IsRule12Enabled, |
324 | GICXXPred_Simple_IsRule13Enabled, |
325 | GICXXPred_Simple_IsRule14Enabled, |
326 | GICXXPred_Simple_IsRule15Enabled, |
327 | GICXXPred_Simple_IsRule16Enabled, |
328 | GICXXPred_Simple_IsRule17Enabled, |
329 | GICXXPred_Simple_IsRule18Enabled, |
330 | }; |
331 | |
332 | bool AArch64PostLegalizerLoweringImpl::testSimplePredicate(unsigned Predicate) const { |
333 | return RuleConfig.isRuleEnabled(Predicate - GICXXPred_Invalid - 1); |
334 | } |
335 | // Custom renderers. |
336 | enum { |
337 | GICR_Invalid, |
338 | }; |
339 | AArch64PostLegalizerLoweringImpl::CustomRendererFn |
340 | AArch64PostLegalizerLoweringImpl::CustomRenderers[] = { |
341 | nullptr, // GICR_Invalid |
342 | }; |
343 | |
344 | bool AArch64PostLegalizerLoweringImpl::tryCombineAll(MachineInstr &I) const { |
345 | const TargetSubtargetInfo &ST = MF.getSubtarget(); |
346 | const PredicateBitset AvailableFeatures = getAvailableFeatures(); |
347 | B.setInstrAndDebugLoc(I); |
348 | State.MIs.clear(); |
349 | State.MIs.push_back(&I); |
350 | if (executeMatchTable(*this, State, ExecInfo, B, getMatchTable(), *ST.getInstrInfo(), MRI, *MRI.getTargetRegisterInfo(), *ST.getRegBankInfo(), AvailableFeatures, /*CoverageInfo*/ nullptr)) { |
351 | return true; |
352 | } |
353 | |
354 | return false; |
355 | } |
356 | |
357 | enum { |
358 | GICXXCustomAction_GICombiner0 = GICXXCustomAction_Invalid + 1, |
359 | GICXXCustomAction_GICombiner1, |
360 | GICXXCustomAction_GICombiner2, |
361 | GICXXCustomAction_GICombiner3, |
362 | GICXXCustomAction_GICombiner4, |
363 | GICXXCustomAction_GICombiner5, |
364 | GICXXCustomAction_GICombiner6, |
365 | GICXXCustomAction_GICombiner7, |
366 | GICXXCustomAction_GICombiner8, |
367 | GICXXCustomAction_GICombiner9, |
368 | GICXXCustomAction_GICombiner10, |
369 | GICXXCustomAction_GICombiner11, |
370 | GICXXCustomAction_GICombiner12, |
371 | GICXXCustomAction_GICombiner13, |
372 | GICXXCustomAction_GICombiner14, |
373 | GICXXCustomAction_GICombiner15, |
374 | GICXXCustomAction_GICombiner16, |
375 | GICXXCustomAction_GICombiner17, |
376 | GICXXCustomAction_GICombiner18, |
377 | }; |
378 | bool AArch64PostLegalizerLoweringImpl::runCustomAction(unsigned ApplyID, const MatcherState &State, NewMIVector &OutMIs) const { |
379 | Helper.getBuilder().setInstrAndDebugLoc(*State.MIs[0]); |
380 | switch(ApplyID) { |
381 | case GICXXCustomAction_GICombiner0:{ |
382 | ShuffleVectorPseudo GIMatchData_matchinfo; |
383 | // Match Patterns |
384 | if(![&](){return matchDup(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
385 | return false; |
386 | } |
387 | // Apply Patterns |
388 | applyShuffleVectorPseudo(*State.MIs[0], GIMatchData_matchinfo); |
389 | return true; |
390 | } |
391 | case GICXXCustomAction_GICombiner1:{ |
392 | ShuffleVectorPseudo GIMatchData_matchinfo; |
393 | // Match Patterns |
394 | if(![&](){return matchREV(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
395 | return false; |
396 | } |
397 | // Apply Patterns |
398 | applyShuffleVectorPseudo(*State.MIs[0], GIMatchData_matchinfo); |
399 | return true; |
400 | } |
401 | case GICXXCustomAction_GICombiner2:{ |
402 | ShuffleVectorPseudo GIMatchData_matchinfo; |
403 | // Match Patterns |
404 | if(![&](){return matchEXT(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
405 | return false; |
406 | } |
407 | // Apply Patterns |
408 | applyEXT(*State.MIs[0], GIMatchData_matchinfo); |
409 | return true; |
410 | } |
411 | case GICXXCustomAction_GICombiner3:{ |
412 | ShuffleVectorPseudo GIMatchData_matchinfo; |
413 | // Match Patterns |
414 | if(![&](){return matchZip(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
415 | return false; |
416 | } |
417 | // Apply Patterns |
418 | applyShuffleVectorPseudo(*State.MIs[0], GIMatchData_matchinfo); |
419 | return true; |
420 | } |
421 | case GICXXCustomAction_GICombiner4:{ |
422 | ShuffleVectorPseudo GIMatchData_matchinfo; |
423 | // Match Patterns |
424 | if(![&](){return matchUZP(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
425 | return false; |
426 | } |
427 | // Apply Patterns |
428 | applyShuffleVectorPseudo(*State.MIs[0], GIMatchData_matchinfo); |
429 | return true; |
430 | } |
431 | case GICXXCustomAction_GICombiner5:{ |
432 | ShuffleVectorPseudo GIMatchData_matchinfo; |
433 | // Match Patterns |
434 | if(![&](){return matchTRN(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
435 | return false; |
436 | } |
437 | // Apply Patterns |
438 | applyShuffleVectorPseudo(*State.MIs[0], GIMatchData_matchinfo); |
439 | return true; |
440 | } |
441 | case GICXXCustomAction_GICombiner6:{ |
442 | std::pair<unsigned, int> GIMatchData_matchinfo; |
443 | // Match Patterns |
444 | if(![&](){return matchDupLane(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
445 | return false; |
446 | } |
447 | // Apply Patterns |
448 | applyDupLane(*State.MIs[0], MRI, B, GIMatchData_matchinfo); |
449 | return true; |
450 | } |
451 | case GICXXCustomAction_GICombiner7:{ |
452 | std::tuple<Register, int, Register, int> GIMatchData_matchinfo; |
453 | // Match Patterns |
454 | if(![&](){return matchINS(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
455 | return false; |
456 | } |
457 | // Apply Patterns |
458 | applyINS(*State.MIs[0], MRI, B, GIMatchData_matchinfo); |
459 | return true; |
460 | } |
461 | case GICXXCustomAction_GICombiner8:{ |
462 | int64_t GIMatchData_matchinfo; |
463 | // Match Patterns |
464 | if(![&](){return matchVAshrLshrImm(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
465 | return false; |
466 | } |
467 | // Apply Patterns |
468 | applyVAshrLshrImm(*State.MIs[0], MRI, GIMatchData_matchinfo); |
469 | return true; |
470 | } |
471 | case GICXXCustomAction_GICombiner9:{ |
472 | std::pair<uint64_t, CmpInst::Predicate> GIMatchData_matchinfo; |
473 | // Match Patterns |
474 | if(![&](){return matchAdjustICmpImmAndPred(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
475 | return false; |
476 | } |
477 | // Apply Patterns |
478 | applyAdjustICmpImmAndPred(*State.MIs[0], GIMatchData_matchinfo, B, Observer); |
479 | return true; |
480 | } |
481 | case GICXXCustomAction_GICombiner10:{ |
482 | // Match Patterns |
483 | if(![&](){return trySwapICmpOperands(*State.MIs[0], MRI);}()) { |
484 | return false; |
485 | } |
486 | // Apply Patterns |
487 | applySwapICmpOperands(*State.MIs[0], Observer); |
488 | return true; |
489 | } |
490 | case GICXXCustomAction_GICombiner11:{ |
491 | // Match Patterns |
492 | if(![&](){return matchBuildVectorToDup(*State.MIs[0], MRI);}()) { |
493 | return false; |
494 | } |
495 | // Apply Patterns |
496 | applyBuildVectorToDup(*State.MIs[0], MRI, B); |
497 | return true; |
498 | } |
499 | case GICXXCustomAction_GICombiner12:{ |
500 | // Match Patterns |
501 | if(![&](){return matchLowerVectorFCMP(*State.MIs[0], MRI, B);}()) { |
502 | return false; |
503 | } |
504 | // Apply Patterns |
505 | applyLowerVectorFCMP(*State.MIs[0], MRI, B); |
506 | return true; |
507 | } |
508 | case GICXXCustomAction_GICombiner13:{ |
509 | Register GIMatchData_matchinfo; |
510 | // Match Patterns |
511 | if(![&](){return matchFormTruncstore(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
512 | return false; |
513 | } |
514 | // Apply Patterns |
515 | applyFormTruncstore(*State.MIs[0], MRI, B, Observer, GIMatchData_matchinfo); |
516 | return true; |
517 | } |
518 | case GICXXCustomAction_GICombiner14:{ |
519 | // Match Patterns |
520 | if(![&](){return matchVectorSextInReg(*State.MIs[0], MRI);}()) { |
521 | return false; |
522 | } |
523 | // Apply Patterns |
524 | applyVectorSextInReg(*State.MIs[0], MRI, B, Observer); |
525 | return true; |
526 | } |
527 | case GICXXCustomAction_GICombiner15:{ |
528 | Register GIMatchData_matchinfo; |
529 | // Match Patterns |
530 | if(![&](){return matchUnmergeExtToUnmerge(*State.MIs[0], MRI, GIMatchData_matchinfo);}()) { |
531 | return false; |
532 | } |
533 | // Apply Patterns |
534 | applyUnmergeExtToUnmerge(*State.MIs[0], MRI, B, Observer, GIMatchData_matchinfo); |
535 | return true; |
536 | } |
537 | case GICXXCustomAction_GICombiner16:{ |
538 | // Match Patterns |
539 | if(![&](){return matchExtMulToMULL(*State.MIs[0], MRI);}()) { |
540 | return false; |
541 | } |
542 | // Apply Patterns |
543 | applyExtMulToMULL(*State.MIs[0], MRI, B, Observer); |
544 | return true; |
545 | } |
546 | case GICXXCustomAction_GICombiner17:{ |
547 | // Match Patterns |
548 | if(![&](){return matchScalarizeVectorUnmerge(*State.MIs[0], MRI);}()) { |
549 | return false; |
550 | } |
551 | // Apply Patterns |
552 | applyScalarizeVectorUnmerge(*State.MIs[0], MRI, B); |
553 | return true; |
554 | } |
555 | case GICXXCustomAction_GICombiner18:{ |
556 | ShuffleVectorPseudo GIMatchData_matchinfo; |
557 | // Match Patterns |
558 | if(![&](){return matchNonConstInsert(*State.MIs[0], MRI);}()) { |
559 | return false; |
560 | } |
561 | // Apply Patterns |
562 | applyNonConstInsert(*State.MIs[0], MRI, B); |
563 | return true; |
564 | } |
565 | } |
566 | llvm_unreachable("Unknown Apply Action" ); |
567 | } |
568 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ |
569 | #define GIMT_Encode2(Val) uint8_t(Val), uint8_t((uint16_t)Val >> 8) |
570 | #define GIMT_Encode4(Val) uint8_t(Val), uint8_t((uint32_t)Val >> 8), uint8_t((uint32_t)Val >> 16), uint8_t((uint32_t)Val >> 24) |
571 | #define GIMT_Encode8(Val) uint8_t(Val), uint8_t((uint64_t)Val >> 8), uint8_t((uint64_t)Val >> 16), uint8_t((uint64_t)Val >> 24), uint8_t((uint64_t)Val >> 32), uint8_t((uint64_t)Val >> 40), uint8_t((uint64_t)Val >> 48), uint8_t((uint64_t)Val >> 56) |
572 | #else |
573 | #define GIMT_Encode2(Val) uint8_t((uint16_t)Val >> 8), uint8_t(Val) |
574 | #define GIMT_Encode4(Val) uint8_t((uint32_t)Val >> 24), uint8_t((uint32_t)Val >> 16), uint8_t((uint32_t)Val >> 8), uint8_t(Val) |
575 | #define GIMT_Encode8(Val) uint8_t((uint64_t)Val >> 56), uint8_t((uint64_t)Val >> 48), uint8_t((uint64_t)Val >> 40), uint8_t((uint64_t)Val >> 32), uint8_t((uint64_t)Val >> 24), uint8_t((uint64_t)Val >> 16), uint8_t((uint64_t)Val >> 8), uint8_t(Val) |
576 | #endif |
577 | const uint8_t *AArch64PostLegalizerLoweringImpl::getMatchTable() const { |
578 | constexpr static uint8_t MatchTable0[] = { |
579 | GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2(53), GIMT_Encode2(229), /*)*//*default:*//*Label 11*/ GIMT_Encode4(945), |
580 | /*TargetOpcode::G_MUL*//*Label 0*/ GIMT_Encode4(714), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), |
581 | /*TargetOpcode::G_UNMERGE_VALUES*//*Label 1*/ GIMT_Encode4(726), GIMT_Encode4(0), GIMT_Encode4(0), |
582 | /*TargetOpcode::G_BUILD_VECTOR*//*Label 2*/ GIMT_Encode4(749), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), |
583 | /*TargetOpcode::G_STORE*//*Label 3*/ GIMT_Encode4(761), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), |
584 | /*TargetOpcode::G_SEXT_INREG*//*Label 4*/ GIMT_Encode4(773), GIMT_Encode4(0), GIMT_Encode4(0), |
585 | /*TargetOpcode::G_LSHR*//*Label 5*/ GIMT_Encode4(785), |
586 | /*TargetOpcode::G_ASHR*//*Label 6*/ GIMT_Encode4(797), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), |
587 | /*TargetOpcode::G_ICMP*//*Label 7*/ GIMT_Encode4(809), |
588 | /*TargetOpcode::G_FCMP*//*Label 8*/ GIMT_Encode4(832), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), |
589 | /*TargetOpcode::G_INSERT_VECTOR_ELT*//*Label 9*/ GIMT_Encode4(844), GIMT_Encode4(0), |
590 | /*TargetOpcode::G_SHUFFLE_VECTOR*//*Label 10*/ GIMT_Encode4(856), |
591 | // Label 0: @714 |
592 | GIM_Try, /*On fail goto*//*Label 12*/ GIMT_Encode4(725), // Rule ID 17 // |
593 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule16Enabled), |
594 | // Combiner Rule #16: lower_mull; wip_match_opcode 'G_MUL' |
595 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner16), |
596 | // Label 12: @725 |
597 | GIM_Reject, |
598 | // Label 1: @726 |
599 | GIM_Try, /*On fail goto*//*Label 13*/ GIMT_Encode4(737), // Rule ID 16 // |
600 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule15Enabled), |
601 | // Combiner Rule #15: unmerge_ext_to_unmerge; wip_match_opcode 'G_UNMERGE_VALUES' |
602 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner15), |
603 | // Label 13: @737 |
604 | GIM_Try, /*On fail goto*//*Label 14*/ GIMT_Encode4(748), // Rule ID 18 // |
605 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule17Enabled), |
606 | // Combiner Rule #17: vector_unmerge_lowering; wip_match_opcode 'G_UNMERGE_VALUES' |
607 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner17), |
608 | // Label 14: @748 |
609 | GIM_Reject, |
610 | // Label 2: @749 |
611 | GIM_Try, /*On fail goto*//*Label 15*/ GIMT_Encode4(760), // Rule ID 12 // |
612 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule11Enabled), |
613 | // Combiner Rule #11: build_vector_to_dup; wip_match_opcode 'G_BUILD_VECTOR' |
614 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner11), |
615 | // Label 15: @760 |
616 | GIM_Reject, |
617 | // Label 3: @761 |
618 | GIM_Try, /*On fail goto*//*Label 16*/ GIMT_Encode4(772), // Rule ID 14 // |
619 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule13Enabled), |
620 | // Combiner Rule #13: form_truncstore; wip_match_opcode 'G_STORE' |
621 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner13), |
622 | // Label 16: @772 |
623 | GIM_Reject, |
624 | // Label 4: @773 |
625 | GIM_Try, /*On fail goto*//*Label 17*/ GIMT_Encode4(784), // Rule ID 15 // |
626 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule14Enabled), |
627 | // Combiner Rule #14: vector_sext_inreg_to_shift; wip_match_opcode 'G_SEXT_INREG' |
628 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner14), |
629 | // Label 17: @784 |
630 | GIM_Reject, |
631 | // Label 5: @785 |
632 | GIM_Try, /*On fail goto*//*Label 18*/ GIMT_Encode4(796), // Rule ID 9 // |
633 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule8Enabled), |
634 | // Combiner Rule #8: vashr_vlshr_imm; wip_match_opcode 'G_LSHR' |
635 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner8), |
636 | // Label 18: @796 |
637 | GIM_Reject, |
638 | // Label 6: @797 |
639 | GIM_Try, /*On fail goto*//*Label 19*/ GIMT_Encode4(808), // Rule ID 8 // |
640 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule8Enabled), |
641 | // Combiner Rule #8: vashr_vlshr_imm; wip_match_opcode 'G_ASHR' |
642 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner8), |
643 | // Label 19: @808 |
644 | GIM_Reject, |
645 | // Label 7: @809 |
646 | GIM_Try, /*On fail goto*//*Label 20*/ GIMT_Encode4(820), // Rule ID 10 // |
647 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule9Enabled), |
648 | // Combiner Rule #9: adjust_icmp_imm; wip_match_opcode 'G_ICMP' |
649 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner9), |
650 | // Label 20: @820 |
651 | GIM_Try, /*On fail goto*//*Label 21*/ GIMT_Encode4(831), // Rule ID 11 // |
652 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule10Enabled), |
653 | // Combiner Rule #10: swap_icmp_operands; wip_match_opcode 'G_ICMP' |
654 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner10), |
655 | // Label 21: @831 |
656 | GIM_Reject, |
657 | // Label 8: @832 |
658 | GIM_Try, /*On fail goto*//*Label 22*/ GIMT_Encode4(843), // Rule ID 13 // |
659 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule12Enabled), |
660 | // Combiner Rule #12: lower_vector_fcmp; wip_match_opcode 'G_FCMP' |
661 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner12), |
662 | // Label 22: @843 |
663 | GIM_Reject, |
664 | // Label 9: @844 |
665 | GIM_Try, /*On fail goto*//*Label 23*/ GIMT_Encode4(855), // Rule ID 19 // |
666 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule18Enabled), |
667 | // Combiner Rule #18: insertelt_nonconst; wip_match_opcode 'G_INSERT_VECTOR_ELT' |
668 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner18), |
669 | // Label 23: @855 |
670 | GIM_Reject, |
671 | // Label 10: @856 |
672 | GIM_Try, /*On fail goto*//*Label 24*/ GIMT_Encode4(867), // Rule ID 0 // |
673 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled), |
674 | // Combiner Rule #0: dup; wip_match_opcode 'G_SHUFFLE_VECTOR' |
675 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner0), |
676 | // Label 24: @867 |
677 | GIM_Try, /*On fail goto*//*Label 25*/ GIMT_Encode4(878), // Rule ID 1 // |
678 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule1Enabled), |
679 | // Combiner Rule #1: rev; wip_match_opcode 'G_SHUFFLE_VECTOR' |
680 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner1), |
681 | // Label 25: @878 |
682 | GIM_Try, /*On fail goto*//*Label 26*/ GIMT_Encode4(889), // Rule ID 2 // |
683 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule2Enabled), |
684 | // Combiner Rule #2: ext; wip_match_opcode 'G_SHUFFLE_VECTOR' |
685 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner2), |
686 | // Label 26: @889 |
687 | GIM_Try, /*On fail goto*//*Label 27*/ GIMT_Encode4(900), // Rule ID 3 // |
688 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule3Enabled), |
689 | // Combiner Rule #3: zip; wip_match_opcode 'G_SHUFFLE_VECTOR' |
690 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner3), |
691 | // Label 27: @900 |
692 | GIM_Try, /*On fail goto*//*Label 28*/ GIMT_Encode4(911), // Rule ID 4 // |
693 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule4Enabled), |
694 | // Combiner Rule #4: uzp; wip_match_opcode 'G_SHUFFLE_VECTOR' |
695 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner4), |
696 | // Label 28: @911 |
697 | GIM_Try, /*On fail goto*//*Label 29*/ GIMT_Encode4(922), // Rule ID 5 // |
698 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule5Enabled), |
699 | // Combiner Rule #5: trn; wip_match_opcode 'G_SHUFFLE_VECTOR' |
700 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner5), |
701 | // Label 29: @922 |
702 | GIM_Try, /*On fail goto*//*Label 30*/ GIMT_Encode4(933), // Rule ID 6 // |
703 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule6Enabled), |
704 | // Combiner Rule #6: form_duplane; wip_match_opcode 'G_SHUFFLE_VECTOR' |
705 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner6), |
706 | // Label 30: @933 |
707 | GIM_Try, /*On fail goto*//*Label 31*/ GIMT_Encode4(944), // Rule ID 7 // |
708 | GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule7Enabled), |
709 | // Combiner Rule #7: shuf_to_ins; wip_match_opcode 'G_SHUFFLE_VECTOR' |
710 | GIR_DoneWithCustomAction, /*Fn*/GIMT_Encode2(GICXXCustomAction_GICombiner7), |
711 | // Label 31: @944 |
712 | GIM_Reject, |
713 | // Label 11: @945 |
714 | GIM_Reject, |
715 | }; // Size: 946 bytes |
716 | return MatchTable0; |
717 | } |
718 | #undef GIMT_Encode2 |
719 | #undef GIMT_Encode4 |
720 | #undef GIMT_Encode8 |
721 | |
722 | #endif // ifdef GET_GICOMBINER_IMPL |
723 | |
724 | #ifdef GET_GICOMBINER_CONSTRUCTOR_INITS |
725 | AvailableModuleFeatures(computeAvailableModuleFeatures(&STI)), |
726 | AvailableFunctionFeatures() |
727 | #endif // ifdef GET_GICOMBINER_CONSTRUCTOR_INITS |
728 | #ifdef GET_GICOMBINER_CONSTRUCTOR_INITS |
729 | , State(0), |
730 | ExecInfo(TypeObjects, NumTypeObjects, FeatureBitsets, ComplexPredicateFns, CustomRenderers) |
731 | #endif // ifdef GET_GICOMBINER_CONSTRUCTOR_INITS |
732 | |
733 | |