From f50b1a3c1f9514efdff6d808b2700eb18ab55630 Mon Sep 17 00:00:00 2001 From: Srinath Parvathaneni Date: Tue, 25 Jun 2024 11:30:24 +0100 Subject: aarch64: Fix sve2p1 extq instruction operands. This patch fixes the syntax of sve2p1 "extq" instruction by modifying the operands count to 4. A new operand AARCH64_OPND_SVE_UIMM4 is defined to handle the 4th argument an 4-bit unsigned immediate of extq instruction. The instruction encoding is updated to use constraint C_SCAN_MOVPRFX, to enable "extq" instruction to immediately precede in program order by a MOVPRFX instruction. Also removed the unused operand AARCH64_OPND_SVE_Zm_imm4. This issues was reported here: https://sourceware.org/pipermail/binutils/2024-February/132408.html --- opcodes/aarch64-asm-2.c | 16 ++++++++-------- opcodes/aarch64-dis-2.c | 16 ++++++++-------- opcodes/aarch64-opc-2.c | 2 +- opcodes/aarch64-opc.c | 11 ++++------- opcodes/aarch64-tbl.h | 7 +++---- 5 files changed, 24 insertions(+), 28 deletions(-) (limited to 'opcodes') diff --git a/opcodes/aarch64-asm-2.c b/opcodes/aarch64-asm-2.c index 1838e04..5eb21c2 100644 --- a/opcodes/aarch64-asm-2.c +++ b/opcodes/aarch64-asm-2.c @@ -668,15 +668,15 @@ aarch64_insert_operand (const aarch64_operand *self, case 194: case 195: case 196: - case 211: case 212: case 213: case 214: - case 223: + case 215: case 224: case 225: case 226: case 227: + case 228: case 239: case 243: case 248: @@ -712,9 +712,9 @@ aarch64_insert_operand (const aarch64_operand *self, case 40: case 41: case 42: - case 228: case 229: - case 232: + case 230: + case 233: case 269: case 270: case 285: @@ -782,6 +782,7 @@ aarch64_insert_operand (const aarch64_operand *self, case 208: case 209: case 210: + case 211: case 271: case 302: case 303: @@ -939,19 +940,18 @@ aarch64_insert_operand (const aarch64_operand *self, case 202: case 284: return aarch64_ins_sve_shrimm (self, info, code, inst, errors); - case 215: case 216: case 217: case 218: - return aarch64_ins_sme_za_vrs1 (self, info, code, inst, errors); case 219: + return aarch64_ins_sme_za_vrs1 (self, info, code, inst, errors); case 220: case 221: case 222: + case 223: return aarch64_ins_sme_za_vrs2 (self, info, code, inst, errors); - case 230: case 231: - case 233: + case 232: case 234: case 235: case 236: diff --git a/opcodes/aarch64-dis-2.c b/opcodes/aarch64-dis-2.c index 4d1271d..0952728 100644 --- a/opcodes/aarch64-dis-2.c +++ b/opcodes/aarch64-dis-2.c @@ -34457,15 +34457,15 @@ aarch64_extract_operand (const aarch64_operand *self, case 194: case 195: case 196: - case 211: case 212: case 213: case 214: - case 223: + case 215: case 224: case 225: case 226: case 227: + case 228: case 239: case 243: case 248: @@ -34506,9 +34506,9 @@ aarch64_extract_operand (const aarch64_operand *self, case 40: case 41: case 42: - case 228: case 229: - case 232: + case 230: + case 233: case 269: case 270: case 285: @@ -34577,6 +34577,7 @@ aarch64_extract_operand (const aarch64_operand *self, case 208: case 209: case 210: + case 211: case 271: case 302: case 303: @@ -34736,19 +34737,18 @@ aarch64_extract_operand (const aarch64_operand *self, case 202: case 284: return aarch64_ext_sve_shrimm (self, info, code, inst, errors); - case 215: case 216: case 217: case 218: - return aarch64_ext_sme_za_vrs1 (self, info, code, inst, errors); case 219: + return aarch64_ext_sme_za_vrs1 (self, info, code, inst, errors); case 220: case 221: case 222: + case 223: return aarch64_ext_sme_za_vrs2 (self, info, code, inst, errors); - case 230: case 231: - case 233: + case 232: case 234: case 235: case 236: diff --git a/opcodes/aarch64-opc-2.c b/opcodes/aarch64-opc-2.c index c9580b3..3d067d4 100644 --- a/opcodes/aarch64-opc-2.c +++ b/opcodes/aarch64-opc-2.c @@ -235,6 +235,7 @@ const struct aarch64_operand aarch64_operands[] = {AARCH64_OPND_CLASS_IMMEDIATE, "SVE_UIMM7", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_imm7}, "a 7-bit unsigned immediate"}, {AARCH64_OPND_CLASS_IMMEDIATE, "SVE_UIMM8", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_imm8}, "an 8-bit unsigned immediate"}, {AARCH64_OPND_CLASS_IMMEDIATE, "SVE_UIMM8_53", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_imm5,FLD_imm3_10}, "an 8-bit unsigned immediate"}, + {AARCH64_OPND_CLASS_IMMEDIATE, "SVE_UIMM4", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_imm4}, "a 4-bit unsigned immediate"}, {AARCH64_OPND_CLASS_SIMD_REG, "SVE_VZn", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_Zn}, "a SIMD register"}, {AARCH64_OPND_CLASS_SIMD_REG, "SVE_Vd", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_Vd}, "a SIMD register"}, {AARCH64_OPND_CLASS_SIMD_REG, "SVE_Vm", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_Vm}, "a SIMD register"}, @@ -261,7 +262,6 @@ const struct aarch64_operand aarch64_operands[] = {AARCH64_OPND_CLASS_SVE_REG, "SVE_Zm3_22_INDEX", 3 << OPD_F_OD_LSB | OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_i3h, FLD_SVE_Zm_16}, "an indexed SVE vector register"}, {AARCH64_OPND_CLASS_SVE_REG, "SVE_Zm3_10_INDEX", 3 << OPD_F_OD_LSB | OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_i3h2, FLD_SVE_i4l2, FLD_SVE_imm3}, "an indexed SVE vector register"}, {AARCH64_OPND_CLASS_SVE_REG, "SVE_Zm4_11_INDEX", 4 << OPD_F_OD_LSB | OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_i2h, FLD_SVE_i3l, FLD_SVE_imm4}, "an indexed SVE vector register"}, - {AARCH64_OPND_CLASS_SVE_REG, "SVE_Zm_imm4", 5 << OPD_F_OD_LSB | OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_Zm_5, FLD_SVE_imm4}, "an 4bit indexed SVE vector register"}, {AARCH64_OPND_CLASS_SVE_REG, "SVE_Zm4_INDEX", 4 << OPD_F_OD_LSB | OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_Zm_16}, "an indexed SVE vector register"}, {AARCH64_OPND_CLASS_SVE_REG, "SVE_Zn", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_Zn}, "an SVE vector register"}, {AARCH64_OPND_CLASS_SVE_REG, "SVE_Zn_INDEX", OPD_F_HAS_INSERTER | OPD_F_HAS_EXTRACTOR, {FLD_SVE_Zn, FLD_SVE_tszh, FLD_imm5}, "an indexed SVE vector register"}, diff --git a/opcodes/aarch64-opc.c b/opcodes/aarch64-opc.c index 918d988..6393474 100644 --- a/opcodes/aarch64-opc.c +++ b/opcodes/aarch64-opc.c @@ -1852,11 +1852,6 @@ operand_general_constraint_met_p (const aarch64_opnd_info *opnds, int idx, return 0; break; - case AARCH64_OPND_SVE_Zm_imm4: - if (!check_reglane (opnd, mismatch_detail, idx, "z", 0, 31, 0, 15)) - return 0; - break; - case AARCH64_OPND_SVE_Zn_5_INDEX: size = aarch64_get_qualifier_esize (opnd->qualifier); if (!check_reglane (opnd, mismatch_detail, idx, "z", 0, 31, @@ -2742,6 +2737,7 @@ operand_general_constraint_met_p (const aarch64_opnd_info *opnds, int idx, case AARCH64_OPND_SVE_UIMM3: case AARCH64_OPND_SVE_UIMM7: case AARCH64_OPND_SVE_UIMM8: + case AARCH64_OPND_SVE_UIMM4: case AARCH64_OPND_SVE_UIMM8_53: case AARCH64_OPND_CSSC_UIMM8: size = get_operand_fields_width (get_operand_from_code (type)); @@ -4296,7 +4292,6 @@ aarch64_print_operand (char *buf, size_t size, bfd_vma pc, case AARCH64_OPND_SME_Zn_INDEX3_14: case AARCH64_OPND_SME_Zn_INDEX3_15: case AARCH64_OPND_SME_Zn_INDEX4_14: - case AARCH64_OPND_SVE_Zm_imm4: snprintf (buf, size, "%s[%s]", (opnd->qualifier == AARCH64_OPND_QLF_NIL ? style_reg (styler, "z%d", opnd->reglane.regno) @@ -4463,6 +4458,7 @@ aarch64_print_operand (char *buf, size_t size, bfd_vma pc, case AARCH64_OPND_SVE_UIMM3: case AARCH64_OPND_SVE_UIMM7: case AARCH64_OPND_SVE_UIMM8: + case AARCH64_OPND_SVE_UIMM4: case AARCH64_OPND_SVE_UIMM8_53: case AARCH64_OPND_IMM_ROT1: case AARCH64_OPND_IMM_ROT2: @@ -5590,7 +5586,8 @@ verify_constraints (const struct aarch64_inst *inst, instruction for better error messages. */ if (!opcode->avariant || (!AARCH64_CPU_HAS_FEATURE (*opcode->avariant, SVE) - && !AARCH64_CPU_HAS_FEATURE (*opcode->avariant, SVE2))) + && !AARCH64_CPU_HAS_FEATURE (*opcode->avariant, SVE2) + && !AARCH64_CPU_HAS_FEATURE (*opcode->avariant, SVE2p1))) { mismatch_detail->kind = AARCH64_OPDE_SYNTAX_ERROR; mismatch_detail->error = _("SVE instruction expected after " diff --git a/opcodes/aarch64-tbl.h b/opcodes/aarch64-tbl.h index 7270dd1..8892166 100644 --- a/opcodes/aarch64-tbl.h +++ b/opcodes/aarch64-tbl.h @@ -6641,7 +6641,7 @@ const struct aarch64_opcode aarch64_opcode_table[] = SVE2p1_INSNC("fminqv",0x6417a000, 0xff3fe000, sve2_urqvs, 0, OP3 (Vd, SVE_Pg3, SVE_Zn), OP_SVE_vUS_HSD_HSD, F_OPD_SIZE, C_SCAN_MOVPRFX, 0), SVE2p1_INSN("dupq",0x05202400, 0xffe0fc00, sve_index, 0, OP2 (SVE_Zd, SVE_Zn_5_INDEX), OP_SVE_VV_BHSD, 0, 0), - SVE2p1_INSN("extq",0x05602400, 0xfff0fc00, sve_misc, 0, OP3 (SVE_Zd, SVE_Zd, SVE_Zm_imm4), OP_SVE_BBB, 0, 1), + SVE2p1_INSNC("extq",0x05602400, 0xfff0fc00, sve_misc, 0, OP4 (SVE_Zd, SVE_Zd, SVE_Zm_5, SVE_UIMM4), OP_SVE_BBBU, 0, C_SCAN_MOVPRFX, 1), SVE2p1_INSNC("ld1q",0xc400a000, 0xffe0e000, sve_misc, 0, OP3 (SVE_Zt, SVE_Pg3, SVE_ADDR_ZX), OP_SVE_SZS_QD, 0, C_SCAN_MOVPRFX, 0), SVE2p1_INSNC("ld2q",0xa490e000, 0xfff0e000, sve_misc, 0, OP3 (SME_Zt2, SVE_Pg3, SVE_ADDR_RI_S4x2xVL), OP_SVE_QZU, 0, C_SCAN_MOVPRFX, 0), SVE2p1_INSNC("ld3q",0xa510e000, 0xfff0e000, sve_misc, 0, OP3 (SME_Zt3, SVE_Pg3, SVE_ADDR_RI_S4x3xVL), OP_SVE_QZU, 0, C_SCAN_MOVPRFX, 0), @@ -7256,6 +7256,8 @@ const struct aarch64_opcode aarch64_opcode_table[] = "an 8-bit unsigned immediate") \ Y(IMMEDIATE, imm, "SVE_UIMM8_53", 0, F(FLD_imm5,FLD_imm3_10), \ "an 8-bit unsigned immediate") \ + Y(IMMEDIATE, imm, "SVE_UIMM4", 0, F(FLD_SVE_imm4), \ + "a 4-bit unsigned immediate") \ Y(SIMD_REG, regno, "SVE_VZn", 0, F(FLD_SVE_Zn), "a SIMD register") \ Y(SIMD_REG, regno, "SVE_Vd", 0, F(FLD_SVE_Vd), "a SIMD register") \ Y(SIMD_REG, regno, "SVE_Vm", 0, F(FLD_SVE_Vm), "a SIMD register") \ @@ -7313,9 +7315,6 @@ const struct aarch64_opcode aarch64_opcode_table[] = Y(SVE_REG, sve_quad_index, "SVE_Zm4_11_INDEX", \ 4 << OPD_F_OD_LSB, F(FLD_SVE_i2h, FLD_SVE_i3l, FLD_SVE_imm4), \ "an indexed SVE vector register") \ - Y(SVE_REG, sve_quad_index, "SVE_Zm_imm4", \ - 5 << OPD_F_OD_LSB, F(FLD_SVE_Zm_5, FLD_SVE_imm4), \ - "an 4bit indexed SVE vector register") \ Y(SVE_REG, sve_quad_index, "SVE_Zm4_INDEX", \ 4 << OPD_F_OD_LSB, F(FLD_SVE_Zm_16), \ "an indexed SVE vector register") \ -- cgit v1.1