1//==-- AArch64InstPrinter.cpp - Convert AArch64 MCInst to assembly syntax --==//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// This class prints an AArch64 MCInst to a .s file.
10//
11//===----------------------------------------------------------------------===//
12
13#include "AArch64InstPrinter.h"
14#include "MCTargetDesc/AArch64AddressingModes.h"
15#include "Utils/AArch64BaseInfo.h"
16#include "llvm/ADT/STLExtras.h"
17#include "llvm/ADT/StringExtras.h"
18#include "llvm/ADT/StringRef.h"
19#include "llvm/MC/MCAsmInfo.h"
20#include "llvm/MC/MCExpr.h"
21#include "llvm/MC/MCInst.h"
22#include "llvm/MC/MCRegisterInfo.h"
23#include "llvm/MC/MCSubtargetInfo.h"
24#include "llvm/Support/Casting.h"
25#include "llvm/Support/ErrorHandling.h"
26#include "llvm/Support/Format.h"
27#include "llvm/Support/MathExtras.h"
28#include "llvm/Support/raw_ostream.h"
29#include <cassert>
30#include <cstdint>
31#include <string>
32
33using namespace llvm;
34
35#define DEBUG_TYPE "asm-printer"
36
37#define GET_INSTRUCTION_NAME
38#define PRINT_ALIAS_INSTR
39#include "AArch64GenAsmWriter.inc"
40#define GET_INSTRUCTION_NAME
41#define PRINT_ALIAS_INSTR
42#include "AArch64GenAsmWriter1.inc"
43
44AArch64InstPrinter::AArch64InstPrinter(const MCAsmInfo &MAI,
45 const MCInstrInfo &MII,
46 const MCRegisterInfo &MRI)
47 : MCInstPrinter(MAI, MII, MRI) {}
48
49AArch64AppleInstPrinter::AArch64AppleInstPrinter(const MCAsmInfo &MAI,
50 const MCInstrInfo &MII,
51 const MCRegisterInfo &MRI)
52 : AArch64InstPrinter(MAI, MII, MRI) {}
53
54bool AArch64InstPrinter::applyTargetSpecificCLOption(StringRef Opt) {
55 if (Opt == "no-aliases") {
56 PrintAliases = false;
57 return true;
58 }
59 return false;
60}
61
62void AArch64InstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) const {
63 markup(OS, M: Markup::Register) << getRegisterName(Reg);
64}
65
66void AArch64InstPrinter::printRegName(raw_ostream &OS, MCRegister Reg,
67 unsigned AltIdx) const {
68 markup(OS, M: Markup::Register) << getRegisterName(Reg, AltIdx);
69}
70
71StringRef AArch64InstPrinter::getRegName(MCRegister Reg) const {
72 return getRegisterName(Reg);
73}
74
75void AArch64InstPrinter::printInst(const MCInst *MI, uint64_t Address,
76 StringRef Annot, const MCSubtargetInfo &STI,
77 raw_ostream &O) {
78 // Check for special encodings and print the canonical alias instead.
79
80 unsigned Opcode = MI->getOpcode();
81
82 if (Opcode == AArch64::SYSxt)
83 if (printSysAlias(MI, STI, O)) {
84 printAnnotation(OS&: O, Annot);
85 return;
86 }
87
88 if (Opcode == AArch64::SYSPxt || Opcode == AArch64::SYSPxt_XZR)
89 if (printSyspAlias(MI, STI, O)) {
90 printAnnotation(OS&: O, Annot);
91 return;
92 }
93
94 // RPRFM overlaps PRFM (reg), so try to print it as RPRFM here.
95 if ((Opcode == AArch64::PRFMroX) || (Opcode == AArch64::PRFMroW)) {
96 if (printRangePrefetchAlias(MI, STI, O, Annot))
97 return;
98 }
99
100 // SBFM/UBFM should print to a nicer aliased form if possible.
101 if (Opcode == AArch64::SBFMXri || Opcode == AArch64::SBFMWri ||
102 Opcode == AArch64::UBFMXri || Opcode == AArch64::UBFMWri) {
103 const MCOperand &Op0 = MI->getOperand(i: 0);
104 const MCOperand &Op1 = MI->getOperand(i: 1);
105 const MCOperand &Op2 = MI->getOperand(i: 2);
106 const MCOperand &Op3 = MI->getOperand(i: 3);
107
108 bool IsSigned = (Opcode == AArch64::SBFMXri || Opcode == AArch64::SBFMWri);
109 bool Is64Bit = (Opcode == AArch64::SBFMXri || Opcode == AArch64::UBFMXri);
110 if (Op2.isImm() && Op2.getImm() == 0 && Op3.isImm()) {
111 const char *AsmMnemonic = nullptr;
112
113 switch (Op3.getImm()) {
114 default:
115 break;
116 case 7:
117 if (IsSigned)
118 AsmMnemonic = "sxtb";
119 else if (!Is64Bit)
120 AsmMnemonic = "uxtb";
121 break;
122 case 15:
123 if (IsSigned)
124 AsmMnemonic = "sxth";
125 else if (!Is64Bit)
126 AsmMnemonic = "uxth";
127 break;
128 case 31:
129 // *xtw is only valid for signed 64-bit operations.
130 if (Is64Bit && IsSigned)
131 AsmMnemonic = "sxtw";
132 break;
133 }
134
135 if (AsmMnemonic) {
136 O << '\t' << AsmMnemonic << '\t';
137 printRegName(OS&: O, Reg: Op0.getReg());
138 O << ", ";
139 printRegName(OS&: O, Reg: getWRegFromXReg(Reg: Op1.getReg()));
140 printAnnotation(OS&: O, Annot);
141 return;
142 }
143 }
144
145 // All immediate shifts are aliases, implemented using the Bitfield
146 // instruction. In all cases the immediate shift amount shift must be in
147 // the range 0 to (reg.size -1).
148 if (Op2.isImm() && Op3.isImm()) {
149 const char *AsmMnemonic = nullptr;
150 int shift = 0;
151 int64_t immr = Op2.getImm();
152 int64_t imms = Op3.getImm();
153 if (Opcode == AArch64::UBFMWri && imms != 0x1F && ((imms + 1) == immr)) {
154 AsmMnemonic = "lsl";
155 shift = 31 - imms;
156 } else if (Opcode == AArch64::UBFMXri && imms != 0x3f &&
157 ((imms + 1 == immr))) {
158 AsmMnemonic = "lsl";
159 shift = 63 - imms;
160 } else if (Opcode == AArch64::UBFMWri && imms == 0x1f) {
161 AsmMnemonic = "lsr";
162 shift = immr;
163 } else if (Opcode == AArch64::UBFMXri && imms == 0x3f) {
164 AsmMnemonic = "lsr";
165 shift = immr;
166 } else if (Opcode == AArch64::SBFMWri && imms == 0x1f) {
167 AsmMnemonic = "asr";
168 shift = immr;
169 } else if (Opcode == AArch64::SBFMXri && imms == 0x3f) {
170 AsmMnemonic = "asr";
171 shift = immr;
172 }
173 if (AsmMnemonic) {
174 O << '\t' << AsmMnemonic << '\t';
175 printRegName(OS&: O, Reg: Op0.getReg());
176 O << ", ";
177 printRegName(OS&: O, Reg: Op1.getReg());
178 O << ", ";
179 markup(OS&: O, M: Markup::Immediate) << "#" << shift;
180 printAnnotation(OS&: O, Annot);
181 return;
182 }
183 }
184
185 // SBFIZ/UBFIZ aliases
186 if (Op2.getImm() > Op3.getImm()) {
187 O << '\t' << (IsSigned ? "sbfiz" : "ubfiz") << '\t';
188 printRegName(OS&: O, Reg: Op0.getReg());
189 O << ", ";
190 printRegName(OS&: O, Reg: Op1.getReg());
191 O << ", ";
192 markup(OS&: O, M: Markup::Immediate) << "#" << (Is64Bit ? 64 : 32) - Op2.getImm();
193 O << ", ";
194 markup(OS&: O, M: Markup::Immediate) << "#" << Op3.getImm() + 1;
195 printAnnotation(OS&: O, Annot);
196 return;
197 }
198
199 // Otherwise SBFX/UBFX is the preferred form
200 O << '\t' << (IsSigned ? "sbfx" : "ubfx") << '\t';
201 printRegName(OS&: O, Reg: Op0.getReg());
202 O << ", ";
203 printRegName(OS&: O, Reg: Op1.getReg());
204 O << ", ";
205 markup(OS&: O, M: Markup::Immediate) << "#" << Op2.getImm();
206 O << ", ";
207 markup(OS&: O, M: Markup::Immediate) << "#" << Op3.getImm() - Op2.getImm() + 1;
208 printAnnotation(OS&: O, Annot);
209 return;
210 }
211
212 if (Opcode == AArch64::BFMXri || Opcode == AArch64::BFMWri) {
213 const MCOperand &Op0 = MI->getOperand(i: 0); // Op1 == Op0
214 const MCOperand &Op2 = MI->getOperand(i: 2);
215 int ImmR = MI->getOperand(i: 3).getImm();
216 int ImmS = MI->getOperand(i: 4).getImm();
217
218 if ((Op2.getReg() == AArch64::WZR || Op2.getReg() == AArch64::XZR) &&
219 (ImmR == 0 || ImmS < ImmR) && STI.hasFeature(Feature: AArch64::HasV8_2aOps)) {
220 // BFC takes precedence over its entire range, sligtly differently to BFI.
221 int BitWidth = Opcode == AArch64::BFMXri ? 64 : 32;
222 int LSB = (BitWidth - ImmR) % BitWidth;
223 int Width = ImmS + 1;
224
225 O << "\tbfc\t";
226 printRegName(OS&: O, Reg: Op0.getReg());
227 O << ", ";
228 markup(OS&: O, M: Markup::Immediate) << "#" << LSB;
229 O << ", ";
230 markup(OS&: O, M: Markup::Immediate) << "#" << Width;
231 printAnnotation(OS&: O, Annot);
232 return;
233 } else if (ImmS < ImmR) {
234 // BFI alias
235 int BitWidth = Opcode == AArch64::BFMXri ? 64 : 32;
236 int LSB = (BitWidth - ImmR) % BitWidth;
237 int Width = ImmS + 1;
238
239 O << "\tbfi\t";
240 printRegName(OS&: O, Reg: Op0.getReg());
241 O << ", ";
242 printRegName(OS&: O, Reg: Op2.getReg());
243 O << ", ";
244 markup(OS&: O, M: Markup::Immediate) << "#" << LSB;
245 O << ", ";
246 markup(OS&: O, M: Markup::Immediate) << "#" << Width;
247 printAnnotation(OS&: O, Annot);
248 return;
249 }
250
251 int LSB = ImmR;
252 int Width = ImmS - ImmR + 1;
253 // Otherwise BFXIL the preferred form
254 O << "\tbfxil\t";
255 printRegName(OS&: O, Reg: Op0.getReg());
256 O << ", ";
257 printRegName(OS&: O, Reg: Op2.getReg());
258 O << ", ";
259 markup(OS&: O, M: Markup::Immediate) << "#" << LSB;
260 O << ", ";
261 markup(OS&: O, M: Markup::Immediate) << "#" << Width;
262 printAnnotation(OS&: O, Annot);
263 return;
264 }
265
266 // Symbolic operands for MOVZ, MOVN and MOVK already imply a shift
267 // (e.g. :gottprel_g1: is always going to be "lsl #16") so it should not be
268 // printed.
269 if ((Opcode == AArch64::MOVZXi || Opcode == AArch64::MOVZWi ||
270 Opcode == AArch64::MOVNXi || Opcode == AArch64::MOVNWi) &&
271 MI->getOperand(i: 1).isExpr()) {
272 if (Opcode == AArch64::MOVZXi || Opcode == AArch64::MOVZWi)
273 O << "\tmovz\t";
274 else
275 O << "\tmovn\t";
276
277 printRegName(OS&: O, Reg: MI->getOperand(i: 0).getReg());
278 O << ", ";
279 {
280 WithMarkup M = markup(OS&: O, M: Markup::Immediate);
281 O << "#";
282 MI->getOperand(i: 1).getExpr()->print(OS&: O, MAI: &MAI);
283 }
284 return;
285 }
286
287 if ((Opcode == AArch64::MOVKXi || Opcode == AArch64::MOVKWi) &&
288 MI->getOperand(i: 2).isExpr()) {
289 O << "\tmovk\t";
290 printRegName(OS&: O, Reg: MI->getOperand(i: 0).getReg());
291 O << ", ";
292 {
293 WithMarkup M = markup(OS&: O, M: Markup::Immediate);
294 O << "#";
295 MI->getOperand(i: 2).getExpr()->print(OS&: O, MAI: &MAI);
296 }
297 return;
298 }
299
300 auto PrintMovImm = [&](uint64_t Value, int RegWidth) {
301 int64_t SExtVal = SignExtend64(X: Value, B: RegWidth);
302 O << "\tmov\t";
303 printRegName(OS&: O, Reg: MI->getOperand(i: 0).getReg());
304 O << ", ";
305 markup(OS&: O, M: Markup::Immediate) << "#" << formatImm(Value: SExtVal);
306 if (CommentStream) {
307 // Do the opposite to that used for instruction operands.
308 if (getPrintImmHex())
309 *CommentStream << '=' << formatDec(Value: SExtVal) << '\n';
310 else {
311 uint64_t Mask = maskTrailingOnes<uint64_t>(N: RegWidth);
312 *CommentStream << '=' << formatHex(Value: SExtVal & Mask) << '\n';
313 }
314 }
315 };
316
317 // MOVZ, MOVN and "ORR wzr, #imm" instructions are aliases for MOV, but their
318 // domains overlap so they need to be prioritized. The chain is "MOVZ lsl #0 >
319 // MOVZ lsl #N > MOVN lsl #0 > MOVN lsl #N > ORR". The highest instruction
320 // that can represent the move is the MOV alias, and the rest get printed
321 // normally.
322 if ((Opcode == AArch64::MOVZXi || Opcode == AArch64::MOVZWi) &&
323 MI->getOperand(i: 1).isImm() && MI->getOperand(i: 2).isImm()) {
324 int RegWidth = Opcode == AArch64::MOVZXi ? 64 : 32;
325 int Shift = MI->getOperand(i: 2).getImm();
326 uint64_t Value = (uint64_t)MI->getOperand(i: 1).getImm() << Shift;
327
328 if (AArch64_AM::isMOVZMovAlias(Value, Shift,
329 RegWidth: Opcode == AArch64::MOVZXi ? 64 : 32)) {
330 PrintMovImm(Value, RegWidth);
331 return;
332 }
333 }
334
335 if ((Opcode == AArch64::MOVNXi || Opcode == AArch64::MOVNWi) &&
336 MI->getOperand(i: 1).isImm() && MI->getOperand(i: 2).isImm()) {
337 int RegWidth = Opcode == AArch64::MOVNXi ? 64 : 32;
338 int Shift = MI->getOperand(i: 2).getImm();
339 uint64_t Value = ~((uint64_t)MI->getOperand(i: 1).getImm() << Shift);
340 if (RegWidth == 32)
341 Value = Value & 0xffffffff;
342
343 if (AArch64_AM::isMOVNMovAlias(Value, Shift, RegWidth)) {
344 PrintMovImm(Value, RegWidth);
345 return;
346 }
347 }
348
349 if ((Opcode == AArch64::ORRXri || Opcode == AArch64::ORRWri) &&
350 (MI->getOperand(i: 1).getReg() == AArch64::XZR ||
351 MI->getOperand(i: 1).getReg() == AArch64::WZR) &&
352 MI->getOperand(i: 2).isImm()) {
353 int RegWidth = Opcode == AArch64::ORRXri ? 64 : 32;
354 uint64_t Value = AArch64_AM::decodeLogicalImmediate(
355 val: MI->getOperand(i: 2).getImm(), regSize: RegWidth);
356 if (!AArch64_AM::isAnyMOVWMovAlias(Value, RegWidth)) {
357 PrintMovImm(Value, RegWidth);
358 return;
359 }
360 }
361
362 if (Opcode == AArch64::SPACE) {
363 O << '\t' << MAI.getCommentString() << " SPACE "
364 << MI->getOperand(i: 1).getImm();
365 printAnnotation(OS&: O, Annot);
366 return;
367 }
368
369 // Instruction TSB is specified as a one operand instruction, but 'csync' is
370 // not encoded, so for printing it is treated as a special case here:
371 if (Opcode == AArch64::TSB) {
372 O << "\ttsb\tcsync";
373 return;
374 }
375
376 if (!PrintAliases || !printAliasInstr(MI, Address, STI, OS&: O))
377 printInstruction(MI, Address, STI, O);
378
379 printAnnotation(OS&: O, Annot);
380
381 if (atomicBarrierDroppedOnZero(Opcode) &&
382 (MI->getOperand(i: 0).getReg() == AArch64::XZR ||
383 MI->getOperand(i: 0).getReg() == AArch64::WZR)) {
384 printAnnotation(OS&: O, Annot: "acquire semantics dropped since destination is zero");
385 }
386}
387
388static bool isTblTbxInstruction(unsigned Opcode, StringRef &Layout,
389 bool &IsTbx) {
390 switch (Opcode) {
391 case AArch64::TBXv8i8One:
392 case AArch64::TBXv8i8Two:
393 case AArch64::TBXv8i8Three:
394 case AArch64::TBXv8i8Four:
395 IsTbx = true;
396 Layout = ".8b";
397 return true;
398 case AArch64::TBLv8i8One:
399 case AArch64::TBLv8i8Two:
400 case AArch64::TBLv8i8Three:
401 case AArch64::TBLv8i8Four:
402 IsTbx = false;
403 Layout = ".8b";
404 return true;
405 case AArch64::TBXv16i8One:
406 case AArch64::TBXv16i8Two:
407 case AArch64::TBXv16i8Three:
408 case AArch64::TBXv16i8Four:
409 IsTbx = true;
410 Layout = ".16b";
411 return true;
412 case AArch64::TBLv16i8One:
413 case AArch64::TBLv16i8Two:
414 case AArch64::TBLv16i8Three:
415 case AArch64::TBLv16i8Four:
416 IsTbx = false;
417 Layout = ".16b";
418 return true;
419 default:
420 return false;
421 }
422}
423
424struct LdStNInstrDesc {
425 unsigned Opcode;
426 const char *Mnemonic;
427 const char *Layout;
428 int ListOperand;
429 bool HasLane;
430 int NaturalOffset;
431};
432
433static const LdStNInstrDesc LdStNInstInfo[] = {
434 { .Opcode: AArch64::LD1i8, .Mnemonic: "ld1", .Layout: ".b", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
435 { .Opcode: AArch64::LD1i16, .Mnemonic: "ld1", .Layout: ".h", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
436 { .Opcode: AArch64::LD1i32, .Mnemonic: "ld1", .Layout: ".s", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
437 { .Opcode: AArch64::LD1i64, .Mnemonic: "ld1", .Layout: ".d", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
438 { .Opcode: AArch64::LD1i8_POST, .Mnemonic: "ld1", .Layout: ".b", .ListOperand: 2, .HasLane: true, .NaturalOffset: 1 },
439 { .Opcode: AArch64::LD1i16_POST, .Mnemonic: "ld1", .Layout: ".h", .ListOperand: 2, .HasLane: true, .NaturalOffset: 2 },
440 { .Opcode: AArch64::LD1i32_POST, .Mnemonic: "ld1", .Layout: ".s", .ListOperand: 2, .HasLane: true, .NaturalOffset: 4 },
441 { .Opcode: AArch64::LD1i64_POST, .Mnemonic: "ld1", .Layout: ".d", .ListOperand: 2, .HasLane: true, .NaturalOffset: 8 },
442 { .Opcode: AArch64::LD1Rv16b, .Mnemonic: "ld1r", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
443 { .Opcode: AArch64::LD1Rv8h, .Mnemonic: "ld1r", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
444 { .Opcode: AArch64::LD1Rv4s, .Mnemonic: "ld1r", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
445 { .Opcode: AArch64::LD1Rv2d, .Mnemonic: "ld1r", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
446 { .Opcode: AArch64::LD1Rv8b, .Mnemonic: "ld1r", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
447 { .Opcode: AArch64::LD1Rv4h, .Mnemonic: "ld1r", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
448 { .Opcode: AArch64::LD1Rv2s, .Mnemonic: "ld1r", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
449 { .Opcode: AArch64::LD1Rv1d, .Mnemonic: "ld1r", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
450 { .Opcode: AArch64::LD1Rv16b_POST, .Mnemonic: "ld1r", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 1 },
451 { .Opcode: AArch64::LD1Rv8h_POST, .Mnemonic: "ld1r", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 2 },
452 { .Opcode: AArch64::LD1Rv4s_POST, .Mnemonic: "ld1r", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 4 },
453 { .Opcode: AArch64::LD1Rv2d_POST, .Mnemonic: "ld1r", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
454 { .Opcode: AArch64::LD1Rv8b_POST, .Mnemonic: "ld1r", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 1 },
455 { .Opcode: AArch64::LD1Rv4h_POST, .Mnemonic: "ld1r", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 2 },
456 { .Opcode: AArch64::LD1Rv2s_POST, .Mnemonic: "ld1r", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 4 },
457 { .Opcode: AArch64::LD1Rv1d_POST, .Mnemonic: "ld1r", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
458 { .Opcode: AArch64::LD1Onev16b, .Mnemonic: "ld1", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
459 { .Opcode: AArch64::LD1Onev8h, .Mnemonic: "ld1", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
460 { .Opcode: AArch64::LD1Onev4s, .Mnemonic: "ld1", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
461 { .Opcode: AArch64::LD1Onev2d, .Mnemonic: "ld1", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
462 { .Opcode: AArch64::LD1Onev8b, .Mnemonic: "ld1", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
463 { .Opcode: AArch64::LD1Onev4h, .Mnemonic: "ld1", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
464 { .Opcode: AArch64::LD1Onev2s, .Mnemonic: "ld1", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
465 { .Opcode: AArch64::LD1Onev1d, .Mnemonic: "ld1", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
466 { .Opcode: AArch64::LD1Onev16b_POST, .Mnemonic: "ld1", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
467 { .Opcode: AArch64::LD1Onev8h_POST, .Mnemonic: "ld1", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
468 { .Opcode: AArch64::LD1Onev4s_POST, .Mnemonic: "ld1", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
469 { .Opcode: AArch64::LD1Onev2d_POST, .Mnemonic: "ld1", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
470 { .Opcode: AArch64::LD1Onev8b_POST, .Mnemonic: "ld1", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
471 { .Opcode: AArch64::LD1Onev4h_POST, .Mnemonic: "ld1", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
472 { .Opcode: AArch64::LD1Onev2s_POST, .Mnemonic: "ld1", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
473 { .Opcode: AArch64::LD1Onev1d_POST, .Mnemonic: "ld1", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
474 { .Opcode: AArch64::LD1Twov16b, .Mnemonic: "ld1", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
475 { .Opcode: AArch64::LD1Twov8h, .Mnemonic: "ld1", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
476 { .Opcode: AArch64::LD1Twov4s, .Mnemonic: "ld1", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
477 { .Opcode: AArch64::LD1Twov2d, .Mnemonic: "ld1", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
478 { .Opcode: AArch64::LD1Twov8b, .Mnemonic: "ld1", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
479 { .Opcode: AArch64::LD1Twov4h, .Mnemonic: "ld1", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
480 { .Opcode: AArch64::LD1Twov2s, .Mnemonic: "ld1", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
481 { .Opcode: AArch64::LD1Twov1d, .Mnemonic: "ld1", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
482 { .Opcode: AArch64::LD1Twov16b_POST, .Mnemonic: "ld1", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
483 { .Opcode: AArch64::LD1Twov8h_POST, .Mnemonic: "ld1", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
484 { .Opcode: AArch64::LD1Twov4s_POST, .Mnemonic: "ld1", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
485 { .Opcode: AArch64::LD1Twov2d_POST, .Mnemonic: "ld1", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
486 { .Opcode: AArch64::LD1Twov8b_POST, .Mnemonic: "ld1", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
487 { .Opcode: AArch64::LD1Twov4h_POST, .Mnemonic: "ld1", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
488 { .Opcode: AArch64::LD1Twov2s_POST, .Mnemonic: "ld1", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
489 { .Opcode: AArch64::LD1Twov1d_POST, .Mnemonic: "ld1", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
490 { .Opcode: AArch64::LD1Threev16b, .Mnemonic: "ld1", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
491 { .Opcode: AArch64::LD1Threev8h, .Mnemonic: "ld1", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
492 { .Opcode: AArch64::LD1Threev4s, .Mnemonic: "ld1", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
493 { .Opcode: AArch64::LD1Threev2d, .Mnemonic: "ld1", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
494 { .Opcode: AArch64::LD1Threev8b, .Mnemonic: "ld1", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
495 { .Opcode: AArch64::LD1Threev4h, .Mnemonic: "ld1", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
496 { .Opcode: AArch64::LD1Threev2s, .Mnemonic: "ld1", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
497 { .Opcode: AArch64::LD1Threev1d, .Mnemonic: "ld1", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
498 { .Opcode: AArch64::LD1Threev16b_POST, .Mnemonic: "ld1", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
499 { .Opcode: AArch64::LD1Threev8h_POST, .Mnemonic: "ld1", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
500 { .Opcode: AArch64::LD1Threev4s_POST, .Mnemonic: "ld1", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
501 { .Opcode: AArch64::LD1Threev2d_POST, .Mnemonic: "ld1", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
502 { .Opcode: AArch64::LD1Threev8b_POST, .Mnemonic: "ld1", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
503 { .Opcode: AArch64::LD1Threev4h_POST, .Mnemonic: "ld1", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
504 { .Opcode: AArch64::LD1Threev2s_POST, .Mnemonic: "ld1", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
505 { .Opcode: AArch64::LD1Threev1d_POST, .Mnemonic: "ld1", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
506 { .Opcode: AArch64::LD1Fourv16b, .Mnemonic: "ld1", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
507 { .Opcode: AArch64::LD1Fourv8h, .Mnemonic: "ld1", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
508 { .Opcode: AArch64::LD1Fourv4s, .Mnemonic: "ld1", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
509 { .Opcode: AArch64::LD1Fourv2d, .Mnemonic: "ld1", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
510 { .Opcode: AArch64::LD1Fourv8b, .Mnemonic: "ld1", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
511 { .Opcode: AArch64::LD1Fourv4h, .Mnemonic: "ld1", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
512 { .Opcode: AArch64::LD1Fourv2s, .Mnemonic: "ld1", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
513 { .Opcode: AArch64::LD1Fourv1d, .Mnemonic: "ld1", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
514 { .Opcode: AArch64::LD1Fourv16b_POST, .Mnemonic: "ld1", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
515 { .Opcode: AArch64::LD1Fourv8h_POST, .Mnemonic: "ld1", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
516 { .Opcode: AArch64::LD1Fourv4s_POST, .Mnemonic: "ld1", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
517 { .Opcode: AArch64::LD1Fourv2d_POST, .Mnemonic: "ld1", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
518 { .Opcode: AArch64::LD1Fourv8b_POST, .Mnemonic: "ld1", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
519 { .Opcode: AArch64::LD1Fourv4h_POST, .Mnemonic: "ld1", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
520 { .Opcode: AArch64::LD1Fourv2s_POST, .Mnemonic: "ld1", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
521 { .Opcode: AArch64::LD1Fourv1d_POST, .Mnemonic: "ld1", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
522 { .Opcode: AArch64::LD2i8, .Mnemonic: "ld2", .Layout: ".b", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
523 { .Opcode: AArch64::LD2i16, .Mnemonic: "ld2", .Layout: ".h", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
524 { .Opcode: AArch64::LD2i32, .Mnemonic: "ld2", .Layout: ".s", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
525 { .Opcode: AArch64::LD2i64, .Mnemonic: "ld2", .Layout: ".d", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
526 { .Opcode: AArch64::LD2i8_POST, .Mnemonic: "ld2", .Layout: ".b", .ListOperand: 2, .HasLane: true, .NaturalOffset: 2 },
527 { .Opcode: AArch64::LD2i16_POST, .Mnemonic: "ld2", .Layout: ".h", .ListOperand: 2, .HasLane: true, .NaturalOffset: 4 },
528 { .Opcode: AArch64::LD2i32_POST, .Mnemonic: "ld2", .Layout: ".s", .ListOperand: 2, .HasLane: true, .NaturalOffset: 8 },
529 { .Opcode: AArch64::LD2i64_POST, .Mnemonic: "ld2", .Layout: ".d", .ListOperand: 2, .HasLane: true, .NaturalOffset: 16 },
530 { .Opcode: AArch64::LD2Rv16b, .Mnemonic: "ld2r", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
531 { .Opcode: AArch64::LD2Rv8h, .Mnemonic: "ld2r", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
532 { .Opcode: AArch64::LD2Rv4s, .Mnemonic: "ld2r", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
533 { .Opcode: AArch64::LD2Rv2d, .Mnemonic: "ld2r", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
534 { .Opcode: AArch64::LD2Rv8b, .Mnemonic: "ld2r", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
535 { .Opcode: AArch64::LD2Rv4h, .Mnemonic: "ld2r", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
536 { .Opcode: AArch64::LD2Rv2s, .Mnemonic: "ld2r", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
537 { .Opcode: AArch64::LD2Rv1d, .Mnemonic: "ld2r", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
538 { .Opcode: AArch64::LD2Rv16b_POST, .Mnemonic: "ld2r", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 2 },
539 { .Opcode: AArch64::LD2Rv8h_POST, .Mnemonic: "ld2r", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 4 },
540 { .Opcode: AArch64::LD2Rv4s_POST, .Mnemonic: "ld2r", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
541 { .Opcode: AArch64::LD2Rv2d_POST, .Mnemonic: "ld2r", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
542 { .Opcode: AArch64::LD2Rv8b_POST, .Mnemonic: "ld2r", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 2 },
543 { .Opcode: AArch64::LD2Rv4h_POST, .Mnemonic: "ld2r", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 4 },
544 { .Opcode: AArch64::LD2Rv2s_POST, .Mnemonic: "ld2r", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
545 { .Opcode: AArch64::LD2Rv1d_POST, .Mnemonic: "ld2r", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
546 { .Opcode: AArch64::LD2Twov16b, .Mnemonic: "ld2", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
547 { .Opcode: AArch64::LD2Twov8h, .Mnemonic: "ld2", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
548 { .Opcode: AArch64::LD2Twov4s, .Mnemonic: "ld2", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
549 { .Opcode: AArch64::LD2Twov2d, .Mnemonic: "ld2", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
550 { .Opcode: AArch64::LD2Twov8b, .Mnemonic: "ld2", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
551 { .Opcode: AArch64::LD2Twov4h, .Mnemonic: "ld2", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
552 { .Opcode: AArch64::LD2Twov2s, .Mnemonic: "ld2", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
553 { .Opcode: AArch64::LD2Twov16b_POST, .Mnemonic: "ld2", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
554 { .Opcode: AArch64::LD2Twov8h_POST, .Mnemonic: "ld2", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
555 { .Opcode: AArch64::LD2Twov4s_POST, .Mnemonic: "ld2", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
556 { .Opcode: AArch64::LD2Twov2d_POST, .Mnemonic: "ld2", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
557 { .Opcode: AArch64::LD2Twov8b_POST, .Mnemonic: "ld2", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
558 { .Opcode: AArch64::LD2Twov4h_POST, .Mnemonic: "ld2", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
559 { .Opcode: AArch64::LD2Twov2s_POST, .Mnemonic: "ld2", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
560 { .Opcode: AArch64::LD3i8, .Mnemonic: "ld3", .Layout: ".b", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
561 { .Opcode: AArch64::LD3i16, .Mnemonic: "ld3", .Layout: ".h", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
562 { .Opcode: AArch64::LD3i32, .Mnemonic: "ld3", .Layout: ".s", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
563 { .Opcode: AArch64::LD3i64, .Mnemonic: "ld3", .Layout: ".d", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
564 { .Opcode: AArch64::LD3i8_POST, .Mnemonic: "ld3", .Layout: ".b", .ListOperand: 2, .HasLane: true, .NaturalOffset: 3 },
565 { .Opcode: AArch64::LD3i16_POST, .Mnemonic: "ld3", .Layout: ".h", .ListOperand: 2, .HasLane: true, .NaturalOffset: 6 },
566 { .Opcode: AArch64::LD3i32_POST, .Mnemonic: "ld3", .Layout: ".s", .ListOperand: 2, .HasLane: true, .NaturalOffset: 12 },
567 { .Opcode: AArch64::LD3i64_POST, .Mnemonic: "ld3", .Layout: ".d", .ListOperand: 2, .HasLane: true, .NaturalOffset: 24 },
568 { .Opcode: AArch64::LD3Rv16b, .Mnemonic: "ld3r", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
569 { .Opcode: AArch64::LD3Rv8h, .Mnemonic: "ld3r", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
570 { .Opcode: AArch64::LD3Rv4s, .Mnemonic: "ld3r", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
571 { .Opcode: AArch64::LD3Rv2d, .Mnemonic: "ld3r", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
572 { .Opcode: AArch64::LD3Rv8b, .Mnemonic: "ld3r", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
573 { .Opcode: AArch64::LD3Rv4h, .Mnemonic: "ld3r", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
574 { .Opcode: AArch64::LD3Rv2s, .Mnemonic: "ld3r", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
575 { .Opcode: AArch64::LD3Rv1d, .Mnemonic: "ld3r", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
576 { .Opcode: AArch64::LD3Rv16b_POST, .Mnemonic: "ld3r", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 3 },
577 { .Opcode: AArch64::LD3Rv8h_POST, .Mnemonic: "ld3r", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 6 },
578 { .Opcode: AArch64::LD3Rv4s_POST, .Mnemonic: "ld3r", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 12 },
579 { .Opcode: AArch64::LD3Rv2d_POST, .Mnemonic: "ld3r", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
580 { .Opcode: AArch64::LD3Rv8b_POST, .Mnemonic: "ld3r", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 3 },
581 { .Opcode: AArch64::LD3Rv4h_POST, .Mnemonic: "ld3r", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 6 },
582 { .Opcode: AArch64::LD3Rv2s_POST, .Mnemonic: "ld3r", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 12 },
583 { .Opcode: AArch64::LD3Rv1d_POST, .Mnemonic: "ld3r", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
584 { .Opcode: AArch64::LD3Threev16b, .Mnemonic: "ld3", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
585 { .Opcode: AArch64::LD3Threev8h, .Mnemonic: "ld3", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
586 { .Opcode: AArch64::LD3Threev4s, .Mnemonic: "ld3", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
587 { .Opcode: AArch64::LD3Threev2d, .Mnemonic: "ld3", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
588 { .Opcode: AArch64::LD3Threev8b, .Mnemonic: "ld3", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
589 { .Opcode: AArch64::LD3Threev4h, .Mnemonic: "ld3", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
590 { .Opcode: AArch64::LD3Threev2s, .Mnemonic: "ld3", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
591 { .Opcode: AArch64::LD3Threev16b_POST, .Mnemonic: "ld3", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
592 { .Opcode: AArch64::LD3Threev8h_POST, .Mnemonic: "ld3", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
593 { .Opcode: AArch64::LD3Threev4s_POST, .Mnemonic: "ld3", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
594 { .Opcode: AArch64::LD3Threev2d_POST, .Mnemonic: "ld3", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
595 { .Opcode: AArch64::LD3Threev8b_POST, .Mnemonic: "ld3", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
596 { .Opcode: AArch64::LD3Threev4h_POST, .Mnemonic: "ld3", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
597 { .Opcode: AArch64::LD3Threev2s_POST, .Mnemonic: "ld3", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
598 { .Opcode: AArch64::LD4i8, .Mnemonic: "ld4", .Layout: ".b", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
599 { .Opcode: AArch64::LD4i16, .Mnemonic: "ld4", .Layout: ".h", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
600 { .Opcode: AArch64::LD4i32, .Mnemonic: "ld4", .Layout: ".s", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
601 { .Opcode: AArch64::LD4i64, .Mnemonic: "ld4", .Layout: ".d", .ListOperand: 1, .HasLane: true, .NaturalOffset: 0 },
602 { .Opcode: AArch64::LD4i8_POST, .Mnemonic: "ld4", .Layout: ".b", .ListOperand: 2, .HasLane: true, .NaturalOffset: 4 },
603 { .Opcode: AArch64::LD4i16_POST, .Mnemonic: "ld4", .Layout: ".h", .ListOperand: 2, .HasLane: true, .NaturalOffset: 8 },
604 { .Opcode: AArch64::LD4i32_POST, .Mnemonic: "ld4", .Layout: ".s", .ListOperand: 2, .HasLane: true, .NaturalOffset: 16 },
605 { .Opcode: AArch64::LD4i64_POST, .Mnemonic: "ld4", .Layout: ".d", .ListOperand: 2, .HasLane: true, .NaturalOffset: 32 },
606 { .Opcode: AArch64::LD4Rv16b, .Mnemonic: "ld4r", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
607 { .Opcode: AArch64::LD4Rv8h, .Mnemonic: "ld4r", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
608 { .Opcode: AArch64::LD4Rv4s, .Mnemonic: "ld4r", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
609 { .Opcode: AArch64::LD4Rv2d, .Mnemonic: "ld4r", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
610 { .Opcode: AArch64::LD4Rv8b, .Mnemonic: "ld4r", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
611 { .Opcode: AArch64::LD4Rv4h, .Mnemonic: "ld4r", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
612 { .Opcode: AArch64::LD4Rv2s, .Mnemonic: "ld4r", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
613 { .Opcode: AArch64::LD4Rv1d, .Mnemonic: "ld4r", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
614 { .Opcode: AArch64::LD4Rv16b_POST, .Mnemonic: "ld4r", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 4 },
615 { .Opcode: AArch64::LD4Rv8h_POST, .Mnemonic: "ld4r", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
616 { .Opcode: AArch64::LD4Rv4s_POST, .Mnemonic: "ld4r", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
617 { .Opcode: AArch64::LD4Rv2d_POST, .Mnemonic: "ld4r", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
618 { .Opcode: AArch64::LD4Rv8b_POST, .Mnemonic: "ld4r", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 4 },
619 { .Opcode: AArch64::LD4Rv4h_POST, .Mnemonic: "ld4r", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
620 { .Opcode: AArch64::LD4Rv2s_POST, .Mnemonic: "ld4r", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
621 { .Opcode: AArch64::LD4Rv1d_POST, .Mnemonic: "ld4r", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
622 { .Opcode: AArch64::LD4Fourv16b, .Mnemonic: "ld4", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
623 { .Opcode: AArch64::LD4Fourv8h, .Mnemonic: "ld4", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
624 { .Opcode: AArch64::LD4Fourv4s, .Mnemonic: "ld4", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
625 { .Opcode: AArch64::LD4Fourv2d, .Mnemonic: "ld4", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
626 { .Opcode: AArch64::LD4Fourv8b, .Mnemonic: "ld4", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
627 { .Opcode: AArch64::LD4Fourv4h, .Mnemonic: "ld4", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
628 { .Opcode: AArch64::LD4Fourv2s, .Mnemonic: "ld4", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
629 { .Opcode: AArch64::LD4Fourv16b_POST, .Mnemonic: "ld4", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
630 { .Opcode: AArch64::LD4Fourv8h_POST, .Mnemonic: "ld4", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
631 { .Opcode: AArch64::LD4Fourv4s_POST, .Mnemonic: "ld4", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
632 { .Opcode: AArch64::LD4Fourv2d_POST, .Mnemonic: "ld4", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
633 { .Opcode: AArch64::LD4Fourv8b_POST, .Mnemonic: "ld4", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
634 { .Opcode: AArch64::LD4Fourv4h_POST, .Mnemonic: "ld4", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
635 { .Opcode: AArch64::LD4Fourv2s_POST, .Mnemonic: "ld4", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
636 { .Opcode: AArch64::ST1i8, .Mnemonic: "st1", .Layout: ".b", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
637 { .Opcode: AArch64::ST1i16, .Mnemonic: "st1", .Layout: ".h", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
638 { .Opcode: AArch64::ST1i32, .Mnemonic: "st1", .Layout: ".s", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
639 { .Opcode: AArch64::ST1i64, .Mnemonic: "st1", .Layout: ".d", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
640 { .Opcode: AArch64::ST1i8_POST, .Mnemonic: "st1", .Layout: ".b", .ListOperand: 1, .HasLane: true, .NaturalOffset: 1 },
641 { .Opcode: AArch64::ST1i16_POST, .Mnemonic: "st1", .Layout: ".h", .ListOperand: 1, .HasLane: true, .NaturalOffset: 2 },
642 { .Opcode: AArch64::ST1i32_POST, .Mnemonic: "st1", .Layout: ".s", .ListOperand: 1, .HasLane: true, .NaturalOffset: 4 },
643 { .Opcode: AArch64::ST1i64_POST, .Mnemonic: "st1", .Layout: ".d", .ListOperand: 1, .HasLane: true, .NaturalOffset: 8 },
644 { .Opcode: AArch64::ST1Onev16b, .Mnemonic: "st1", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
645 { .Opcode: AArch64::ST1Onev8h, .Mnemonic: "st1", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
646 { .Opcode: AArch64::ST1Onev4s, .Mnemonic: "st1", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
647 { .Opcode: AArch64::ST1Onev2d, .Mnemonic: "st1", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
648 { .Opcode: AArch64::ST1Onev8b, .Mnemonic: "st1", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
649 { .Opcode: AArch64::ST1Onev4h, .Mnemonic: "st1", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
650 { .Opcode: AArch64::ST1Onev2s, .Mnemonic: "st1", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
651 { .Opcode: AArch64::ST1Onev1d, .Mnemonic: "st1", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
652 { .Opcode: AArch64::ST1Onev16b_POST, .Mnemonic: "st1", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
653 { .Opcode: AArch64::ST1Onev8h_POST, .Mnemonic: "st1", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
654 { .Opcode: AArch64::ST1Onev4s_POST, .Mnemonic: "st1", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
655 { .Opcode: AArch64::ST1Onev2d_POST, .Mnemonic: "st1", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
656 { .Opcode: AArch64::ST1Onev8b_POST, .Mnemonic: "st1", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
657 { .Opcode: AArch64::ST1Onev4h_POST, .Mnemonic: "st1", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
658 { .Opcode: AArch64::ST1Onev2s_POST, .Mnemonic: "st1", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
659 { .Opcode: AArch64::ST1Onev1d_POST, .Mnemonic: "st1", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 8 },
660 { .Opcode: AArch64::ST1Twov16b, .Mnemonic: "st1", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
661 { .Opcode: AArch64::ST1Twov8h, .Mnemonic: "st1", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
662 { .Opcode: AArch64::ST1Twov4s, .Mnemonic: "st1", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
663 { .Opcode: AArch64::ST1Twov2d, .Mnemonic: "st1", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
664 { .Opcode: AArch64::ST1Twov8b, .Mnemonic: "st1", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
665 { .Opcode: AArch64::ST1Twov4h, .Mnemonic: "st1", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
666 { .Opcode: AArch64::ST1Twov2s, .Mnemonic: "st1", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
667 { .Opcode: AArch64::ST1Twov1d, .Mnemonic: "st1", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
668 { .Opcode: AArch64::ST1Twov16b_POST, .Mnemonic: "st1", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
669 { .Opcode: AArch64::ST1Twov8h_POST, .Mnemonic: "st1", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
670 { .Opcode: AArch64::ST1Twov4s_POST, .Mnemonic: "st1", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
671 { .Opcode: AArch64::ST1Twov2d_POST, .Mnemonic: "st1", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
672 { .Opcode: AArch64::ST1Twov8b_POST, .Mnemonic: "st1", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
673 { .Opcode: AArch64::ST1Twov4h_POST, .Mnemonic: "st1", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
674 { .Opcode: AArch64::ST1Twov2s_POST, .Mnemonic: "st1", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
675 { .Opcode: AArch64::ST1Twov1d_POST, .Mnemonic: "st1", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
676 { .Opcode: AArch64::ST1Threev16b, .Mnemonic: "st1", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
677 { .Opcode: AArch64::ST1Threev8h, .Mnemonic: "st1", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
678 { .Opcode: AArch64::ST1Threev4s, .Mnemonic: "st1", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
679 { .Opcode: AArch64::ST1Threev2d, .Mnemonic: "st1", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
680 { .Opcode: AArch64::ST1Threev8b, .Mnemonic: "st1", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
681 { .Opcode: AArch64::ST1Threev4h, .Mnemonic: "st1", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
682 { .Opcode: AArch64::ST1Threev2s, .Mnemonic: "st1", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
683 { .Opcode: AArch64::ST1Threev1d, .Mnemonic: "st1", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
684 { .Opcode: AArch64::ST1Threev16b_POST, .Mnemonic: "st1", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
685 { .Opcode: AArch64::ST1Threev8h_POST, .Mnemonic: "st1", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
686 { .Opcode: AArch64::ST1Threev4s_POST, .Mnemonic: "st1", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
687 { .Opcode: AArch64::ST1Threev2d_POST, .Mnemonic: "st1", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
688 { .Opcode: AArch64::ST1Threev8b_POST, .Mnemonic: "st1", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
689 { .Opcode: AArch64::ST1Threev4h_POST, .Mnemonic: "st1", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
690 { .Opcode: AArch64::ST1Threev2s_POST, .Mnemonic: "st1", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
691 { .Opcode: AArch64::ST1Threev1d_POST, .Mnemonic: "st1", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
692 { .Opcode: AArch64::ST1Fourv16b, .Mnemonic: "st1", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
693 { .Opcode: AArch64::ST1Fourv8h, .Mnemonic: "st1", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
694 { .Opcode: AArch64::ST1Fourv4s, .Mnemonic: "st1", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
695 { .Opcode: AArch64::ST1Fourv2d, .Mnemonic: "st1", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
696 { .Opcode: AArch64::ST1Fourv8b, .Mnemonic: "st1", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
697 { .Opcode: AArch64::ST1Fourv4h, .Mnemonic: "st1", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
698 { .Opcode: AArch64::ST1Fourv2s, .Mnemonic: "st1", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
699 { .Opcode: AArch64::ST1Fourv1d, .Mnemonic: "st1", .Layout: ".1d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
700 { .Opcode: AArch64::ST1Fourv16b_POST, .Mnemonic: "st1", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
701 { .Opcode: AArch64::ST1Fourv8h_POST, .Mnemonic: "st1", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
702 { .Opcode: AArch64::ST1Fourv4s_POST, .Mnemonic: "st1", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
703 { .Opcode: AArch64::ST1Fourv2d_POST, .Mnemonic: "st1", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
704 { .Opcode: AArch64::ST1Fourv8b_POST, .Mnemonic: "st1", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
705 { .Opcode: AArch64::ST1Fourv4h_POST, .Mnemonic: "st1", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
706 { .Opcode: AArch64::ST1Fourv2s_POST, .Mnemonic: "st1", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
707 { .Opcode: AArch64::ST1Fourv1d_POST, .Mnemonic: "st1", .Layout: ".1d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
708 { .Opcode: AArch64::ST2i8, .Mnemonic: "st2", .Layout: ".b", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
709 { .Opcode: AArch64::ST2i16, .Mnemonic: "st2", .Layout: ".h", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
710 { .Opcode: AArch64::ST2i32, .Mnemonic: "st2", .Layout: ".s", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
711 { .Opcode: AArch64::ST2i64, .Mnemonic: "st2", .Layout: ".d", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
712 { .Opcode: AArch64::ST2i8_POST, .Mnemonic: "st2", .Layout: ".b", .ListOperand: 1, .HasLane: true, .NaturalOffset: 2 },
713 { .Opcode: AArch64::ST2i16_POST, .Mnemonic: "st2", .Layout: ".h", .ListOperand: 1, .HasLane: true, .NaturalOffset: 4 },
714 { .Opcode: AArch64::ST2i32_POST, .Mnemonic: "st2", .Layout: ".s", .ListOperand: 1, .HasLane: true, .NaturalOffset: 8 },
715 { .Opcode: AArch64::ST2i64_POST, .Mnemonic: "st2", .Layout: ".d", .ListOperand: 1, .HasLane: true, .NaturalOffset: 16 },
716 { .Opcode: AArch64::ST2Twov16b, .Mnemonic: "st2", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
717 { .Opcode: AArch64::ST2Twov8h, .Mnemonic: "st2", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
718 { .Opcode: AArch64::ST2Twov4s, .Mnemonic: "st2", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
719 { .Opcode: AArch64::ST2Twov2d, .Mnemonic: "st2", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
720 { .Opcode: AArch64::ST2Twov8b, .Mnemonic: "st2", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
721 { .Opcode: AArch64::ST2Twov4h, .Mnemonic: "st2", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
722 { .Opcode: AArch64::ST2Twov2s, .Mnemonic: "st2", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
723 { .Opcode: AArch64::ST2Twov16b_POST, .Mnemonic: "st2", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
724 { .Opcode: AArch64::ST2Twov8h_POST, .Mnemonic: "st2", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
725 { .Opcode: AArch64::ST2Twov4s_POST, .Mnemonic: "st2", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
726 { .Opcode: AArch64::ST2Twov2d_POST, .Mnemonic: "st2", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
727 { .Opcode: AArch64::ST2Twov8b_POST, .Mnemonic: "st2", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
728 { .Opcode: AArch64::ST2Twov4h_POST, .Mnemonic: "st2", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
729 { .Opcode: AArch64::ST2Twov2s_POST, .Mnemonic: "st2", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 16 },
730 { .Opcode: AArch64::ST3i8, .Mnemonic: "st3", .Layout: ".b", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
731 { .Opcode: AArch64::ST3i16, .Mnemonic: "st3", .Layout: ".h", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
732 { .Opcode: AArch64::ST3i32, .Mnemonic: "st3", .Layout: ".s", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
733 { .Opcode: AArch64::ST3i64, .Mnemonic: "st3", .Layout: ".d", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
734 { .Opcode: AArch64::ST3i8_POST, .Mnemonic: "st3", .Layout: ".b", .ListOperand: 1, .HasLane: true, .NaturalOffset: 3 },
735 { .Opcode: AArch64::ST3i16_POST, .Mnemonic: "st3", .Layout: ".h", .ListOperand: 1, .HasLane: true, .NaturalOffset: 6 },
736 { .Opcode: AArch64::ST3i32_POST, .Mnemonic: "st3", .Layout: ".s", .ListOperand: 1, .HasLane: true, .NaturalOffset: 12 },
737 { .Opcode: AArch64::ST3i64_POST, .Mnemonic: "st3", .Layout: ".d", .ListOperand: 1, .HasLane: true, .NaturalOffset: 24 },
738 { .Opcode: AArch64::ST3Threev16b, .Mnemonic: "st3", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
739 { .Opcode: AArch64::ST3Threev8h, .Mnemonic: "st3", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
740 { .Opcode: AArch64::ST3Threev4s, .Mnemonic: "st3", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
741 { .Opcode: AArch64::ST3Threev2d, .Mnemonic: "st3", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
742 { .Opcode: AArch64::ST3Threev8b, .Mnemonic: "st3", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
743 { .Opcode: AArch64::ST3Threev4h, .Mnemonic: "st3", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
744 { .Opcode: AArch64::ST3Threev2s, .Mnemonic: "st3", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
745 { .Opcode: AArch64::ST3Threev16b_POST, .Mnemonic: "st3", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
746 { .Opcode: AArch64::ST3Threev8h_POST, .Mnemonic: "st3", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
747 { .Opcode: AArch64::ST3Threev4s_POST, .Mnemonic: "st3", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
748 { .Opcode: AArch64::ST3Threev2d_POST, .Mnemonic: "st3", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 48 },
749 { .Opcode: AArch64::ST3Threev8b_POST, .Mnemonic: "st3", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
750 { .Opcode: AArch64::ST3Threev4h_POST, .Mnemonic: "st3", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
751 { .Opcode: AArch64::ST3Threev2s_POST, .Mnemonic: "st3", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 24 },
752 { .Opcode: AArch64::ST4i8, .Mnemonic: "st4", .Layout: ".b", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
753 { .Opcode: AArch64::ST4i16, .Mnemonic: "st4", .Layout: ".h", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
754 { .Opcode: AArch64::ST4i32, .Mnemonic: "st4", .Layout: ".s", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
755 { .Opcode: AArch64::ST4i64, .Mnemonic: "st4", .Layout: ".d", .ListOperand: 0, .HasLane: true, .NaturalOffset: 0 },
756 { .Opcode: AArch64::ST4i8_POST, .Mnemonic: "st4", .Layout: ".b", .ListOperand: 1, .HasLane: true, .NaturalOffset: 4 },
757 { .Opcode: AArch64::ST4i16_POST, .Mnemonic: "st4", .Layout: ".h", .ListOperand: 1, .HasLane: true, .NaturalOffset: 8 },
758 { .Opcode: AArch64::ST4i32_POST, .Mnemonic: "st4", .Layout: ".s", .ListOperand: 1, .HasLane: true, .NaturalOffset: 16 },
759 { .Opcode: AArch64::ST4i64_POST, .Mnemonic: "st4", .Layout: ".d", .ListOperand: 1, .HasLane: true, .NaturalOffset: 32 },
760 { .Opcode: AArch64::ST4Fourv16b, .Mnemonic: "st4", .Layout: ".16b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
761 { .Opcode: AArch64::ST4Fourv8h, .Mnemonic: "st4", .Layout: ".8h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
762 { .Opcode: AArch64::ST4Fourv4s, .Mnemonic: "st4", .Layout: ".4s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
763 { .Opcode: AArch64::ST4Fourv2d, .Mnemonic: "st4", .Layout: ".2d", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
764 { .Opcode: AArch64::ST4Fourv8b, .Mnemonic: "st4", .Layout: ".8b", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
765 { .Opcode: AArch64::ST4Fourv4h, .Mnemonic: "st4", .Layout: ".4h", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
766 { .Opcode: AArch64::ST4Fourv2s, .Mnemonic: "st4", .Layout: ".2s", .ListOperand: 0, .HasLane: false, .NaturalOffset: 0 },
767 { .Opcode: AArch64::ST4Fourv16b_POST, .Mnemonic: "st4", .Layout: ".16b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
768 { .Opcode: AArch64::ST4Fourv8h_POST, .Mnemonic: "st4", .Layout: ".8h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
769 { .Opcode: AArch64::ST4Fourv4s_POST, .Mnemonic: "st4", .Layout: ".4s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
770 { .Opcode: AArch64::ST4Fourv2d_POST, .Mnemonic: "st4", .Layout: ".2d", .ListOperand: 1, .HasLane: false, .NaturalOffset: 64 },
771 { .Opcode: AArch64::ST4Fourv8b_POST, .Mnemonic: "st4", .Layout: ".8b", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
772 { .Opcode: AArch64::ST4Fourv4h_POST, .Mnemonic: "st4", .Layout: ".4h", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
773 { .Opcode: AArch64::ST4Fourv2s_POST, .Mnemonic: "st4", .Layout: ".2s", .ListOperand: 1, .HasLane: false, .NaturalOffset: 32 },
774};
775
776static const LdStNInstrDesc *getLdStNInstrDesc(unsigned Opcode) {
777 for (const auto &Info : LdStNInstInfo)
778 if (Info.Opcode == Opcode)
779 return &Info;
780
781 return nullptr;
782}
783
784void AArch64AppleInstPrinter::printInst(const MCInst *MI, uint64_t Address,
785 StringRef Annot,
786 const MCSubtargetInfo &STI,
787 raw_ostream &O) {
788 unsigned Opcode = MI->getOpcode();
789 StringRef Layout;
790
791 bool IsTbx;
792 if (isTblTbxInstruction(Opcode: MI->getOpcode(), Layout, IsTbx)) {
793 O << "\t" << (IsTbx ? "tbx" : "tbl") << Layout << '\t';
794 printRegName(OS&: O, Reg: MI->getOperand(i: 0).getReg(), AltIdx: AArch64::vreg);
795 O << ", ";
796
797 unsigned ListOpNum = IsTbx ? 2 : 1;
798 printVectorList(MI, OpNum: ListOpNum, STI, O, LayoutSuffix: "");
799
800 O << ", ";
801 printRegName(OS&: O, Reg: MI->getOperand(i: ListOpNum + 1).getReg(), AltIdx: AArch64::vreg);
802 printAnnotation(OS&: O, Annot);
803 return;
804 }
805
806 if (const LdStNInstrDesc *LdStDesc = getLdStNInstrDesc(Opcode)) {
807 O << "\t" << LdStDesc->Mnemonic << LdStDesc->Layout << '\t';
808
809 // Now onto the operands: first a vector list with possible lane
810 // specifier. E.g. { v0 }[2]
811 int OpNum = LdStDesc->ListOperand;
812 printVectorList(MI, OpNum: OpNum++, STI, O, LayoutSuffix: "");
813
814 if (LdStDesc->HasLane)
815 O << '[' << MI->getOperand(i: OpNum++).getImm() << ']';
816
817 // Next the address: [xN]
818 unsigned AddrReg = MI->getOperand(i: OpNum++).getReg();
819 O << ", [";
820 printRegName(OS&: O, Reg: AddrReg);
821 O << ']';
822
823 // Finally, there might be a post-indexed offset.
824 if (LdStDesc->NaturalOffset != 0) {
825 unsigned Reg = MI->getOperand(i: OpNum++).getReg();
826 if (Reg != AArch64::XZR) {
827 O << ", ";
828 printRegName(OS&: O, Reg);
829 } else {
830 assert(LdStDesc->NaturalOffset && "no offset on post-inc instruction?");
831 O << ", ";
832 markup(OS&: O, M: Markup::Immediate) << "#" << LdStDesc->NaturalOffset;
833 }
834 }
835
836 printAnnotation(OS&: O, Annot);
837 return;
838 }
839
840 AArch64InstPrinter::printInst(MI, Address, Annot, STI, O);
841}
842
843StringRef AArch64AppleInstPrinter::getRegName(MCRegister Reg) const {
844 return getRegisterName(Reg);
845}
846
847bool AArch64InstPrinter::printRangePrefetchAlias(const MCInst *MI,
848 const MCSubtargetInfo &STI,
849 raw_ostream &O,
850 StringRef Annot) {
851 unsigned Opcode = MI->getOpcode();
852
853#ifndef NDEBUG
854 assert(((Opcode == AArch64::PRFMroX) || (Opcode == AArch64::PRFMroW)) &&
855 "Invalid opcode for RPRFM alias!");
856#endif
857
858 unsigned PRFOp = MI->getOperand(i: 0).getImm();
859 unsigned Mask = 0x18; // 0b11000
860 if ((PRFOp & Mask) != Mask)
861 return false; // Rt != '11xxx', it's a PRFM instruction.
862
863 unsigned Rm = MI->getOperand(i: 2).getReg();
864
865 // "Rm" must be a 64-bit GPR for RPRFM.
866 if (MRI.getRegClass(i: AArch64::GPR32RegClassID).contains(Reg: Rm))
867 Rm = MRI.getMatchingSuperReg(Reg: Rm, SubIdx: AArch64::sub_32,
868 RC: &MRI.getRegClass(i: AArch64::GPR64RegClassID));
869
870 unsigned SignExtend = MI->getOperand(i: 3).getImm(); // encoded in "option<2>".
871 unsigned Shift = MI->getOperand(i: 4).getImm(); // encoded in "S".
872
873 assert((SignExtend <= 1) && "sign extend should be a single bit!");
874 assert((Shift <= 1) && "Shift should be a single bit!");
875
876 unsigned Option0 = (Opcode == AArch64::PRFMroX) ? 1 : 0;
877
878 // encoded in "option<2>:option<0>:S:Rt<2:0>".
879 unsigned RPRFOp =
880 (SignExtend << 5) | (Option0 << 4) | (Shift << 3) | (PRFOp & 0x7);
881
882 O << "\trprfm ";
883 if (auto RPRFM = AArch64RPRFM::lookupRPRFMByEncoding(Encoding: RPRFOp))
884 O << RPRFM->Name << ", ";
885 else
886 O << "#" << formatImm(Value: RPRFOp) << ", ";
887 O << getRegisterName(Reg: Rm);
888 O << ", [";
889 printOperand(MI, OpNo: 1, STI, O); // "Rn".
890 O << "]";
891
892 printAnnotation(OS&: O, Annot);
893
894 return true;
895}
896
897bool AArch64InstPrinter::printSysAlias(const MCInst *MI,
898 const MCSubtargetInfo &STI,
899 raw_ostream &O) {
900#ifndef NDEBUG
901 unsigned Opcode = MI->getOpcode();
902 assert(Opcode == AArch64::SYSxt && "Invalid opcode for SYS alias!");
903#endif
904
905 const MCOperand &Op1 = MI->getOperand(i: 0);
906 const MCOperand &Cn = MI->getOperand(i: 1);
907 const MCOperand &Cm = MI->getOperand(i: 2);
908 const MCOperand &Op2 = MI->getOperand(i: 3);
909
910 unsigned Op1Val = Op1.getImm();
911 unsigned CnVal = Cn.getImm();
912 unsigned CmVal = Cm.getImm();
913 unsigned Op2Val = Op2.getImm();
914
915 uint16_t Encoding = Op2Val;
916 Encoding |= CmVal << 3;
917 Encoding |= CnVal << 7;
918 Encoding |= Op1Val << 11;
919
920 bool NeedsReg;
921 std::string Ins;
922 std::string Name;
923
924 if (CnVal == 7) {
925 switch (CmVal) {
926 default: return false;
927 // Maybe IC, maybe Prediction Restriction
928 case 1:
929 switch (Op1Val) {
930 default: return false;
931 case 0: goto Search_IC;
932 case 3: goto Search_PRCTX;
933 }
934 // Prediction Restriction aliases
935 case 3: {
936 Search_PRCTX:
937 if (Op1Val != 3 || CnVal != 7 || CmVal != 3)
938 return false;
939
940 const auto Requires =
941 Op2Val == 6 ? AArch64::FeatureSPECRES2 : AArch64::FeaturePredRes;
942 if (!(STI.hasFeature(Feature: AArch64::FeatureAll) || STI.hasFeature(Feature: Requires)))
943 return false;
944
945 NeedsReg = true;
946 switch (Op2Val) {
947 default: return false;
948 case 4: Ins = "cfp\t"; break;
949 case 5: Ins = "dvp\t"; break;
950 case 6: Ins = "cosp\t"; break;
951 case 7: Ins = "cpp\t"; break;
952 }
953 Name = "RCTX";
954 }
955 break;
956 // IC aliases
957 case 5: {
958 Search_IC:
959 const AArch64IC::IC *IC = AArch64IC::lookupICByEncoding(Encoding);
960 if (!IC || !IC->haveFeatures(ActiveFeatures: STI.getFeatureBits()))
961 return false;
962
963 NeedsReg = IC->NeedsReg;
964 Ins = "ic\t";
965 Name = std::string(IC->Name);
966 }
967 break;
968 // DC aliases
969 case 4: case 6: case 10: case 11: case 12: case 13: case 14:
970 {
971 const AArch64DC::DC *DC = AArch64DC::lookupDCByEncoding(Encoding);
972 if (!DC || !DC->haveFeatures(ActiveFeatures: STI.getFeatureBits()))
973 return false;
974
975 NeedsReg = true;
976 Ins = "dc\t";
977 Name = std::string(DC->Name);
978 }
979 break;
980 // AT aliases
981 case 8: case 9: {
982 const AArch64AT::AT *AT = AArch64AT::lookupATByEncoding(Encoding);
983 if (!AT || !AT->haveFeatures(ActiveFeatures: STI.getFeatureBits()))
984 return false;
985
986 NeedsReg = true;
987 Ins = "at\t";
988 Name = std::string(AT->Name);
989 }
990 break;
991 }
992 } else if (CnVal == 8 || CnVal == 9) {
993 // TLBI aliases
994 const AArch64TLBI::TLBI *TLBI = AArch64TLBI::lookupTLBIByEncoding(Encoding);
995 if (!TLBI || !TLBI->haveFeatures(ActiveFeatures: STI.getFeatureBits()))
996 return false;
997
998 NeedsReg = TLBI->NeedsReg;
999 Ins = "tlbi\t";
1000 Name = std::string(TLBI->Name);
1001 }
1002 else
1003 return false;
1004
1005 std::string Str = Ins + Name;
1006 std::transform(first: Str.begin(), last: Str.end(), result: Str.begin(), unary_op: ::tolower);
1007
1008 O << '\t' << Str;
1009 if (NeedsReg) {
1010 O << ", ";
1011 printRegName(OS&: O, Reg: MI->getOperand(i: 4).getReg());
1012 }
1013
1014 return true;
1015}
1016
1017bool AArch64InstPrinter::printSyspAlias(const MCInst *MI,
1018 const MCSubtargetInfo &STI,
1019 raw_ostream &O) {
1020#ifndef NDEBUG
1021 unsigned Opcode = MI->getOpcode();
1022 assert((Opcode == AArch64::SYSPxt || Opcode == AArch64::SYSPxt_XZR) &&
1023 "Invalid opcode for SYSP alias!");
1024#endif
1025
1026 const MCOperand &Op1 = MI->getOperand(i: 0);
1027 const MCOperand &Cn = MI->getOperand(i: 1);
1028 const MCOperand &Cm = MI->getOperand(i: 2);
1029 const MCOperand &Op2 = MI->getOperand(i: 3);
1030
1031 unsigned Op1Val = Op1.getImm();
1032 unsigned CnVal = Cn.getImm();
1033 unsigned CmVal = Cm.getImm();
1034 unsigned Op2Val = Op2.getImm();
1035
1036 uint16_t Encoding = Op2Val;
1037 Encoding |= CmVal << 3;
1038 Encoding |= CnVal << 7;
1039 Encoding |= Op1Val << 11;
1040
1041 std::string Ins;
1042 std::string Name;
1043
1044 if (CnVal == 8 || CnVal == 9) {
1045 // TLBIP aliases
1046
1047 if (CnVal == 9) {
1048 if (!STI.hasFeature(Feature: AArch64::FeatureXS))
1049 return false;
1050 Encoding &= ~(1 << 7);
1051 }
1052
1053 const AArch64TLBI::TLBI *TLBI = AArch64TLBI::lookupTLBIByEncoding(Encoding);
1054 if (!TLBI || !TLBI->haveFeatures(ActiveFeatures: STI.getFeatureBits()))
1055 return false;
1056
1057 Ins = "tlbip\t";
1058 Name = std::string(TLBI->Name);
1059 if (CnVal == 9)
1060 Name += "nXS";
1061 } else
1062 return false;
1063
1064 std::string Str = Ins + Name;
1065 std::transform(first: Str.begin(), last: Str.end(), result: Str.begin(), unary_op: ::tolower);
1066
1067 O << '\t' << Str;
1068 O << ", ";
1069 if (MI->getOperand(i: 4).getReg() == AArch64::XZR)
1070 printSyspXzrPair(MI, OpNum: 4, STI, O);
1071 else
1072 printGPRSeqPairsClassOperand<64>(MI, OpNum: 4, STI, O);
1073
1074 return true;
1075}
1076
1077template <int EltSize>
1078void AArch64InstPrinter::printMatrix(const MCInst *MI, unsigned OpNum,
1079 const MCSubtargetInfo &STI,
1080 raw_ostream &O) {
1081 const MCOperand &RegOp = MI->getOperand(i: OpNum);
1082 assert(RegOp.isReg() && "Unexpected operand type!");
1083
1084 printRegName(OS&: O, Reg: RegOp.getReg());
1085 switch (EltSize) {
1086 case 0:
1087 break;
1088 case 8:
1089 O << ".b";
1090 break;
1091 case 16:
1092 O << ".h";
1093 break;
1094 case 32:
1095 O << ".s";
1096 break;
1097 case 64:
1098 O << ".d";
1099 break;
1100 case 128:
1101 O << ".q";
1102 break;
1103 default:
1104 llvm_unreachable("Unsupported element size");
1105 }
1106}
1107
1108template <bool IsVertical>
1109void AArch64InstPrinter::printMatrixTileVector(const MCInst *MI, unsigned OpNum,
1110 const MCSubtargetInfo &STI,
1111 raw_ostream &O) {
1112 const MCOperand &RegOp = MI->getOperand(i: OpNum);
1113 assert(RegOp.isReg() && "Unexpected operand type!");
1114 StringRef RegName = getRegisterName(Reg: RegOp.getReg());
1115
1116 // Insert the horizontal/vertical flag before the suffix.
1117 StringRef Base, Suffix;
1118 std::tie(args&: Base, args&: Suffix) = RegName.split(Separator: '.');
1119 O << Base << (IsVertical ? "v" : "h") << '.' << Suffix;
1120}
1121
1122void AArch64InstPrinter::printMatrixTile(const MCInst *MI, unsigned OpNum,
1123 const MCSubtargetInfo &STI,
1124 raw_ostream &O) {
1125 const MCOperand &RegOp = MI->getOperand(i: OpNum);
1126 assert(RegOp.isReg() && "Unexpected operand type!");
1127 printRegName(OS&: O, Reg: RegOp.getReg());
1128}
1129
1130void AArch64InstPrinter::printSVCROp(const MCInst *MI, unsigned OpNum,
1131 const MCSubtargetInfo &STI,
1132 raw_ostream &O) {
1133 const MCOperand &MO = MI->getOperand(i: OpNum);
1134 assert(MO.isImm() && "Unexpected operand type!");
1135 unsigned svcrop = MO.getImm();
1136 const auto *SVCR = AArch64SVCR::lookupSVCRByEncoding(Encoding: svcrop);
1137 assert(SVCR && "Unexpected SVCR operand!");
1138 O << SVCR->Name;
1139}
1140
1141void AArch64InstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
1142 const MCSubtargetInfo &STI,
1143 raw_ostream &O) {
1144 const MCOperand &Op = MI->getOperand(i: OpNo);
1145 if (Op.isReg()) {
1146 unsigned Reg = Op.getReg();
1147 printRegName(OS&: O, Reg);
1148 } else if (Op.isImm()) {
1149 printImm(MI, OpNo, STI, O);
1150 } else {
1151 assert(Op.isExpr() && "unknown operand kind in printOperand");
1152 Op.getExpr()->print(OS&: O, MAI: &MAI);
1153 }
1154}
1155
1156void AArch64InstPrinter::printImm(const MCInst *MI, unsigned OpNo,
1157 const MCSubtargetInfo &STI,
1158 raw_ostream &O) {
1159 const MCOperand &Op = MI->getOperand(i: OpNo);
1160 markup(OS&: O, M: Markup::Immediate) << "#" << formatImm(Value: Op.getImm());
1161}
1162
1163void AArch64InstPrinter::printImmHex(const MCInst *MI, unsigned OpNo,
1164 const MCSubtargetInfo &STI,
1165 raw_ostream &O) {
1166 const MCOperand &Op = MI->getOperand(i: OpNo);
1167 markup(OS&: O, M: Markup::Immediate) << format(Fmt: "#%#llx", Vals: Op.getImm());
1168}
1169
1170template<int Size>
1171void AArch64InstPrinter::printSImm(const MCInst *MI, unsigned OpNo,
1172 const MCSubtargetInfo &STI,
1173 raw_ostream &O) {
1174 const MCOperand &Op = MI->getOperand(i: OpNo);
1175 if (Size == 8)
1176 markup(OS&: O, M: Markup::Immediate) << "#" << formatImm(Value: (signed char)Op.getImm());
1177 else if (Size == 16)
1178 markup(OS&: O, M: Markup::Immediate) << "#" << formatImm(Value: (signed short)Op.getImm());
1179 else
1180 markup(OS&: O, M: Markup::Immediate) << "#" << formatImm(Value: Op.getImm());
1181}
1182
1183void AArch64InstPrinter::printPostIncOperand(const MCInst *MI, unsigned OpNo,
1184 unsigned Imm, raw_ostream &O) {
1185 const MCOperand &Op = MI->getOperand(i: OpNo);
1186 if (Op.isReg()) {
1187 unsigned Reg = Op.getReg();
1188 if (Reg == AArch64::XZR)
1189 markup(OS&: O, M: Markup::Immediate) << "#" << Imm;
1190 else
1191 printRegName(OS&: O, Reg);
1192 } else
1193 llvm_unreachable("unknown operand kind in printPostIncOperand64");
1194}
1195
1196void AArch64InstPrinter::printVRegOperand(const MCInst *MI, unsigned OpNo,
1197 const MCSubtargetInfo &STI,
1198 raw_ostream &O) {
1199 const MCOperand &Op = MI->getOperand(i: OpNo);
1200 assert(Op.isReg() && "Non-register vreg operand!");
1201 unsigned Reg = Op.getReg();
1202 printRegName(OS&: O, Reg, AltIdx: AArch64::vreg);
1203}
1204
1205void AArch64InstPrinter::printSysCROperand(const MCInst *MI, unsigned OpNo,
1206 const MCSubtargetInfo &STI,
1207 raw_ostream &O) {
1208 const MCOperand &Op = MI->getOperand(i: OpNo);
1209 assert(Op.isImm() && "System instruction C[nm] operands must be immediates!");
1210 O << "c" << Op.getImm();
1211}
1212
1213void AArch64InstPrinter::printAddSubImm(const MCInst *MI, unsigned OpNum,
1214 const MCSubtargetInfo &STI,
1215 raw_ostream &O) {
1216 const MCOperand &MO = MI->getOperand(i: OpNum);
1217 if (MO.isImm()) {
1218 unsigned Val = (MO.getImm() & 0xfff);
1219 assert(Val == MO.getImm() && "Add/sub immediate out of range!");
1220 unsigned Shift =
1221 AArch64_AM::getShiftValue(Imm: MI->getOperand(i: OpNum + 1).getImm());
1222 markup(OS&: O, M: Markup::Immediate) << '#' << formatImm(Value: Val);
1223 if (Shift != 0) {
1224 printShifter(MI, OpNum: OpNum + 1, STI, O);
1225 if (CommentStream)
1226 *CommentStream << '=' << formatImm(Value: Val << Shift) << '\n';
1227 }
1228 } else {
1229 assert(MO.isExpr() && "Unexpected operand type!");
1230 MO.getExpr()->print(OS&: O, MAI: &MAI);
1231 printShifter(MI, OpNum: OpNum + 1, STI, O);
1232 }
1233}
1234
1235template <typename T>
1236void AArch64InstPrinter::printLogicalImm(const MCInst *MI, unsigned OpNum,
1237 const MCSubtargetInfo &STI,
1238 raw_ostream &O) {
1239 uint64_t Val = MI->getOperand(i: OpNum).getImm();
1240 WithMarkup M = markup(OS&: O, M: Markup::Immediate);
1241 O << "#0x";
1242 O.write_hex(N: AArch64_AM::decodeLogicalImmediate(val: Val, regSize: 8 * sizeof(T)));
1243}
1244
1245void AArch64InstPrinter::printShifter(const MCInst *MI, unsigned OpNum,
1246 const MCSubtargetInfo &STI,
1247 raw_ostream &O) {
1248 unsigned Val = MI->getOperand(i: OpNum).getImm();
1249 // LSL #0 should not be printed.
1250 if (AArch64_AM::getShiftType(Imm: Val) == AArch64_AM::LSL &&
1251 AArch64_AM::getShiftValue(Imm: Val) == 0)
1252 return;
1253 O << ", " << AArch64_AM::getShiftExtendName(ST: AArch64_AM::getShiftType(Imm: Val))
1254 << " ";
1255 markup(OS&: O, M: Markup::Immediate) << "#" << AArch64_AM::getShiftValue(Imm: Val);
1256}
1257
1258void AArch64InstPrinter::printShiftedRegister(const MCInst *MI, unsigned OpNum,
1259 const MCSubtargetInfo &STI,
1260 raw_ostream &O) {
1261 printRegName(OS&: O, Reg: MI->getOperand(i: OpNum).getReg());
1262 printShifter(MI, OpNum: OpNum + 1, STI, O);
1263}
1264
1265void AArch64InstPrinter::printExtendedRegister(const MCInst *MI, unsigned OpNum,
1266 const MCSubtargetInfo &STI,
1267 raw_ostream &O) {
1268 printRegName(OS&: O, Reg: MI->getOperand(i: OpNum).getReg());
1269 printArithExtend(MI, OpNum: OpNum + 1, STI, O);
1270}
1271
1272void AArch64InstPrinter::printArithExtend(const MCInst *MI, unsigned OpNum,
1273 const MCSubtargetInfo &STI,
1274 raw_ostream &O) {
1275 unsigned Val = MI->getOperand(i: OpNum).getImm();
1276 AArch64_AM::ShiftExtendType ExtType = AArch64_AM::getArithExtendType(Imm: Val);
1277 unsigned ShiftVal = AArch64_AM::getArithShiftValue(Imm: Val);
1278
1279 // If the destination or first source register operand is [W]SP, print
1280 // UXTW/UXTX as LSL, and if the shift amount is also zero, print nothing at
1281 // all.
1282 if (ExtType == AArch64_AM::UXTW || ExtType == AArch64_AM::UXTX) {
1283 unsigned Dest = MI->getOperand(i: 0).getReg();
1284 unsigned Src1 = MI->getOperand(i: 1).getReg();
1285 if ( ((Dest == AArch64::SP || Src1 == AArch64::SP) &&
1286 ExtType == AArch64_AM::UXTX) ||
1287 ((Dest == AArch64::WSP || Src1 == AArch64::WSP) &&
1288 ExtType == AArch64_AM::UXTW) ) {
1289 if (ShiftVal != 0) {
1290 O << ", lsl ";
1291 markup(OS&: O, M: Markup::Immediate) << "#" << ShiftVal;
1292 }
1293 return;
1294 }
1295 }
1296 O << ", " << AArch64_AM::getShiftExtendName(ST: ExtType);
1297 if (ShiftVal != 0) {
1298 O << " ";
1299 markup(OS&: O, M: Markup::Immediate) << "#" << ShiftVal;
1300 }
1301}
1302
1303void AArch64InstPrinter::printMemExtendImpl(bool SignExtend, bool DoShift,
1304 unsigned Width, char SrcRegKind,
1305 raw_ostream &O) {
1306 // sxtw, sxtx, uxtw or lsl (== uxtx)
1307 bool IsLSL = !SignExtend && SrcRegKind == 'x';
1308 if (IsLSL)
1309 O << "lsl";
1310 else
1311 O << (SignExtend ? 's' : 'u') << "xt" << SrcRegKind;
1312
1313 if (DoShift || IsLSL) {
1314 O << " ";
1315 markup(OS&: O, M: Markup::Immediate) << "#" << Log2_32(Value: Width / 8);
1316 }
1317}
1318
1319void AArch64InstPrinter::printMemExtend(const MCInst *MI, unsigned OpNum,
1320 raw_ostream &O, char SrcRegKind,
1321 unsigned Width) {
1322 bool SignExtend = MI->getOperand(i: OpNum).getImm();
1323 bool DoShift = MI->getOperand(i: OpNum + 1).getImm();
1324 printMemExtendImpl(SignExtend, DoShift, Width, SrcRegKind, O);
1325}
1326
1327template <bool SignExtend, int ExtWidth, char SrcRegKind, char Suffix>
1328void AArch64InstPrinter::printRegWithShiftExtend(const MCInst *MI,
1329 unsigned OpNum,
1330 const MCSubtargetInfo &STI,
1331 raw_ostream &O) {
1332 printOperand(MI, OpNo: OpNum, STI, O);
1333 if (Suffix == 's' || Suffix == 'd')
1334 O << '.' << Suffix;
1335 else
1336 assert(Suffix == 0 && "Unsupported suffix size");
1337
1338 bool DoShift = ExtWidth != 8;
1339 if (SignExtend || DoShift || SrcRegKind == 'w') {
1340 O << ", ";
1341 printMemExtendImpl(SignExtend, DoShift, Width: ExtWidth, SrcRegKind, O);
1342 }
1343}
1344
1345template <int EltSize>
1346void AArch64InstPrinter::printPredicateAsCounter(const MCInst *MI,
1347 unsigned OpNum,
1348 const MCSubtargetInfo &STI,
1349 raw_ostream &O) {
1350 unsigned Reg = MI->getOperand(i: OpNum).getReg();
1351 if (Reg < AArch64::PN0 || Reg > AArch64::PN15)
1352 llvm_unreachable("Unsupported predicate-as-counter register");
1353 O << "pn" << Reg - AArch64::PN0;
1354
1355 switch (EltSize) {
1356 case 0:
1357 break;
1358 case 8:
1359 O << ".b";
1360 break;
1361 case 16:
1362 O << ".h";
1363 break;
1364 case 32:
1365 O << ".s";
1366 break;
1367 case 64:
1368 O << ".d";
1369 break;
1370 default:
1371 llvm_unreachable("Unsupported element size");
1372 }
1373}
1374
1375void AArch64InstPrinter::printCondCode(const MCInst *MI, unsigned OpNum,
1376 const MCSubtargetInfo &STI,
1377 raw_ostream &O) {
1378 AArch64CC::CondCode CC = (AArch64CC::CondCode)MI->getOperand(i: OpNum).getImm();
1379 O << AArch64CC::getCondCodeName(Code: CC);
1380}
1381
1382void AArch64InstPrinter::printInverseCondCode(const MCInst *MI, unsigned OpNum,
1383 const MCSubtargetInfo &STI,
1384 raw_ostream &O) {
1385 AArch64CC::CondCode CC = (AArch64CC::CondCode)MI->getOperand(i: OpNum).getImm();
1386 O << AArch64CC::getCondCodeName(Code: AArch64CC::getInvertedCondCode(Code: CC));
1387}
1388
1389void AArch64InstPrinter::printAMNoIndex(const MCInst *MI, unsigned OpNum,
1390 const MCSubtargetInfo &STI,
1391 raw_ostream &O) {
1392 O << '[';
1393 printRegName(OS&: O, Reg: MI->getOperand(i: OpNum).getReg());
1394 O << ']';
1395}
1396
1397template <int Scale>
1398void AArch64InstPrinter::printImmScale(const MCInst *MI, unsigned OpNum,
1399 const MCSubtargetInfo &STI,
1400 raw_ostream &O) {
1401 markup(OS&: O, M: Markup::Immediate)
1402 << '#' << formatImm(Value: Scale * MI->getOperand(i: OpNum).getImm());
1403}
1404
1405template <int Scale, int Offset>
1406void AArch64InstPrinter::printImmRangeScale(const MCInst *MI, unsigned OpNum,
1407 const MCSubtargetInfo &STI,
1408 raw_ostream &O) {
1409 unsigned FirstImm = Scale * MI->getOperand(i: OpNum).getImm();
1410 O << formatImm(Value: FirstImm);
1411 O << ":" << formatImm(Value: FirstImm + Offset);
1412}
1413
1414void AArch64InstPrinter::printUImm12Offset(const MCInst *MI, unsigned OpNum,
1415 unsigned Scale, raw_ostream &O) {
1416 const MCOperand MO = MI->getOperand(i: OpNum);
1417 if (MO.isImm()) {
1418 markup(OS&: O, M: Markup::Immediate) << '#' << formatImm(Value: MO.getImm() * Scale);
1419 } else {
1420 assert(MO.isExpr() && "Unexpected operand type!");
1421 MO.getExpr()->print(OS&: O, MAI: &MAI);
1422 }
1423}
1424
1425void AArch64InstPrinter::printAMIndexedWB(const MCInst *MI, unsigned OpNum,
1426 unsigned Scale, raw_ostream &O) {
1427 const MCOperand MO1 = MI->getOperand(i: OpNum + 1);
1428 O << '[';
1429 printRegName(OS&: O, Reg: MI->getOperand(i: OpNum).getReg());
1430 if (MO1.isImm()) {
1431 O << ", ";
1432 markup(OS&: O, M: Markup::Immediate) << "#" << formatImm(Value: MO1.getImm() * Scale);
1433 } else {
1434 assert(MO1.isExpr() && "Unexpected operand type!");
1435 O << ", ";
1436 MO1.getExpr()->print(OS&: O, MAI: &MAI);
1437 }
1438 O << ']';
1439}
1440
1441void AArch64InstPrinter::printRPRFMOperand(const MCInst *MI, unsigned OpNum,
1442 const MCSubtargetInfo &STI,
1443 raw_ostream &O) {
1444 unsigned prfop = MI->getOperand(i: OpNum).getImm();
1445 if (auto PRFM = AArch64RPRFM::lookupRPRFMByEncoding(Encoding: prfop)) {
1446 O << PRFM->Name;
1447 return;
1448 }
1449
1450 O << '#' << formatImm(Value: prfop);
1451}
1452
1453template <bool IsSVEPrefetch>
1454void AArch64InstPrinter::printPrefetchOp(const MCInst *MI, unsigned OpNum,
1455 const MCSubtargetInfo &STI,
1456 raw_ostream &O) {
1457 unsigned prfop = MI->getOperand(i: OpNum).getImm();
1458 if (IsSVEPrefetch) {
1459 if (auto PRFM = AArch64SVEPRFM::lookupSVEPRFMByEncoding(Encoding: prfop)) {
1460 O << PRFM->Name;
1461 return;
1462 }
1463 } else {
1464 auto PRFM = AArch64PRFM::lookupPRFMByEncoding(Encoding: prfop);
1465 if (PRFM && PRFM->haveFeatures(ActiveFeatures: STI.getFeatureBits())) {
1466 O << PRFM->Name;
1467 return;
1468 }
1469 }
1470
1471 markup(OS&: O, M: Markup::Immediate) << '#' << formatImm(Value: prfop);
1472}
1473
1474void AArch64InstPrinter::printPSBHintOp(const MCInst *MI, unsigned OpNum,
1475 const MCSubtargetInfo &STI,
1476 raw_ostream &O) {
1477 unsigned psbhintop = MI->getOperand(i: OpNum).getImm();
1478 auto PSB = AArch64PSBHint::lookupPSBByEncoding(Encoding: psbhintop);
1479 if (PSB)
1480 O << PSB->Name;
1481 else
1482 markup(OS&: O, M: Markup::Immediate) << '#' << formatImm(Value: psbhintop);
1483}
1484
1485void AArch64InstPrinter::printBTIHintOp(const MCInst *MI, unsigned OpNum,
1486 const MCSubtargetInfo &STI,
1487 raw_ostream &O) {
1488 unsigned btihintop = MI->getOperand(i: OpNum).getImm() ^ 32;
1489 auto BTI = AArch64BTIHint::lookupBTIByEncoding(Encoding: btihintop);
1490 if (BTI)
1491 O << BTI->Name;
1492 else
1493 markup(OS&: O, M: Markup::Immediate) << '#' << formatImm(Value: btihintop);
1494}
1495
1496void AArch64InstPrinter::printFPImmOperand(const MCInst *MI, unsigned OpNum,
1497 const MCSubtargetInfo &STI,
1498 raw_ostream &O) {
1499 const MCOperand &MO = MI->getOperand(i: OpNum);
1500 float FPImm = MO.isDFPImm() ? bit_cast<double>(from: MO.getDFPImm())
1501 : AArch64_AM::getFPImmFloat(Imm: MO.getImm());
1502
1503 // 8 decimal places are enough to perfectly represent permitted floats.
1504 markup(OS&: O, M: Markup::Immediate) << format(Fmt: "#%.8f", Vals: FPImm);
1505}
1506
1507static unsigned getNextVectorRegister(unsigned Reg, unsigned Stride = 1) {
1508 while (Stride--) {
1509 switch (Reg) {
1510 default:
1511 llvm_unreachable("Vector register expected!");
1512 case AArch64::Q0: Reg = AArch64::Q1; break;
1513 case AArch64::Q1: Reg = AArch64::Q2; break;
1514 case AArch64::Q2: Reg = AArch64::Q3; break;
1515 case AArch64::Q3: Reg = AArch64::Q4; break;
1516 case AArch64::Q4: Reg = AArch64::Q5; break;
1517 case AArch64::Q5: Reg = AArch64::Q6; break;
1518 case AArch64::Q6: Reg = AArch64::Q7; break;
1519 case AArch64::Q7: Reg = AArch64::Q8; break;
1520 case AArch64::Q8: Reg = AArch64::Q9; break;
1521 case AArch64::Q9: Reg = AArch64::Q10; break;
1522 case AArch64::Q10: Reg = AArch64::Q11; break;
1523 case AArch64::Q11: Reg = AArch64::Q12; break;
1524 case AArch64::Q12: Reg = AArch64::Q13; break;
1525 case AArch64::Q13: Reg = AArch64::Q14; break;
1526 case AArch64::Q14: Reg = AArch64::Q15; break;
1527 case AArch64::Q15: Reg = AArch64::Q16; break;
1528 case AArch64::Q16: Reg = AArch64::Q17; break;
1529 case AArch64::Q17: Reg = AArch64::Q18; break;
1530 case AArch64::Q18: Reg = AArch64::Q19; break;
1531 case AArch64::Q19: Reg = AArch64::Q20; break;
1532 case AArch64::Q20: Reg = AArch64::Q21; break;
1533 case AArch64::Q21: Reg = AArch64::Q22; break;
1534 case AArch64::Q22: Reg = AArch64::Q23; break;
1535 case AArch64::Q23: Reg = AArch64::Q24; break;
1536 case AArch64::Q24: Reg = AArch64::Q25; break;
1537 case AArch64::Q25: Reg = AArch64::Q26; break;
1538 case AArch64::Q26: Reg = AArch64::Q27; break;
1539 case AArch64::Q27: Reg = AArch64::Q28; break;
1540 case AArch64::Q28: Reg = AArch64::Q29; break;
1541 case AArch64::Q29: Reg = AArch64::Q30; break;
1542 case AArch64::Q30: Reg = AArch64::Q31; break;
1543 // Vector lists can wrap around.
1544 case AArch64::Q31:
1545 Reg = AArch64::Q0;
1546 break;
1547 case AArch64::Z0: Reg = AArch64::Z1; break;
1548 case AArch64::Z1: Reg = AArch64::Z2; break;
1549 case AArch64::Z2: Reg = AArch64::Z3; break;
1550 case AArch64::Z3: Reg = AArch64::Z4; break;
1551 case AArch64::Z4: Reg = AArch64::Z5; break;
1552 case AArch64::Z5: Reg = AArch64::Z6; break;
1553 case AArch64::Z6: Reg = AArch64::Z7; break;
1554 case AArch64::Z7: Reg = AArch64::Z8; break;
1555 case AArch64::Z8: Reg = AArch64::Z9; break;
1556 case AArch64::Z9: Reg = AArch64::Z10; break;
1557 case AArch64::Z10: Reg = AArch64::Z11; break;
1558 case AArch64::Z11: Reg = AArch64::Z12; break;
1559 case AArch64::Z12: Reg = AArch64::Z13; break;
1560 case AArch64::Z13: Reg = AArch64::Z14; break;
1561 case AArch64::Z14: Reg = AArch64::Z15; break;
1562 case AArch64::Z15: Reg = AArch64::Z16; break;
1563 case AArch64::Z16: Reg = AArch64::Z17; break;
1564 case AArch64::Z17: Reg = AArch64::Z18; break;
1565 case AArch64::Z18: Reg = AArch64::Z19; break;
1566 case AArch64::Z19: Reg = AArch64::Z20; break;
1567 case AArch64::Z20: Reg = AArch64::Z21; break;
1568 case AArch64::Z21: Reg = AArch64::Z22; break;
1569 case AArch64::Z22: Reg = AArch64::Z23; break;
1570 case AArch64::Z23: Reg = AArch64::Z24; break;
1571 case AArch64::Z24: Reg = AArch64::Z25; break;
1572 case AArch64::Z25: Reg = AArch64::Z26; break;
1573 case AArch64::Z26: Reg = AArch64::Z27; break;
1574 case AArch64::Z27: Reg = AArch64::Z28; break;
1575 case AArch64::Z28: Reg = AArch64::Z29; break;
1576 case AArch64::Z29: Reg = AArch64::Z30; break;
1577 case AArch64::Z30: Reg = AArch64::Z31; break;
1578 // Vector lists can wrap around.
1579 case AArch64::Z31:
1580 Reg = AArch64::Z0;
1581 break;
1582 case AArch64::P0: Reg = AArch64::P1; break;
1583 case AArch64::P1: Reg = AArch64::P2; break;
1584 case AArch64::P2: Reg = AArch64::P3; break;
1585 case AArch64::P3: Reg = AArch64::P4; break;
1586 case AArch64::P4: Reg = AArch64::P5; break;
1587 case AArch64::P5: Reg = AArch64::P6; break;
1588 case AArch64::P6: Reg = AArch64::P7; break;
1589 case AArch64::P7: Reg = AArch64::P8; break;
1590 case AArch64::P8: Reg = AArch64::P9; break;
1591 case AArch64::P9: Reg = AArch64::P10; break;
1592 case AArch64::P10: Reg = AArch64::P11; break;
1593 case AArch64::P11: Reg = AArch64::P12; break;
1594 case AArch64::P12: Reg = AArch64::P13; break;
1595 case AArch64::P13: Reg = AArch64::P14; break;
1596 case AArch64::P14: Reg = AArch64::P15; break;
1597 // Vector lists can wrap around.
1598 case AArch64::P15: Reg = AArch64::P0; break;
1599 }
1600 }
1601 return Reg;
1602}
1603
1604template<unsigned size>
1605void AArch64InstPrinter::printGPRSeqPairsClassOperand(const MCInst *MI,
1606 unsigned OpNum,
1607 const MCSubtargetInfo &STI,
1608 raw_ostream &O) {
1609 static_assert(size == 64 || size == 32,
1610 "Template parameter must be either 32 or 64");
1611 unsigned Reg = MI->getOperand(i: OpNum).getReg();
1612
1613 unsigned Sube = (size == 32) ? AArch64::sube32 : AArch64::sube64;
1614 unsigned Subo = (size == 32) ? AArch64::subo32 : AArch64::subo64;
1615
1616 unsigned Even = MRI.getSubReg(Reg, Idx: Sube);
1617 unsigned Odd = MRI.getSubReg(Reg, Idx: Subo);
1618 printRegName(OS&: O, Reg: Even);
1619 O << ", ";
1620 printRegName(OS&: O, Reg: Odd);
1621}
1622
1623void AArch64InstPrinter::printMatrixTileList(const MCInst *MI, unsigned OpNum,
1624 const MCSubtargetInfo &STI,
1625 raw_ostream &O) {
1626 unsigned MaxRegs = 8;
1627 unsigned RegMask = MI->getOperand(i: OpNum).getImm();
1628
1629 unsigned NumRegs = 0;
1630 for (unsigned I = 0; I < MaxRegs; ++I)
1631 if ((RegMask & (1 << I)) != 0)
1632 ++NumRegs;
1633
1634 O << "{";
1635 unsigned Printed = 0;
1636 for (unsigned I = 0; I < MaxRegs; ++I) {
1637 unsigned Reg = RegMask & (1 << I);
1638 if (Reg == 0)
1639 continue;
1640 printRegName(OS&: O, Reg: AArch64::ZAD0 + I);
1641 if (Printed + 1 != NumRegs)
1642 O << ", ";
1643 ++Printed;
1644 }
1645 O << "}";
1646}
1647
1648void AArch64InstPrinter::printVectorList(const MCInst *MI, unsigned OpNum,
1649 const MCSubtargetInfo &STI,
1650 raw_ostream &O,
1651 StringRef LayoutSuffix) {
1652 unsigned Reg = MI->getOperand(i: OpNum).getReg();
1653
1654 O << "{ ";
1655
1656 // Work out how many registers there are in the list (if there is an actual
1657 // list).
1658 unsigned NumRegs = 1;
1659 if (MRI.getRegClass(i: AArch64::DDRegClassID).contains(Reg) ||
1660 MRI.getRegClass(i: AArch64::ZPR2RegClassID).contains(Reg) ||
1661 MRI.getRegClass(i: AArch64::QQRegClassID).contains(Reg) ||
1662 MRI.getRegClass(i: AArch64::PPR2RegClassID).contains(Reg) ||
1663 MRI.getRegClass(i: AArch64::ZPR2StridedRegClassID).contains(Reg))
1664 NumRegs = 2;
1665 else if (MRI.getRegClass(i: AArch64::DDDRegClassID).contains(Reg) ||
1666 MRI.getRegClass(i: AArch64::ZPR3RegClassID).contains(Reg) ||
1667 MRI.getRegClass(i: AArch64::QQQRegClassID).contains(Reg))
1668 NumRegs = 3;
1669 else if (MRI.getRegClass(i: AArch64::DDDDRegClassID).contains(Reg) ||
1670 MRI.getRegClass(i: AArch64::ZPR4RegClassID).contains(Reg) ||
1671 MRI.getRegClass(i: AArch64::QQQQRegClassID).contains(Reg) ||
1672 MRI.getRegClass(i: AArch64::ZPR4StridedRegClassID).contains(Reg))
1673 NumRegs = 4;
1674
1675 unsigned Stride = 1;
1676 if (MRI.getRegClass(i: AArch64::ZPR2StridedRegClassID).contains(Reg))
1677 Stride = 8;
1678 else if (MRI.getRegClass(i: AArch64::ZPR4StridedRegClassID).contains(Reg))
1679 Stride = 4;
1680
1681 // Now forget about the list and find out what the first register is.
1682 if (unsigned FirstReg = MRI.getSubReg(Reg, Idx: AArch64::dsub0))
1683 Reg = FirstReg;
1684 else if (unsigned FirstReg = MRI.getSubReg(Reg, Idx: AArch64::qsub0))
1685 Reg = FirstReg;
1686 else if (unsigned FirstReg = MRI.getSubReg(Reg, Idx: AArch64::zsub0))
1687 Reg = FirstReg;
1688 else if (unsigned FirstReg = MRI.getSubReg(Reg, Idx: AArch64::psub0))
1689 Reg = FirstReg;
1690
1691 // If it's a D-reg, we need to promote it to the equivalent Q-reg before
1692 // printing (otherwise getRegisterName fails).
1693 if (MRI.getRegClass(i: AArch64::FPR64RegClassID).contains(Reg)) {
1694 const MCRegisterClass &FPR128RC =
1695 MRI.getRegClass(i: AArch64::FPR128RegClassID);
1696 Reg = MRI.getMatchingSuperReg(Reg, SubIdx: AArch64::dsub, RC: &FPR128RC);
1697 }
1698
1699 if ((MRI.getRegClass(i: AArch64::ZPRRegClassID).contains(Reg) ||
1700 MRI.getRegClass(i: AArch64::PPRRegClassID).contains(Reg)) &&
1701 NumRegs > 1 && Stride == 1 &&
1702 // Do not print the range when the last register is lower than the first.
1703 // Because it is a wrap-around register.
1704 Reg < getNextVectorRegister(Reg, Stride: NumRegs - 1)) {
1705 printRegName(OS&: O, Reg);
1706 O << LayoutSuffix;
1707 if (NumRegs > 1) {
1708 // Set of two sve registers should be separated by ','
1709 StringRef split_char = NumRegs == 2 ? ", " : " - ";
1710 O << split_char;
1711 printRegName(OS&: O, Reg: (getNextVectorRegister(Reg, Stride: NumRegs - 1)));
1712 O << LayoutSuffix;
1713 }
1714 } else {
1715 for (unsigned i = 0; i < NumRegs;
1716 ++i, Reg = getNextVectorRegister(Reg, Stride)) {
1717 // wrap-around sve register
1718 if (MRI.getRegClass(i: AArch64::ZPRRegClassID).contains(Reg) ||
1719 MRI.getRegClass(i: AArch64::PPRRegClassID).contains(Reg))
1720 printRegName(OS&: O, Reg);
1721 else
1722 printRegName(OS&: O, Reg, AltIdx: AArch64::vreg);
1723 O << LayoutSuffix;
1724 if (i + 1 != NumRegs)
1725 O << ", ";
1726 }
1727 }
1728 O << " }";
1729}
1730
1731void
1732AArch64InstPrinter::printImplicitlyTypedVectorList(const MCInst *MI,
1733 unsigned OpNum,
1734 const MCSubtargetInfo &STI,
1735 raw_ostream &O) {
1736 printVectorList(MI, OpNum, STI, O, LayoutSuffix: "");
1737}
1738
1739template <unsigned NumLanes, char LaneKind>
1740void AArch64InstPrinter::printTypedVectorList(const MCInst *MI, unsigned OpNum,
1741 const MCSubtargetInfo &STI,
1742 raw_ostream &O) {
1743 if (LaneKind == 0) {
1744 printVectorList(MI, OpNum, STI, O, LayoutSuffix: "");
1745 return;
1746 }
1747 std::string Suffix(".");
1748 if (NumLanes)
1749 Suffix += itostr(X: NumLanes) + LaneKind;
1750 else
1751 Suffix += LaneKind;
1752
1753 printVectorList(MI, OpNum, STI, O, LayoutSuffix: Suffix);
1754}
1755
1756template <unsigned Scale>
1757void AArch64InstPrinter::printVectorIndex(const MCInst *MI, unsigned OpNum,
1758 const MCSubtargetInfo &STI,
1759 raw_ostream &O) {
1760 O << "[" << Scale * MI->getOperand(i: OpNum).getImm() << "]";
1761}
1762
1763template <unsigned Scale>
1764void AArch64InstPrinter::printMatrixIndex(const MCInst *MI, unsigned OpNum,
1765 const MCSubtargetInfo &STI,
1766 raw_ostream &O) {
1767 O << Scale * MI->getOperand(i: OpNum).getImm();
1768}
1769
1770void AArch64InstPrinter::printAlignedLabel(const MCInst *MI, uint64_t Address,
1771 unsigned OpNum,
1772 const MCSubtargetInfo &STI,
1773 raw_ostream &O) {
1774 const MCOperand &Op = MI->getOperand(i: OpNum);
1775
1776 // If the label has already been resolved to an immediate offset (say, when
1777 // we're running the disassembler), just print the immediate.
1778 if (Op.isImm()) {
1779 int64_t Offset = Op.getImm() * 4;
1780 if (PrintBranchImmAsAddress)
1781 markup(OS&: O, M: Markup::Target) << formatHex(Value: Address + Offset);
1782 else
1783 markup(OS&: O, M: Markup::Immediate) << "#" << formatImm(Value: Offset);
1784 return;
1785 }
1786
1787 // If the branch target is simply an address then print it in hex.
1788 const MCConstantExpr *BranchTarget =
1789 dyn_cast<MCConstantExpr>(Val: MI->getOperand(i: OpNum).getExpr());
1790 int64_t TargetAddress;
1791 if (BranchTarget && BranchTarget->evaluateAsAbsolute(Res&: TargetAddress)) {
1792 markup(OS&: O, M: Markup::Target) << formatHex(Value: (uint64_t)TargetAddress);
1793 } else {
1794 // Otherwise, just print the expression.
1795 MI->getOperand(i: OpNum).getExpr()->print(OS&: O, MAI: &MAI);
1796 }
1797}
1798
1799void AArch64InstPrinter::printAdrAdrpLabel(const MCInst *MI, uint64_t Address,
1800 unsigned OpNum,
1801 const MCSubtargetInfo &STI,
1802 raw_ostream &O) {
1803 const MCOperand &Op = MI->getOperand(i: OpNum);
1804
1805 // If the label has already been resolved to an immediate offset (say, when
1806 // we're running the disassembler), just print the immediate.
1807 if (Op.isImm()) {
1808 int64_t Offset = Op.getImm();
1809 if (MI->getOpcode() == AArch64::ADRP) {
1810 Offset = Offset * 4096;
1811 Address = Address & -4096;
1812 }
1813 WithMarkup M = markup(OS&: O, M: Markup::Immediate);
1814 if (PrintBranchImmAsAddress)
1815 markup(OS&: O, M: Markup::Target) << formatHex(Value: Address + Offset);
1816 else
1817 markup(OS&: O, M: Markup::Immediate) << "#" << Offset;
1818 return;
1819 }
1820
1821 // Otherwise, just print the expression.
1822 MI->getOperand(i: OpNum).getExpr()->print(OS&: O, MAI: &MAI);
1823}
1824
1825void AArch64InstPrinter::printBarrierOption(const MCInst *MI, unsigned OpNo,
1826 const MCSubtargetInfo &STI,
1827 raw_ostream &O) {
1828 unsigned Val = MI->getOperand(i: OpNo).getImm();
1829 unsigned Opcode = MI->getOpcode();
1830
1831 StringRef Name;
1832 if (Opcode == AArch64::ISB) {
1833 auto ISB = AArch64ISB::lookupISBByEncoding(Encoding: Val);
1834 Name = ISB ? ISB->Name : "";
1835 } else if (Opcode == AArch64::TSB) {
1836 auto TSB = AArch64TSB::lookupTSBByEncoding(Encoding: Val);
1837 Name = TSB ? TSB->Name : "";
1838 } else {
1839 auto DB = AArch64DB::lookupDBByEncoding(Encoding: Val);
1840 Name = DB ? DB->Name : "";
1841 }
1842 if (!Name.empty())
1843 O << Name;
1844 else
1845 markup(OS&: O, M: Markup::Immediate) << "#" << Val;
1846}
1847
1848void AArch64InstPrinter::printBarriernXSOption(const MCInst *MI, unsigned OpNo,
1849 const MCSubtargetInfo &STI,
1850 raw_ostream &O) {
1851 unsigned Val = MI->getOperand(i: OpNo).getImm();
1852 assert(MI->getOpcode() == AArch64::DSBnXS);
1853
1854 StringRef Name;
1855 auto DB = AArch64DBnXS::lookupDBnXSByEncoding(Encoding: Val);
1856 Name = DB ? DB->Name : "";
1857
1858 if (!Name.empty())
1859 O << Name;
1860 else
1861 markup(OS&: O, M: Markup::Immediate) << "#" << Val;
1862}
1863
1864static bool isValidSysReg(const AArch64SysReg::SysReg *Reg, bool Read,
1865 const MCSubtargetInfo &STI) {
1866 return (Reg && (Read ? Reg->Readable : Reg->Writeable) &&
1867 Reg->haveFeatures(ActiveFeatures: STI.getFeatureBits()));
1868}
1869
1870// Looks up a system register either by encoding or by name. Some system
1871// registers share the same encoding between different architectures,
1872// therefore a tablegen lookup by encoding will return an entry regardless
1873// of the register's predication on a specific subtarget feature. To work
1874// around this problem we keep an alternative name for such registers and
1875// look them up by that name if the first lookup was unsuccessful.
1876static const AArch64SysReg::SysReg *lookupSysReg(unsigned Val, bool Read,
1877 const MCSubtargetInfo &STI) {
1878 const AArch64SysReg::SysReg *Reg = AArch64SysReg::lookupSysRegByEncoding(Val);
1879
1880 if (Reg && !isValidSysReg(Reg, Read, STI))
1881 Reg = AArch64SysReg::lookupSysRegByName(Reg->AltName);
1882
1883 return Reg;
1884}
1885
1886void AArch64InstPrinter::printMRSSystemRegister(const MCInst *MI, unsigned OpNo,
1887 const MCSubtargetInfo &STI,
1888 raw_ostream &O) {
1889 unsigned Val = MI->getOperand(i: OpNo).getImm();
1890
1891 // Horrible hack for the one register that has identical encodings but
1892 // different names in MSR and MRS. Because of this, one of MRS and MSR is
1893 // going to get the wrong entry
1894 if (Val == AArch64SysReg::DBGDTRRX_EL0) {
1895 O << "DBGDTRRX_EL0";
1896 return;
1897 }
1898
1899 // Horrible hack for two different registers having the same encoding.
1900 if (Val == AArch64SysReg::TRCEXTINSELR) {
1901 O << "TRCEXTINSELR";
1902 return;
1903 }
1904
1905 const AArch64SysReg::SysReg *Reg = lookupSysReg(Val, Read: true /*Read*/, STI);
1906
1907 if (isValidSysReg(Reg, Read: true /*Read*/, STI))
1908 O << Reg->Name;
1909 else
1910 O << AArch64SysReg::genericRegisterString(Bits: Val);
1911}
1912
1913void AArch64InstPrinter::printMSRSystemRegister(const MCInst *MI, unsigned OpNo,
1914 const MCSubtargetInfo &STI,
1915 raw_ostream &O) {
1916 unsigned Val = MI->getOperand(i: OpNo).getImm();
1917
1918 // Horrible hack for the one register that has identical encodings but
1919 // different names in MSR and MRS. Because of this, one of MRS and MSR is
1920 // going to get the wrong entry
1921 if (Val == AArch64SysReg::DBGDTRTX_EL0) {
1922 O << "DBGDTRTX_EL0";
1923 return;
1924 }
1925
1926 // Horrible hack for two different registers having the same encoding.
1927 if (Val == AArch64SysReg::TRCEXTINSELR) {
1928 O << "TRCEXTINSELR";
1929 return;
1930 }
1931
1932 const AArch64SysReg::SysReg *Reg = lookupSysReg(Val, Read: false /*Read*/, STI);
1933
1934 if (isValidSysReg(Reg, Read: false /*Read*/, STI))
1935 O << Reg->Name;
1936 else
1937 O << AArch64SysReg::genericRegisterString(Bits: Val);
1938}
1939
1940void AArch64InstPrinter::printSystemPStateField(const MCInst *MI, unsigned OpNo,
1941 const MCSubtargetInfo &STI,
1942 raw_ostream &O) {
1943 unsigned Val = MI->getOperand(i: OpNo).getImm();
1944
1945 auto PStateImm15 = AArch64PState::lookupPStateImm0_15ByEncoding(Encoding: Val);
1946 auto PStateImm1 = AArch64PState::lookupPStateImm0_1ByEncoding(Encoding: Val);
1947 if (PStateImm15 && PStateImm15->haveFeatures(ActiveFeatures: STI.getFeatureBits()))
1948 O << PStateImm15->Name;
1949 else if (PStateImm1 && PStateImm1->haveFeatures(ActiveFeatures: STI.getFeatureBits()))
1950 O << PStateImm1->Name;
1951 else
1952 O << "#" << formatImm(Value: Val);
1953}
1954
1955void AArch64InstPrinter::printSIMDType10Operand(const MCInst *MI, unsigned OpNo,
1956 const MCSubtargetInfo &STI,
1957 raw_ostream &O) {
1958 unsigned RawVal = MI->getOperand(i: OpNo).getImm();
1959 uint64_t Val = AArch64_AM::decodeAdvSIMDModImmType10(Imm: RawVal);
1960 markup(OS&: O, M: Markup::Immediate) << format(Fmt: "#%#016llx", Vals: Val);
1961}
1962
1963template<int64_t Angle, int64_t Remainder>
1964void AArch64InstPrinter::printComplexRotationOp(const MCInst *MI, unsigned OpNo,
1965 const MCSubtargetInfo &STI,
1966 raw_ostream &O) {
1967 unsigned Val = MI->getOperand(i: OpNo).getImm();
1968 markup(OS&: O, M: Markup::Immediate) << "#" << (Val * Angle) + Remainder;
1969}
1970
1971void AArch64InstPrinter::printSVEPattern(const MCInst *MI, unsigned OpNum,
1972 const MCSubtargetInfo &STI,
1973 raw_ostream &O) {
1974 unsigned Val = MI->getOperand(i: OpNum).getImm();
1975 if (auto Pat = AArch64SVEPredPattern::lookupSVEPREDPATByEncoding(Encoding: Val))
1976 O << Pat->Name;
1977 else
1978 markup(OS&: O, M: Markup::Immediate) << '#' << formatImm(Value: Val);
1979}
1980
1981void AArch64InstPrinter::printSVEVecLenSpecifier(const MCInst *MI,
1982 unsigned OpNum,
1983 const MCSubtargetInfo &STI,
1984 raw_ostream &O) {
1985 unsigned Val = MI->getOperand(i: OpNum).getImm();
1986 // Pattern has only 1 bit
1987 if (Val > 1)
1988 llvm_unreachable("Invalid vector length specifier");
1989 if (auto Pat =
1990 AArch64SVEVecLenSpecifier::lookupSVEVECLENSPECIFIERByEncoding(Encoding: Val))
1991 O << Pat->Name;
1992 else
1993 llvm_unreachable("Invalid vector length specifier");
1994}
1995
1996template <char suffix>
1997void AArch64InstPrinter::printSVERegOp(const MCInst *MI, unsigned OpNum,
1998 const MCSubtargetInfo &STI,
1999 raw_ostream &O) {
2000 switch (suffix) {
2001 case 0:
2002 case 'b':
2003 case 'h':
2004 case 's':
2005 case 'd':
2006 case 'q':
2007 break;
2008 default: llvm_unreachable("Invalid kind specifier.");
2009 }
2010
2011 unsigned Reg = MI->getOperand(i: OpNum).getReg();
2012 printRegName(OS&: O, Reg);
2013 if (suffix != 0)
2014 O << '.' << suffix;
2015}
2016
2017template <typename T>
2018void AArch64InstPrinter::printImmSVE(T Value, raw_ostream &O) {
2019 std::make_unsigned_t<T> HexValue = Value;
2020
2021 if (getPrintImmHex())
2022 markup(OS&: O, M: Markup::Immediate) << '#' << formatHex(Value: (uint64_t)HexValue);
2023 else
2024 markup(OS&: O, M: Markup::Immediate) << '#' << formatDec(Value);
2025
2026 if (CommentStream) {
2027 // Do the opposite to that used for instruction operands.
2028 if (getPrintImmHex())
2029 *CommentStream << '=' << formatDec(Value: HexValue) << '\n';
2030 else
2031 *CommentStream << '=' << formatHex(Value: (uint64_t)Value) << '\n';
2032 }
2033}
2034
2035template <typename T>
2036void AArch64InstPrinter::printImm8OptLsl(const MCInst *MI, unsigned OpNum,
2037 const MCSubtargetInfo &STI,
2038 raw_ostream &O) {
2039 unsigned UnscaledVal = MI->getOperand(i: OpNum).getImm();
2040 unsigned Shift = MI->getOperand(i: OpNum + 1).getImm();
2041 assert(AArch64_AM::getShiftType(Shift) == AArch64_AM::LSL &&
2042 "Unexepected shift type!");
2043
2044 // #0 lsl #8 is never pretty printed
2045 if ((UnscaledVal == 0) && (AArch64_AM::getShiftValue(Imm: Shift) != 0)) {
2046 markup(OS&: O, M: Markup::Immediate) << '#' << formatImm(Value: UnscaledVal);
2047 printShifter(MI, OpNum: OpNum + 1, STI, O);
2048 return;
2049 }
2050
2051 T Val;
2052 if (std::is_signed<T>())
2053 Val = (int8_t)UnscaledVal * (1 << AArch64_AM::getShiftValue(Imm: Shift));
2054 else
2055 Val = (uint8_t)UnscaledVal * (1 << AArch64_AM::getShiftValue(Imm: Shift));
2056
2057 printImmSVE(Val, O);
2058}
2059
2060template <typename T>
2061void AArch64InstPrinter::printSVELogicalImm(const MCInst *MI, unsigned OpNum,
2062 const MCSubtargetInfo &STI,
2063 raw_ostream &O) {
2064 typedef std::make_signed_t<T> SignedT;
2065 typedef std::make_unsigned_t<T> UnsignedT;
2066
2067 uint64_t Val = MI->getOperand(i: OpNum).getImm();
2068 UnsignedT PrintVal = AArch64_AM::decodeLogicalImmediate(val: Val, regSize: 64);
2069
2070 // Prefer the default format for 16bit values, hex otherwise.
2071 if ((int16_t)PrintVal == (SignedT)PrintVal)
2072 printImmSVE((T)PrintVal, O);
2073 else if ((uint16_t)PrintVal == PrintVal)
2074 printImmSVE(PrintVal, O);
2075 else
2076 markup(OS&: O, M: Markup::Immediate) << '#' << formatHex(Value: (uint64_t)PrintVal);
2077}
2078
2079template <int Width>
2080void AArch64InstPrinter::printZPRasFPR(const MCInst *MI, unsigned OpNum,
2081 const MCSubtargetInfo &STI,
2082 raw_ostream &O) {
2083 unsigned Base;
2084 switch (Width) {
2085 case 8: Base = AArch64::B0; break;
2086 case 16: Base = AArch64::H0; break;
2087 case 32: Base = AArch64::S0; break;
2088 case 64: Base = AArch64::D0; break;
2089 case 128: Base = AArch64::Q0; break;
2090 default:
2091 llvm_unreachable("Unsupported width");
2092 }
2093 unsigned Reg = MI->getOperand(i: OpNum).getReg();
2094 printRegName(OS&: O, Reg: Reg - AArch64::Z0 + Base);
2095}
2096
2097template <unsigned ImmIs0, unsigned ImmIs1>
2098void AArch64InstPrinter::printExactFPImm(const MCInst *MI, unsigned OpNum,
2099 const MCSubtargetInfo &STI,
2100 raw_ostream &O) {
2101 auto *Imm0Desc = AArch64ExactFPImm::lookupExactFPImmByEnum(Enum: ImmIs0);
2102 auto *Imm1Desc = AArch64ExactFPImm::lookupExactFPImmByEnum(Enum: ImmIs1);
2103 unsigned Val = MI->getOperand(i: OpNum).getImm();
2104 markup(OS&: O, M: Markup::Immediate)
2105 << "#" << (Val ? Imm1Desc->Repr : Imm0Desc->Repr);
2106}
2107
2108void AArch64InstPrinter::printGPR64as32(const MCInst *MI, unsigned OpNum,
2109 const MCSubtargetInfo &STI,
2110 raw_ostream &O) {
2111 unsigned Reg = MI->getOperand(i: OpNum).getReg();
2112 printRegName(OS&: O, Reg: getWRegFromXReg(Reg));
2113}
2114
2115void AArch64InstPrinter::printGPR64x8(const MCInst *MI, unsigned OpNum,
2116 const MCSubtargetInfo &STI,
2117 raw_ostream &O) {
2118 unsigned Reg = MI->getOperand(i: OpNum).getReg();
2119 printRegName(OS&: O, Reg: MRI.getSubReg(Reg, Idx: AArch64::x8sub_0));
2120}
2121
2122void AArch64InstPrinter::printSyspXzrPair(const MCInst *MI, unsigned OpNum,
2123 const MCSubtargetInfo &STI,
2124 raw_ostream &O) {
2125 unsigned Reg = MI->getOperand(i: OpNum).getReg();
2126 assert(Reg == AArch64::XZR &&
2127 "MC representation of SyspXzrPair should be XZR");
2128 O << getRegisterName(Reg) << ", " << getRegisterName(Reg);
2129}
2130