aboutsummaryrefslogtreecommitdiff
path: root/opcodes/aarch64-opc.c
diff options
context:
space:
mode:
authorPrzemyslaw Wirkus <przemyslaw.wirkus@arm.com>2021-11-17 19:56:09 +0000
committerPrzemyslaw Wirkus <przemyslaw.wirkus@arm.com>2021-11-17 19:56:42 +0000
commit1cad938de57a1577e5fe4b4afcabe889a8b9b9d7 (patch)
tree0a83cfe3b99989bb705595bb9bf0855553e25e15 /opcodes/aarch64-opc.c
parent7bb5f07c8aa5168009f1e7b6857a30f0ee5ad16a (diff)
downloadgdb-1cad938de57a1577e5fe4b4afcabe889a8b9b9d7.zip
gdb-1cad938de57a1577e5fe4b4afcabe889a8b9b9d7.tar.gz
gdb-1cad938de57a1577e5fe4b4afcabe889a8b9b9d7.tar.bz2
aarch64: [SME] Add ZERO instruction
This patch is adding ZERO (a list of 64-bit element ZA tiles) instruction. gas/ChangeLog: * config/tc-aarch64.c (parse_sme_list_of_64bit_tiles): New parser. (parse_operands): Handle OPND_SME_list_of_64bit_tiles. * testsuite/gas/aarch64/sme-4-illegal.d: New test. * testsuite/gas/aarch64/sme-4-illegal.l: New test. * testsuite/gas/aarch64/sme-4-illegal.s: New test. * testsuite/gas/aarch64/sme-4.d: New test. * testsuite/gas/aarch64/sme-4.s: New test. include/ChangeLog: * opcode/aarch64.h (enum aarch64_opnd): New operand AARCH64_OPND_SME_list_of_64bit_tiles. opcodes/ChangeLog: * aarch64-opc.c (print_sme_za_list): New printing function. (aarch64_print_operand): Handle OPND_SME_list_of_64bit_tiles. * aarch64-opc.h (enum aarch64_field_kind): New bitfield FLD_SME_zero_mask. * aarch64-tbl.h (struct aarch64_opcode): New ZERO instruction. aarch64-asm-2.c: Regenerate. aarch64-dis-2.c: Regenerate. aarch64-opc-2.c: Regenerate.
Diffstat (limited to 'opcodes/aarch64-opc.c')
-rw-r--r--opcodes/aarch64-opc.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c
index b12bf3e..9f32eb5 100644
--- a/opcodes/aarch64-opc.c
+++ b/opcodes/aarch64-opc.c
@@ -329,6 +329,7 @@ const aarch64_field fields[] =
{ 15, 1 }, /* SME_V: (horizontal / vertical tiles), bit 15. */
{ 13, 2 }, /* SME_Rv: vector select register W12-W15, bits [14:13]. */
{ 13, 3 }, /* SME Pm second source scalable predicate register P0-P7. */
+ { 0, 8 }, /* SME_zero_mask: list of up to 8 tile names separated by commas [7:0]. */
{ 11, 2 }, /* rotate1: FCMLA immediate rotate. */
{ 13, 2 }, /* rotate2: Indexed element FCMLA immediate rotate. */
{ 12, 1 }, /* rotate3: FCADD immediate rotate. */
@@ -3139,6 +3140,46 @@ print_register_offset_address (char *buf, size_t size,
snprintf (buf, size, "[%s, %s%s]", base, offset, tb);
}
+/* Print ZA tiles from imm8 in ZERO instruction.
+
+ The preferred disassembly of this instruction uses the shortest list of tile
+ names that represent the encoded immediate mask.
+
+ For example:
+ * An all-ones immediate is disassembled as {ZA}.
+ * An all-zeros immediate is disassembled as an empty list { }.
+*/
+static void
+print_sme_za_list(char *buf, size_t size, int mask)
+{
+ const char* zan[] = { "za", "za0.h", "za1.h", "za0.s",
+ "za1.s", "za2.s", "za3.s", "za0.d",
+ "za1.d", "za2.d", "za3.d", "za4.d",
+ "za5.d", "za6.d", "za7.d", " " };
+ const int zan_v[] = { 0xff, 0x55, 0xaa, 0x11,
+ 0x22, 0x44, 0x88, 0x01,
+ 0x02, 0x04, 0x08, 0x10,
+ 0x20, 0x40, 0x80, 0x00 };
+ int i, k;
+ const int ZAN_SIZE = sizeof(zan) / sizeof(zan[0]);
+
+ k = snprintf (buf, size, "{");
+ for (i = 0; i < ZAN_SIZE; i++)
+ {
+ if ((mask & zan_v[i]) == zan_v[i])
+ {
+ mask &= ~zan_v[i];
+ if (k > 1)
+ k += snprintf (buf + k, size - k, ", %s", zan[i]);
+ else
+ k += snprintf (buf + k, size - k, "%s", zan[i]);
+ }
+ if (mask == 0)
+ break;
+ }
+ snprintf (buf + k, size - k, "}");
+}
+
/* Generate the string representation of the operand OPNDS[IDX] for OPCODE
in *BUF. The caller should pass in the maximum size of *BUF in SIZE.
PC, PCREL_P and ADDRESS are used to pass in and return information about
@@ -3370,6 +3411,10 @@ aarch64_print_operand (char *buf, size_t size, bfd_vma pc,
opnd->za_tile_vector.index.imm);
break;
+ case AARCH64_OPND_SME_list_of_64bit_tiles:
+ print_sme_za_list (buf, size, opnd->reg.regno);
+ break;
+
case AARCH64_OPND_CRn:
case AARCH64_OPND_CRm:
snprintf (buf, size, "C%" PRIi64, opnd->imm.value);