[AArch64][SVE2] Add the SVE2.1 while predicate-as-counter instructions
authorDavid Sherwood <david.sherwood@arm.com>
Wed, 26 Oct 2022 08:50:17 +0000 (08:50 +0000)
committerDavid Sherwood <david.sherwood@arm.com>
Tue, 1 Nov 2022 14:33:39 +0000 (14:33 +0000)
This patch adds the assembly/disassembly for the following
predicate-as-counter instructions:

whilelt: While incrementing signed scalar less than scalar
whilele: While incrementing signed scalar less than or equal to scalar
whilegt: While incrementing signed scalar greater than scalar
whilege: While incrementing signed scalar greater than or equal to scalar
whilelo: While incrementing unsigned scalar lower than scalar
whilels: While incrementing unsigned scalar lower or same as scalar
whilehs: While decrementing unsigned scalar higher or same as scalar
whilehi: While decrementing unsigned scalar higher than scalar

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

Differential Revision: https://reviews.llvm.org/D136750

18 files changed:
llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
llvm/lib/Target/AArch64/SVEInstrFormats.td
llvm/test/MC/AArch64/SVE2p1/whilege-diagnostics.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilege.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilegt-diagnostics.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilegt.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilehi-diagnostics.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilehi.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilehs-diagnostics.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilehs.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilele-diagnostics.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilele.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilelo-diagnostics.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilelo.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilels-diagnostics.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilels.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilelt-diagnostics.s [new file with mode: 0644]
llvm/test/MC/AArch64/SVE2p1/whilelt.s [new file with mode: 0644]

index 2c58734..bef0f71 100644 (file)
@@ -3671,4 +3671,13 @@ defm STNT1B_4Z_IMM : sve2p1_mem_cst_si_4z<"stnt1b", 0b00, 0b1, ZZZZ_b_mul_r>;
 defm STNT1H_4Z_IMM : sve2p1_mem_cst_si_4z<"stnt1h", 0b01, 0b1, ZZZZ_h_mul_r>;
 defm STNT1W_4Z_IMM : sve2p1_mem_cst_si_4z<"stnt1w", 0b10, 0b1, ZZZZ_s_mul_r>;
 defm STNT1D_4Z_IMM : sve2p1_mem_cst_si_4z<"stnt1d", 0b11, 0b1, ZZZZ_d_mul_r>;
+
+defm WHILEGE_CXX  : sve2p1_int_while_rr_pn<"whilege", 0b000>;
+defm WHILEGT_CXX  : sve2p1_int_while_rr_pn<"whilegt", 0b001>;
+defm WHILELT_CXX  : sve2p1_int_while_rr_pn<"whilelt", 0b010>;
+defm WHILELE_CXX  : sve2p1_int_while_rr_pn<"whilele", 0b011>;
+defm WHILEHS_CXX  : sve2p1_int_while_rr_pn<"whilehs", 0b100>;
+defm WHILEHI_CXX  : sve2p1_int_while_rr_pn<"whilehi", 0b101>;
+defm WHILELO_CXX  : sve2p1_int_while_rr_pn<"whilelo", 0b110>;
+defm WHILELS_CXX  : sve2p1_int_while_rr_pn<"whilels", 0b111>;
 } // End HasSVE2p1_or_HasSME2
index 1d9f38a..fa98fa5 100644 (file)
@@ -9058,3 +9058,37 @@ multiclass sve2p1_pcount_pn<string mnemonic, bits<3> opc> {
   def _S : sve2p1_pcount_pn<mnemonic, opc, 0b10, PNR32>;
   def _D : sve2p1_pcount_pn<mnemonic, opc, 0b11, PNR64>;
 }
+
+
+class sve2p1_int_while_rr_pn<string mnemonic, bits<2> sz, bits<3> opc,
+                             PNRP8to15RegOp pnrty>
+    : I<(outs pnrty:$PNd), (ins GPR64:$Rn, GPR64:$Rm, sve_vec_len_specifier_enum:$vl),
+        mnemonic, "\t$PNd, $Rn, $Rm, $vl",
+        "", []>, Sched<[]> {
+  bits<3> PNd;
+  bits<5> Rn;
+  bits<1> vl;
+  bits<5> Rm;
+  let Inst{31-24} = 0b00100101;
+  let Inst{23-22} = sz;
+  let Inst{21}    = 0b1;
+  let Inst{20-16} = Rm;
+  let Inst{15-14} = 0b01;
+  let Inst{13}    = vl;
+  let Inst{12}    = 0b0;
+  let Inst{11-10} = opc{2-1};
+  let Inst{9-5}   = Rn;
+  let Inst{4}     = 0b1;
+  let Inst{3}     = opc{0};
+  let Inst{2-0}   = PNd;
+
+  let Defs = [NZCV];
+}
+
+
+multiclass sve2p1_int_while_rr_pn<string mnemonic, bits<3> opc> {
+ def _B : sve2p1_int_while_rr_pn<mnemonic, 0b00, opc, PNR8_p8to15>;
+ def _H : sve2p1_int_while_rr_pn<mnemonic, 0b01, opc, PNR16_p8to15>;
+ def _S : sve2p1_int_while_rr_pn<mnemonic, 0b10, opc, PNR32_p8to15>;
+ def _D : sve2p1_int_while_rr_pn<mnemonic, 0b11, opc, PNR64_p8to15>;
+}
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilege-diagnostics.s b/llvm/test/MC/AArch64/SVE2p1/whilege-diagnostics.s
new file mode 100644 (file)
index 0000000..908fe56
--- /dev/null
@@ -0,0 +1,30 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 2>&1 < %s | FileCheck %s
+
+// --------------------------------------------------------------------------//
+// Invalid Pattern
+
+whilege pn8.b, x0, x0, vlx1
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
+// CHECK-NEXT: whilege pn8.b, x0, x0, vlx1
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+whilege pn8.b, x0, x0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: too few operands for instruction
+// CHECK-NEXT: whilege pn8.b, x0, x0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Invalid use of predicate without suffix
+
+whilege pn8, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilege pn8, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Out of range Predicate register
+
+whilege pn7.b, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilege pn7.b, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilege.s b/llvm/test/MC/AArch64/SVE2p1/whilege.s
new file mode 100644 (file)
index 0000000..8ebe636
--- /dev/null
@@ -0,0 +1,110 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
+// RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d --mattr=+sme2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN:        | llvm-mc -triple=aarch64 -mattr=+sme2 -disassemble -show-encoding \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+whilege pn8.h, x0, x0, vlx2  // 00100101-01100000-01000000-00010000
+// CHECK-INST: whilege pn8.h, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x40,0x60,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25604010 <unknown>
+
+whilege pn13.h, x10, x21, vlx2  // 00100101-01110101-01000001-01010101
+// CHECK-INST: whilege pn13.h, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x41,0x75,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25754155 <unknown>
+
+whilege pn15.h, x13, x8, vlx4  // 00100101-01101000-01100001-10110111
+// CHECK-INST: whilege pn15.h, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x61,0x68,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 256861b7 <unknown>
+
+whilege pn15.h, xzr, xzr, vlx4  // 00100101-01111111-01100011-11110111
+// CHECK-INST: whilege pn15.h, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x63,0x7f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 257f63f7 <unknown>
+
+whilege pn8.s, x0, x0, vlx2  // 00100101-10100000-01000000-00010000
+// CHECK-INST: whilege pn8.s, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x40,0xa0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a04010 <unknown>
+
+whilege pn13.s, x10, x21, vlx2  // 00100101-10110101-01000001-01010101
+// CHECK-INST: whilege pn13.s, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x41,0xb5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25b54155 <unknown>
+
+whilege pn15.s, x13, x8, vlx4  // 00100101-10101000-01100001-10110111
+// CHECK-INST: whilege pn15.s, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x61,0xa8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a861b7 <unknown>
+
+whilege pn15.s, xzr, xzr, vlx4  // 00100101-10111111-01100011-11110111
+// CHECK-INST: whilege pn15.s, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x63,0xbf,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25bf63f7 <unknown>
+
+whilege pn8.d, x0, x0, vlx2  // 00100101-11100000-01000000-00010000
+// CHECK-INST: whilege pn8.d, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x40,0xe0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e04010 <unknown>
+
+whilege pn13.d, x10, x21, vlx2  // 00100101-11110101-01000001-01010101
+// CHECK-INST: whilege pn13.d, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x41,0xf5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25f54155 <unknown>
+
+whilege pn15.d, x13, x8, vlx4  // 00100101-11101000-01100001-10110111
+// CHECK-INST: whilege pn15.d, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x61,0xe8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e861b7 <unknown>
+
+whilege pn15.d, xzr, xzr, vlx4  // 00100101-11111111-01100011-11110111
+// CHECK-INST: whilege pn15.d, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x63,0xff,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25ff63f7 <unknown>
+
+whilege pn8.b, x0, x0, vlx2  // 00100101-00100000-01000000-00010000
+// CHECK-INST: whilege pn8.b, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x40,0x20,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25204010 <unknown>
+
+whilege pn13.b, x10, x21, vlx2  // 00100101-00110101-01000001-01010101
+// CHECK-INST: whilege pn13.b, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x41,0x35,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25354155 <unknown>
+
+whilege pn15.b, x13, x8, vlx4  // 00100101-00101000-01100001-10110111
+// CHECK-INST: whilege pn15.b, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x61,0x28,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 252861b7 <unknown>
+
+whilege pn15.b, xzr, xzr, vlx4  // 00100101-00111111-01100011-11110111
+// CHECK-INST: whilege pn15.b, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x63,0x3f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 253f63f7 <unknown>
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilegt-diagnostics.s b/llvm/test/MC/AArch64/SVE2p1/whilegt-diagnostics.s
new file mode 100644 (file)
index 0000000..5735ac7
--- /dev/null
@@ -0,0 +1,30 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 2>&1 < %s | FileCheck %s
+
+// --------------------------------------------------------------------------//
+// Invalid Pattern
+
+whilegt pn8.b, x0, x0, vlx1
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
+// CHECK-NEXT: whilegt pn8.b, x0, x0, vlx1
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+whilegt pn8.b, x0, x0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: too few operands for instruction
+// CHECK-NEXT: whilegt pn8.b, x0, x0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Invalid use of predicate without suffix
+
+whilegt pn8, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilegt pn8, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Out of range Predicate register
+
+whilegt pn7.b, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilegt pn7.b, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilegt.s b/llvm/test/MC/AArch64/SVE2p1/whilegt.s
new file mode 100644 (file)
index 0000000..c3f4d5e
--- /dev/null
@@ -0,0 +1,110 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
+// RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d --mattr=+sme2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN:        | llvm-mc -triple=aarch64 -mattr=+sme2 -disassemble -show-encoding \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+whilegt pn8.h, x0, x0, vlx2  // 00100101-01100000-01000000-00011000
+// CHECK-INST: whilegt pn8.h, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x40,0x60,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25604018 <unknown>
+
+whilegt pn13.h, x10, x21, vlx2  // 00100101-01110101-01000001-01011101
+// CHECK-INST: whilegt pn13.h, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x41,0x75,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 2575415d <unknown>
+
+whilegt pn15.h, x13, x8, vlx4  // 00100101-01101000-01100001-10111111
+// CHECK-INST: whilegt pn15.h, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x61,0x68,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 256861bf <unknown>
+
+whilegt pn15.h, xzr, xzr, vlx4  // 00100101-01111111-01100011-11111111
+// CHECK-INST: whilegt pn15.h, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x63,0x7f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 257f63ff <unknown>
+
+whilegt pn8.s, x0, x0, vlx2  // 00100101-10100000-01000000-00011000
+// CHECK-INST: whilegt pn8.s, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x40,0xa0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a04018 <unknown>
+
+whilegt pn13.s, x10, x21, vlx2  // 00100101-10110101-01000001-01011101
+// CHECK-INST: whilegt pn13.s, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x41,0xb5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25b5415d <unknown>
+
+whilegt pn15.s, x13, x8, vlx4  // 00100101-10101000-01100001-10111111
+// CHECK-INST: whilegt pn15.s, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x61,0xa8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a861bf <unknown>
+
+whilegt pn15.s, xzr, xzr, vlx4  // 00100101-10111111-01100011-11111111
+// CHECK-INST: whilegt pn15.s, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x63,0xbf,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25bf63ff <unknown>
+
+whilegt pn8.d, x0, x0, vlx2  // 00100101-11100000-01000000-00011000
+// CHECK-INST: whilegt pn8.d, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x40,0xe0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e04018 <unknown>
+
+whilegt pn13.d, x10, x21, vlx2  // 00100101-11110101-01000001-01011101
+// CHECK-INST: whilegt pn13.d, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x41,0xf5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25f5415d <unknown>
+
+whilegt pn15.d, x13, x8, vlx4  // 00100101-11101000-01100001-10111111
+// CHECK-INST: whilegt pn15.d, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x61,0xe8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e861bf <unknown>
+
+whilegt pn15.d, xzr, xzr, vlx4  // 00100101-11111111-01100011-11111111
+// CHECK-INST: whilegt pn15.d, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x63,0xff,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25ff63ff <unknown>
+
+whilegt pn8.b, x0, x0, vlx2  // 00100101-00100000-01000000-00011000
+// CHECK-INST: whilegt pn8.b, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x40,0x20,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25204018 <unknown>
+
+whilegt pn13.b, x10, x21, vlx2  // 00100101-00110101-01000001-01011101
+// CHECK-INST: whilegt pn13.b, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x41,0x35,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 2535415d <unknown>
+
+whilegt pn15.b, x13, x8, vlx4  // 00100101-00101000-01100001-10111111
+// CHECK-INST: whilegt pn15.b, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x61,0x28,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 252861bf <unknown>
+
+whilegt pn15.b, xzr, xzr, vlx4  // 00100101-00111111-01100011-11111111
+// CHECK-INST: whilegt pn15.b, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x63,0x3f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 253f63ff <unknown>
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilehi-diagnostics.s b/llvm/test/MC/AArch64/SVE2p1/whilehi-diagnostics.s
new file mode 100644 (file)
index 0000000..382646e
--- /dev/null
@@ -0,0 +1,30 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 2>&1 < %s | FileCheck %s
+
+// --------------------------------------------------------------------------//
+// Invalid Pattern
+
+whilehi pn8.b, x0, x0, vlx1
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
+// CHECK-NEXT: whilehi pn8.b, x0, x0, vlx1
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+whilehi pn8.b, x0, x0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: too few operands for instruction
+// CHECK-NEXT: whilehi pn8.b, x0, x0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Invalid use of predicate without suffix
+
+whilehi pn8, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilehi pn8, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Out of range Predicate register
+
+whilehi pn7.b, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilehi pn7.b, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilehi.s b/llvm/test/MC/AArch64/SVE2p1/whilehi.s
new file mode 100644 (file)
index 0000000..b3e6426
--- /dev/null
@@ -0,0 +1,110 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
+// RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d --mattr=+sme2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN:        | llvm-mc -triple=aarch64 -mattr=+sme2 -disassemble -show-encoding \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+whilehi pn8.h, x0, x0, vlx2  // 00100101-01100000-01001000-00011000
+// CHECK-INST: whilehi pn8.h, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x48,0x60,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25604818 <unknown>
+
+whilehi pn13.h, x10, x21, vlx2  // 00100101-01110101-01001001-01011101
+// CHECK-INST: whilehi pn13.h, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x49,0x75,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 2575495d <unknown>
+
+whilehi pn15.h, x13, x8, vlx4  // 00100101-01101000-01101001-10111111
+// CHECK-INST: whilehi pn15.h, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x69,0x68,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 256869bf <unknown>
+
+whilehi pn15.h, xzr, xzr, vlx4  // 00100101-01111111-01101011-11111111
+// CHECK-INST: whilehi pn15.h, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x6b,0x7f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 257f6bff <unknown>
+
+whilehi pn8.s, x0, x0, vlx2  // 00100101-10100000-01001000-00011000
+// CHECK-INST: whilehi pn8.s, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x48,0xa0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a04818 <unknown>
+
+whilehi pn13.s, x10, x21, vlx2  // 00100101-10110101-01001001-01011101
+// CHECK-INST: whilehi pn13.s, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x49,0xb5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25b5495d <unknown>
+
+whilehi pn15.s, x13, x8, vlx4  // 00100101-10101000-01101001-10111111
+// CHECK-INST: whilehi pn15.s, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x69,0xa8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a869bf <unknown>
+
+whilehi pn15.s, xzr, xzr, vlx4  // 00100101-10111111-01101011-11111111
+// CHECK-INST: whilehi pn15.s, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x6b,0xbf,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25bf6bff <unknown>
+
+whilehi pn8.d, x0, x0, vlx2  // 00100101-11100000-01001000-00011000
+// CHECK-INST: whilehi pn8.d, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x48,0xe0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e04818 <unknown>
+
+whilehi pn13.d, x10, x21, vlx2  // 00100101-11110101-01001001-01011101
+// CHECK-INST: whilehi pn13.d, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x49,0xf5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25f5495d <unknown>
+
+whilehi pn15.d, x13, x8, vlx4  // 00100101-11101000-01101001-10111111
+// CHECK-INST: whilehi pn15.d, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x69,0xe8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e869bf <unknown>
+
+whilehi pn15.d, xzr, xzr, vlx4  // 00100101-11111111-01101011-11111111
+// CHECK-INST: whilehi pn15.d, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x6b,0xff,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25ff6bff <unknown>
+
+whilehi pn8.b, x0, x0, vlx2  // 00100101-00100000-01001000-00011000
+// CHECK-INST: whilehi pn8.b, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x48,0x20,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25204818 <unknown>
+
+whilehi pn13.b, x10, x21, vlx2  // 00100101-00110101-01001001-01011101
+// CHECK-INST: whilehi pn13.b, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x49,0x35,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 2535495d <unknown>
+
+whilehi pn15.b, x13, x8, vlx4  // 00100101-00101000-01101001-10111111
+// CHECK-INST: whilehi pn15.b, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x69,0x28,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 252869bf <unknown>
+
+whilehi pn15.b, xzr, xzr, vlx4  // 00100101-00111111-01101011-11111111
+// CHECK-INST: whilehi pn15.b, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x6b,0x3f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 253f6bff <unknown>
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilehs-diagnostics.s b/llvm/test/MC/AArch64/SVE2p1/whilehs-diagnostics.s
new file mode 100644 (file)
index 0000000..d799f94
--- /dev/null
@@ -0,0 +1,30 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 2>&1 < %s | FileCheck %s
+
+// --------------------------------------------------------------------------//
+// Invalid Pattern
+
+whilehs pn8.b, x0, x0, vlx1
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
+// CHECK-NEXT: whilehs pn8.b, x0, x0, vlx1
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+whilehs pn8.b, x0, x0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: too few operands for instruction
+// CHECK-NEXT: whilehs pn8.b, x0, x0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Invalid use of predicate without suffix
+
+whilehs pn8, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilehs pn8, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Out of range Predicate register
+
+whilehs pn7.b, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilehs pn7.b, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilehs.s b/llvm/test/MC/AArch64/SVE2p1/whilehs.s
new file mode 100644 (file)
index 0000000..68c5819
--- /dev/null
@@ -0,0 +1,110 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
+// RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d --mattr=+sme2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN:        | llvm-mc -triple=aarch64 -mattr=+sme2 -disassemble -show-encoding \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+whilehs pn8.h, x0, x0, vlx2  // 00100101-01100000-01001000-00010000
+// CHECK-INST: whilehs pn8.h, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x48,0x60,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25604810 <unknown>
+
+whilehs pn13.h, x10, x21, vlx2  // 00100101-01110101-01001001-01010101
+// CHECK-INST: whilehs pn13.h, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x49,0x75,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25754955 <unknown>
+
+whilehs pn15.h, x13, x8, vlx4  // 00100101-01101000-01101001-10110111
+// CHECK-INST: whilehs pn15.h, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x69,0x68,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 256869b7 <unknown>
+
+whilehs pn15.h, xzr, xzr, vlx4  // 00100101-01111111-01101011-11110111
+// CHECK-INST: whilehs pn15.h, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x6b,0x7f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 257f6bf7 <unknown>
+
+whilehs pn8.s, x0, x0, vlx2  // 00100101-10100000-01001000-00010000
+// CHECK-INST: whilehs pn8.s, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x48,0xa0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a04810 <unknown>
+
+whilehs pn13.s, x10, x21, vlx2  // 00100101-10110101-01001001-01010101
+// CHECK-INST: whilehs pn13.s, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x49,0xb5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25b54955 <unknown>
+
+whilehs pn15.s, x13, x8, vlx4  // 00100101-10101000-01101001-10110111
+// CHECK-INST: whilehs pn15.s, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x69,0xa8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a869b7 <unknown>
+
+whilehs pn15.s, xzr, xzr, vlx4  // 00100101-10111111-01101011-11110111
+// CHECK-INST: whilehs pn15.s, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x6b,0xbf,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25bf6bf7 <unknown>
+
+whilehs pn8.d, x0, x0, vlx2  // 00100101-11100000-01001000-00010000
+// CHECK-INST: whilehs pn8.d, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x48,0xe0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e04810 <unknown>
+
+whilehs pn13.d, x10, x21, vlx2  // 00100101-11110101-01001001-01010101
+// CHECK-INST: whilehs pn13.d, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x49,0xf5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25f54955 <unknown>
+
+whilehs pn15.d, x13, x8, vlx4  // 00100101-11101000-01101001-10110111
+// CHECK-INST: whilehs pn15.d, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x69,0xe8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e869b7 <unknown>
+
+whilehs pn15.d, xzr, xzr, vlx4  // 00100101-11111111-01101011-11110111
+// CHECK-INST: whilehs pn15.d, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x6b,0xff,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25ff6bf7 <unknown>
+
+whilehs pn8.b, x0, x0, vlx2  // 00100101-00100000-01001000-00010000
+// CHECK-INST: whilehs pn8.b, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x48,0x20,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25204810 <unknown>
+
+whilehs pn13.b, x10, x21, vlx2  // 00100101-00110101-01001001-01010101
+// CHECK-INST: whilehs pn13.b, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x49,0x35,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25354955 <unknown>
+
+whilehs pn15.b, x13, x8, vlx4  // 00100101-00101000-01101001-10110111
+// CHECK-INST: whilehs pn15.b, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x69,0x28,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 252869b7 <unknown>
+
+whilehs pn15.b, xzr, xzr, vlx4  // 00100101-00111111-01101011-11110111
+// CHECK-INST: whilehs pn15.b, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x6b,0x3f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 253f6bf7 <unknown>
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilele-diagnostics.s b/llvm/test/MC/AArch64/SVE2p1/whilele-diagnostics.s
new file mode 100644 (file)
index 0000000..666ce7d
--- /dev/null
@@ -0,0 +1,30 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 2>&1 < %s | FileCheck %s
+
+// --------------------------------------------------------------------------//
+// Invalid Pattern
+
+whilele pn8.b, x0, x0, vlx1
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
+// CHECK-NEXT: whilele pn8.b, x0, x0, vlx1
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+whilele pn8.b, x0, x0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: too few operands for instruction
+// CHECK-NEXT: whilele pn8.b, x0, x0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Invalid use of predicate without suffix
+
+whilele pn8, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilele pn8, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Out of range Predicate register
+
+whilele pn7.b, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilele pn7.b, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilele.s b/llvm/test/MC/AArch64/SVE2p1/whilele.s
new file mode 100644 (file)
index 0000000..0e00c50
--- /dev/null
@@ -0,0 +1,110 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
+// RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d --mattr=+sme2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN:        | llvm-mc -triple=aarch64 -mattr=+sme2 -disassemble -show-encoding \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+whilele pn8.h, x0, x0, vlx2  // 00100101-01100000-01000100-00011000
+// CHECK-INST: whilele pn8.h, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x44,0x60,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25604418 <unknown>
+
+whilele pn13.h, x10, x21, vlx2  // 00100101-01110101-01000101-01011101
+// CHECK-INST: whilele pn13.h, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x45,0x75,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 2575455d <unknown>
+
+whilele pn15.h, x13, x8, vlx4  // 00100101-01101000-01100101-10111111
+// CHECK-INST: whilele pn15.h, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x65,0x68,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 256865bf <unknown>
+
+whilele pn15.h, xzr, xzr, vlx4  // 00100101-01111111-01100111-11111111
+// CHECK-INST: whilele pn15.h, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x67,0x7f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 257f67ff <unknown>
+
+whilele pn8.s, x0, x0, vlx2  // 00100101-10100000-01000100-00011000
+// CHECK-INST: whilele pn8.s, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x44,0xa0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a04418 <unknown>
+
+whilele pn13.s, x10, x21, vlx2  // 00100101-10110101-01000101-01011101
+// CHECK-INST: whilele pn13.s, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x45,0xb5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25b5455d <unknown>
+
+whilele pn15.s, x13, x8, vlx4  // 00100101-10101000-01100101-10111111
+// CHECK-INST: whilele pn15.s, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x65,0xa8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a865bf <unknown>
+
+whilele pn15.s, xzr, xzr, vlx4  // 00100101-10111111-01100111-11111111
+// CHECK-INST: whilele pn15.s, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x67,0xbf,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25bf67ff <unknown>
+
+whilele pn8.d, x0, x0, vlx2  // 00100101-11100000-01000100-00011000
+// CHECK-INST: whilele pn8.d, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x44,0xe0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e04418 <unknown>
+
+whilele pn13.d, x10, x21, vlx2  // 00100101-11110101-01000101-01011101
+// CHECK-INST: whilele pn13.d, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x45,0xf5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25f5455d <unknown>
+
+whilele pn15.d, x13, x8, vlx4  // 00100101-11101000-01100101-10111111
+// CHECK-INST: whilele pn15.d, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x65,0xe8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e865bf <unknown>
+
+whilele pn15.d, xzr, xzr, vlx4  // 00100101-11111111-01100111-11111111
+// CHECK-INST: whilele pn15.d, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x67,0xff,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25ff67ff <unknown>
+
+whilele pn8.b, x0, x0, vlx2  // 00100101-00100000-01000100-00011000
+// CHECK-INST: whilele pn8.b, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x44,0x20,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25204418 <unknown>
+
+whilele pn13.b, x10, x21, vlx2  // 00100101-00110101-01000101-01011101
+// CHECK-INST: whilele pn13.b, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x45,0x35,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 2535455d <unknown>
+
+whilele pn15.b, x13, x8, vlx4  // 00100101-00101000-01100101-10111111
+// CHECK-INST: whilele pn15.b, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x65,0x28,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 252865bf <unknown>
+
+whilele pn15.b, xzr, xzr, vlx4  // 00100101-00111111-01100111-11111111
+// CHECK-INST: whilele pn15.b, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x67,0x3f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 253f67ff <unknown>
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilelo-diagnostics.s b/llvm/test/MC/AArch64/SVE2p1/whilelo-diagnostics.s
new file mode 100644 (file)
index 0000000..4258893
--- /dev/null
@@ -0,0 +1,30 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 2>&1 < %s | FileCheck %s
+
+// --------------------------------------------------------------------------//
+// Invalid Pattern
+
+whilelo pn8.b, x0, x0, vlx1
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
+// CHECK-NEXT: whilelo pn8.b, x0, x0, vlx1
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+whilelo pn8.b, x0, x0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: too few operands for instruction
+// CHECK-NEXT: whilelo pn8.b, x0, x0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Invalid use of predicate without suffix
+
+whilelo pn8, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilelo pn8, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Out of range Predicate register
+
+whilelo pn7.b, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilelo pn7.b, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilelo.s b/llvm/test/MC/AArch64/SVE2p1/whilelo.s
new file mode 100644 (file)
index 0000000..0947471
--- /dev/null
@@ -0,0 +1,110 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
+// RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d --mattr=+sme2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN:        | llvm-mc -triple=aarch64 -mattr=+sme2 -disassemble -show-encoding \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+whilelo pn8.h, x0, x0, vlx2  // 00100101-01100000-01001100-00010000
+// CHECK-INST: whilelo pn8.h, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x4c,0x60,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25604c10 <unknown>
+
+whilelo pn13.h, x10, x21, vlx2  // 00100101-01110101-01001101-01010101
+// CHECK-INST: whilelo pn13.h, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x4d,0x75,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25754d55 <unknown>
+
+whilelo pn15.h, x13, x8, vlx4  // 00100101-01101000-01101101-10110111
+// CHECK-INST: whilelo pn15.h, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x6d,0x68,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25686db7 <unknown>
+
+whilelo pn15.h, xzr, xzr, vlx4  // 00100101-01111111-01101111-11110111
+// CHECK-INST: whilelo pn15.h, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x6f,0x7f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 257f6ff7 <unknown>
+
+whilelo pn8.s, x0, x0, vlx2  // 00100101-10100000-01001100-00010000
+// CHECK-INST: whilelo pn8.s, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x4c,0xa0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a04c10 <unknown>
+
+whilelo pn13.s, x10, x21, vlx2  // 00100101-10110101-01001101-01010101
+// CHECK-INST: whilelo pn13.s, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x4d,0xb5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25b54d55 <unknown>
+
+whilelo pn15.s, x13, x8, vlx4  // 00100101-10101000-01101101-10110111
+// CHECK-INST: whilelo pn15.s, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x6d,0xa8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a86db7 <unknown>
+
+whilelo pn15.s, xzr, xzr, vlx4  // 00100101-10111111-01101111-11110111
+// CHECK-INST: whilelo pn15.s, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x6f,0xbf,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25bf6ff7 <unknown>
+
+whilelo pn8.d, x0, x0, vlx2  // 00100101-11100000-01001100-00010000
+// CHECK-INST: whilelo pn8.d, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x4c,0xe0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e04c10 <unknown>
+
+whilelo pn13.d, x10, x21, vlx2  // 00100101-11110101-01001101-01010101
+// CHECK-INST: whilelo pn13.d, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x4d,0xf5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25f54d55 <unknown>
+
+whilelo pn15.d, x13, x8, vlx4  // 00100101-11101000-01101101-10110111
+// CHECK-INST: whilelo pn15.d, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x6d,0xe8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e86db7 <unknown>
+
+whilelo pn15.d, xzr, xzr, vlx4  // 00100101-11111111-01101111-11110111
+// CHECK-INST: whilelo pn15.d, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x6f,0xff,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25ff6ff7 <unknown>
+
+whilelo pn8.b, x0, x0, vlx2  // 00100101-00100000-01001100-00010000
+// CHECK-INST: whilelo pn8.b, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x4c,0x20,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25204c10 <unknown>
+
+whilelo pn13.b, x10, x21, vlx2  // 00100101-00110101-01001101-01010101
+// CHECK-INST: whilelo pn13.b, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x4d,0x35,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25354d55 <unknown>
+
+whilelo pn15.b, x13, x8, vlx4  // 00100101-00101000-01101101-10110111
+// CHECK-INST: whilelo pn15.b, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x6d,0x28,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25286db7 <unknown>
+
+whilelo pn15.b, xzr, xzr, vlx4  // 00100101-00111111-01101111-11110111
+// CHECK-INST: whilelo pn15.b, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x6f,0x3f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 253f6ff7 <unknown>
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilels-diagnostics.s b/llvm/test/MC/AArch64/SVE2p1/whilels-diagnostics.s
new file mode 100644 (file)
index 0000000..765c355
--- /dev/null
@@ -0,0 +1,30 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 2>&1 < %s | FileCheck %s
+
+// --------------------------------------------------------------------------//
+// Invalid Pattern
+
+whilels pn8.b, x0, x0, vlx1
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
+// CHECK-NEXT: whilels pn8.b, x0, x0, vlx1
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+whilels pn8.b, x0, x0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: too few operands for instruction
+// CHECK-NEXT: whilels pn8.b, x0, x0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Invalid use of predicate without suffix
+
+whilels pn8, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilels pn8, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Out of range Predicate register
+
+whilels pn7.b, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilels pn7.b, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilels.s b/llvm/test/MC/AArch64/SVE2p1/whilels.s
new file mode 100644 (file)
index 0000000..608f484
--- /dev/null
@@ -0,0 +1,110 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
+// RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d --mattr=+sme2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN:        | llvm-mc -triple=aarch64 -mattr=+sme2 -disassemble -show-encoding \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+whilels pn8.h, x0, x0, vlx2  // 00100101-01100000-01001100-00011000
+// CHECK-INST: whilels pn8.h, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x4c,0x60,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25604c18 <unknown>
+
+whilels pn13.h, x10, x21, vlx2  // 00100101-01110101-01001101-01011101
+// CHECK-INST: whilels pn13.h, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x4d,0x75,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25754d5d <unknown>
+
+whilels pn15.h, x13, x8, vlx4  // 00100101-01101000-01101101-10111111
+// CHECK-INST: whilels pn15.h, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x6d,0x68,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25686dbf <unknown>
+
+whilels pn15.h, xzr, xzr, vlx4  // 00100101-01111111-01101111-11111111
+// CHECK-INST: whilels pn15.h, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x6f,0x7f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 257f6fff <unknown>
+
+whilels pn8.s, x0, x0, vlx2  // 00100101-10100000-01001100-00011000
+// CHECK-INST: whilels pn8.s, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x4c,0xa0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a04c18 <unknown>
+
+whilels pn13.s, x10, x21, vlx2  // 00100101-10110101-01001101-01011101
+// CHECK-INST: whilels pn13.s, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x4d,0xb5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25b54d5d <unknown>
+
+whilels pn15.s, x13, x8, vlx4  // 00100101-10101000-01101101-10111111
+// CHECK-INST: whilels pn15.s, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x6d,0xa8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a86dbf <unknown>
+
+whilels pn15.s, xzr, xzr, vlx4  // 00100101-10111111-01101111-11111111
+// CHECK-INST: whilels pn15.s, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x6f,0xbf,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25bf6fff <unknown>
+
+whilels pn8.d, x0, x0, vlx2  // 00100101-11100000-01001100-00011000
+// CHECK-INST: whilels pn8.d, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x4c,0xe0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e04c18 <unknown>
+
+whilels pn13.d, x10, x21, vlx2  // 00100101-11110101-01001101-01011101
+// CHECK-INST: whilels pn13.d, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x4d,0xf5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25f54d5d <unknown>
+
+whilels pn15.d, x13, x8, vlx4  // 00100101-11101000-01101101-10111111
+// CHECK-INST: whilels pn15.d, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x6d,0xe8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e86dbf <unknown>
+
+whilels pn15.d, xzr, xzr, vlx4  // 00100101-11111111-01101111-11111111
+// CHECK-INST: whilels pn15.d, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x6f,0xff,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25ff6fff <unknown>
+
+whilels pn8.b, x0, x0, vlx2  // 00100101-00100000-01001100-00011000
+// CHECK-INST: whilels pn8.b, x0, x0, vlx2
+// CHECK-ENCODING: [0x18,0x4c,0x20,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25204c18 <unknown>
+
+whilels pn13.b, x10, x21, vlx2  // 00100101-00110101-01001101-01011101
+// CHECK-INST: whilels pn13.b, x10, x21, vlx2
+// CHECK-ENCODING: [0x5d,0x4d,0x35,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25354d5d <unknown>
+
+whilels pn15.b, x13, x8, vlx4  // 00100101-00101000-01101101-10111111
+// CHECK-INST: whilels pn15.b, x13, x8, vlx4
+// CHECK-ENCODING: [0xbf,0x6d,0x28,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25286dbf <unknown>
+
+whilels pn15.b, xzr, xzr, vlx4  // 00100101-00111111-01101111-11111111
+// CHECK-INST: whilels pn15.b, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xff,0x6f,0x3f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 253f6fff <unknown>
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilelt-diagnostics.s b/llvm/test/MC/AArch64/SVE2p1/whilelt-diagnostics.s
new file mode 100644 (file)
index 0000000..54c2c05
--- /dev/null
@@ -0,0 +1,30 @@
+// RUN: not llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 2>&1 < %s | FileCheck %s
+
+// --------------------------------------------------------------------------//
+// Invalid Pattern
+
+whilelt pn8.b, x0, x0, vlx1
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand
+// CHECK-NEXT: whilelt pn8.b, x0, x0, vlx1
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+whilelt pn8.b, x0, x0
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: too few operands for instruction
+// CHECK-NEXT: whilelt pn8.b, x0, x0
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Invalid use of predicate without suffix
+
+whilelt pn8, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilelt pn8, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
+
+// --------------------------------------------------------------------------//
+// Out of range Predicate register
+
+whilelt pn7.b, x0, x0, vlx2
+// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid predicate register, expected PN in range pn8..pn15 with element suffix.
+// CHECK-NEXT: whilelt pn7.b, x0, x0, vlx2
+// CHECK-NOT: [[@LINE-1]]:{{[0-9]+}}:
diff --git a/llvm/test/MC/AArch64/SVE2p1/whilelt.s b/llvm/test/MC/AArch64/SVE2p1/whilelt.s
new file mode 100644 (file)
index 0000000..fe67c92
--- /dev/null
@@ -0,0 +1,110 @@
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sve2p1 < %s \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
+// RUN:        | FileCheck %s --check-prefix=CHECK-ERROR
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d --mattr=+sme2 - | FileCheck %s --check-prefix=CHECK-INST
+// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+sme2 < %s \
+// RUN:        | llvm-objdump -d - | FileCheck %s --check-prefix=CHECK-UNKNOWN
+// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+sme2 < %s \
+// RUN:        | sed '/.text/d' | sed 's/.*encoding: //g' \
+// RUN:        | llvm-mc -triple=aarch64 -mattr=+sme2 -disassemble -show-encoding \
+// RUN:        | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
+
+whilelt pn8.h, x0, x0, vlx2  // 00100101-01100000-01000100-00010000
+// CHECK-INST: whilelt pn8.h, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x44,0x60,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25604410 <unknown>
+
+whilelt pn13.h, x10, x21, vlx2  // 00100101-01110101-01000101-01010101
+// CHECK-INST: whilelt pn13.h, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x45,0x75,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25754555 <unknown>
+
+whilelt pn15.h, x13, x8, vlx4  // 00100101-01101000-01100101-10110111
+// CHECK-INST: whilelt pn15.h, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x65,0x68,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 256865b7 <unknown>
+
+whilelt pn15.h, xzr, xzr, vlx4  // 00100101-01111111-01100111-11110111
+// CHECK-INST: whilelt pn15.h, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x67,0x7f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 257f67f7 <unknown>
+
+whilelt pn8.s, x0, x0, vlx2  // 00100101-10100000-01000100-00010000
+// CHECK-INST: whilelt pn8.s, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x44,0xa0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a04410 <unknown>
+
+whilelt pn13.s, x10, x21, vlx2  // 00100101-10110101-01000101-01010101
+// CHECK-INST: whilelt pn13.s, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x45,0xb5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25b54555 <unknown>
+
+whilelt pn15.s, x13, x8, vlx4  // 00100101-10101000-01100101-10110111
+// CHECK-INST: whilelt pn15.s, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x65,0xa8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25a865b7 <unknown>
+
+whilelt pn15.s, xzr, xzr, vlx4  // 00100101-10111111-01100111-11110111
+// CHECK-INST: whilelt pn15.s, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x67,0xbf,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25bf67f7 <unknown>
+
+whilelt pn8.d, x0, x0, vlx2  // 00100101-11100000-01000100-00010000
+// CHECK-INST: whilelt pn8.d, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x44,0xe0,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e04410 <unknown>
+
+whilelt pn13.d, x10, x21, vlx2  // 00100101-11110101-01000101-01010101
+// CHECK-INST: whilelt pn13.d, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x45,0xf5,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25f54555 <unknown>
+
+whilelt pn15.d, x13, x8, vlx4  // 00100101-11101000-01100101-10110111
+// CHECK-INST: whilelt pn15.d, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x65,0xe8,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25e865b7 <unknown>
+
+whilelt pn15.d, xzr, xzr, vlx4  // 00100101-11111111-01100111-11110111
+// CHECK-INST: whilelt pn15.d, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x67,0xff,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25ff67f7 <unknown>
+
+whilelt pn8.b, x0, x0, vlx2  // 00100101-00100000-01000100-00010000
+// CHECK-INST: whilelt pn8.b, x0, x0, vlx2
+// CHECK-ENCODING: [0x10,0x44,0x20,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25204410 <unknown>
+
+whilelt pn13.b, x10, x21, vlx2  // 00100101-00110101-01000101-01010101
+// CHECK-INST: whilelt pn13.b, x10, x21, vlx2
+// CHECK-ENCODING: [0x55,0x45,0x35,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 25354555 <unknown>
+
+whilelt pn15.b, x13, x8, vlx4  // 00100101-00101000-01100101-10110111
+// CHECK-INST: whilelt pn15.b, x13, x8, vlx4
+// CHECK-ENCODING: [0xb7,0x65,0x28,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 252865b7 <unknown>
+
+whilelt pn15.b, xzr, xzr, vlx4  // 00100101-00111111-01100111-11110111
+// CHECK-INST: whilelt pn15.b, xzr, xzr, vlx4
+// CHECK-ENCODING: [0xf7,0x67,0x3f,0x25]
+// CHECK-ERROR: instruction requires: sme2 or sve2p1
+// CHECK-UNKNOWN: 253f67f7 <unknown>