From 5a736821eff3aa4a8da237778526f9f700759c7a Mon Sep 17 00:00:00 2001 From: Graham Markall Date: Tue, 18 Oct 2016 20:10:25 +0100 Subject: arc: Implement NPS-400 dcmac instruction gas/ChangeLog: * testsuite/gas/arc/nps-400-9.d: Added. * testsuite/gas/arc/nps-400-9.s: Added. include/ChangeLog: * opcode/arc.h: Add PROTOCOL_DECODE to insn_class_t. opcodes/ChangeLog: * arc-dis.c (arc_insn_length): Return length 8 for instructions with major opcode 0xa. * arc-nps-400-tbl.h: Add dcmac instruction. * arc-opc.c (arc_operands): Added operands for dcmac instruction. (insert_nps_rbdouble_64): Added. (extract_nps_rbdouble_64): Added. (insert_nps_proto_size): Added. (extract_nps_proto_size): Added. --- opcodes/ChangeLog | 11 +++++++++++ opcodes/arc-dis.c | 4 ++++ opcodes/arc-nps400-tbl.h | 38 ++++++++++++++++++++++++++++++++++++++ opcodes/arc-opc.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 99 insertions(+), 1 deletion(-) (limited to 'opcodes') diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 0c91d8f..03b851a 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,14 @@ +2016-11-03 Graham Markall + + * arc-dis.c (arc_insn_length): Return length 8 for instructions with + major opcode 0xa. + * arc-nps-400-tbl.h: Add dcmac instruction. + * arc-opc.c (arc_operands): Added operands for dcmac instruction. + (insert_nps_rbdouble_64): Added. + (extract_nps_rbdouble_64): Added. + (insert_nps_proto_size): Added. + (extract_nps_proto_size): Added. + 2016-11-03 Andrew Burgess * arc-dis.c (struct arc_operand_iterator): Remove all fields diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c index 1c951ea..31b5a91 100644 --- a/opcodes/arc-dis.c +++ b/opcodes/arc-dis.c @@ -595,6 +595,10 @@ arc_insn_length (bfd_byte msb, bfd_byte lsb, struct disassemble_info *info) else if (minor_opcode == 0x10 || minor_opcode == 0x11) return 8; } + if (major_opcode == 0xa) + { + return 8; + } /* Fall through. */ case bfd_mach_arc_arc600: return (major_opcode > 0xb) ? 2 : 4; diff --git a/opcodes/arc-nps400-tbl.h b/opcodes/arc-nps400-tbl.h index e9a5d95..8585450 100644 --- a/opcodes/arc-nps400-tbl.h +++ b/opcodes/arc-nps400-tbl.h @@ -675,3 +675,41 @@ XLDST_LIKE("xst", 0xe) /* qseq dst, [src1] */ { "qseq", 0x386f0028, 0xf8ff803f, ARC_OPCODE_ARC700, PMU, NPS400, { RB, BRAKET, RC, BRAKETdup }, { 0 }}, + +/* Protocol Decode Instructions. */ + +/* dcmac 0,[cm:b],[cm:b],c */ +{ "dcmac", 0x57c007c024000000, 0xffe007ffffffffff, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { ZA, BRAKET, NPS_CM, COLON, NPS_RB_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_RBdup_64, BRAKETdup, NPS_RC_64 }, { 0 }}, + +/* dcmac 0,[cm:b],[cm:A],c */ +{ "dcmac", 0x57c007c026000000, 0xffe007ffffff0000, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { ZA, BRAKET, NPS_CM, COLON, NPS_RB_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_UIMM16_0_64, BRAKETdup, NPS_RC_64 }, { 0 }}, + +/* dcmac 0,[cm:A],[cm:b],c */ +{ "dcmac", 0x57c007c027000000, 0xffe007ffffff0000, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { ZA, BRAKET, NPS_CM, COLON, NPS_UIMM16_0_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_RB_64, BRAKETdup, NPS_RC_64 }, { 0 }}, + +/* dcmac a,[cm:b],[cm:b],c */ +{ "dcmac", 0x500007c024000000, 0xf80007ffffffffff, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { NPS_RA_64, BRAKET, NPS_CM, COLON, NPS_RB_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_RBdup_64, BRAKETdup, NPS_RC_64 }, { 0 }}, + +/* dcmac a,[cm:b],[cm:A],c */ +{ "dcmac", 0x500007c026000000, 0xf80007ffffff0000, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { NPS_RA_64, BRAKET, NPS_CM, COLON, NPS_RB_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_UIMM16_0_64, BRAKETdup, NPS_RC_64 }, { 0 }}, + +/* dcmac a,[cm:A],[cm:b],c */ +{ "dcmac", 0x500007c027000000, 0xf80007ffffff0000, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { NPS_RA_64, BRAKET, NPS_CM, COLON, NPS_UIMM16_0_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_RB_64, BRAKETdup, NPS_RC_64 }, { 0 }}, + +/* dcmac 0,[cm:b],[cm:b],size */ +{ "dcmac", 0x57c007c020000000, 0xffe007ffffc0ffff, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { ZA, BRAKET, NPS_CM, COLON, NPS_RBdouble_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_RBdup_64, BRAKETdup, NPS_PROTO_SIZE }, { 0 }}, + +/* dcmac 0,[cm:b],[cm:A],size */ +{ "dcmac", 0x57c007c022000000, 0xffe007ffffc00000, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { ZA, BRAKET, NPS_CM, COLON, NPS_RBdouble_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_UIMM16_0_64, BRAKETdup, NPS_PROTO_SIZE }, { 0 }}, + +/* dcmac 0,[cm:A],[cm:b],size */ +{ "dcmac", 0x57c007c023000000, 0xffe007ffffc00000, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { ZA, BRAKET, NPS_CM, COLON, NPS_UIMM16_0_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_RBdouble_64, BRAKETdup, NPS_PROTO_SIZE }, { 0 }}, + +/* dcmac a,[cm:b],[cm:b],size */ +{ "dcmac", 0x500007c020000000, 0xf80007ffffc0ffff, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { NPS_RA_64, BRAKET, NPS_CM, COLON, NPS_RBdouble_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_RBdup_64, BRAKETdup, NPS_PROTO_SIZE }, { 0 }}, + +/* dcmac a,[cm:b],[cm:A],size */ +{ "dcmac", 0x500007c022000000, 0xf80007ffffc00000, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { NPS_RA_64, BRAKET, NPS_CM, COLON, NPS_RBdouble_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_UIMM16_0_64, BRAKETdup, NPS_PROTO_SIZE }, { 0 }}, + +/* dcmac a,[cm:A],[cm:b],size */ +{ "dcmac", 0x500007c023000000, 0xf80007ffffc00000, ARC_OPCODE_ARC700, PROTOCOL_DECODE, NPS400, { NPS_RA_64, BRAKET, NPS_CM, COLON, NPS_UIMM16_0_64, BRAKETdup, BRAKET, NPS_CM, COLON, NPS_RBdouble_64, BRAKETdup, NPS_PROTO_SIZE }, { 0 }}, diff --git a/opcodes/arc-opc.c b/opcodes/arc-opc.c index ee14fed..58b26ea 100644 --- a/opcodes/arc-opc.c +++ b/opcodes/arc-opc.c @@ -1026,6 +1026,7 @@ MAKE_1BASED_INSERT_EXTRACT_FUNCS (bits_to_scramble, 12, 8, 3) MAKE_1BASED_INSERT_EXTRACT_FUNCS (bdlen_max_len, 5, 256, 8) MAKE_1BASED_INSERT_EXTRACT_FUNCS (bd_num_buff, 6, 8, 3) MAKE_1BASED_INSERT_EXTRACT_FUNCS (pmu_num_job, 6, 4, 2) +MAKE_1BASED_INSERT_EXTRACT_FUNCS (proto_size, 16, 64, 6) static unsigned long long insert_nps_min_hofs (unsigned long long insn ATTRIBUTE_UNUSED, @@ -1083,6 +1084,30 @@ MAKE_INSERT_NPS_ADDRTYPE (csd, CSD) MAKE_INSERT_NPS_ADDRTYPE (cxa, CXA) MAKE_INSERT_NPS_ADDRTYPE (cxd, CXD) +static unsigned long long +insert_nps_rbdouble_64 (unsigned long long insn ATTRIBUTE_UNUSED, + long long int value ATTRIBUTE_UNUSED, + const char **errmsg ATTRIBUTE_UNUSED) +{ + if (value < 0 || value > 31) + *errmsg = _("Value must be in the range 0 to 31"); + return insn | (value << 43) | (value << 48); +} + + +static long long int +extract_nps_rbdouble_64 (unsigned long long insn ATTRIBUTE_UNUSED, + bfd_boolean * invalid ATTRIBUTE_UNUSED) +{ + int value1 = (insn >> 43) & 0x1F; + int value2 = (insn >> 48) & 0x1F; + + if (value1 != value2) + *invalid = TRUE; + + return value1; +} + /* Include the generic extract/insert functions. Order is important as some of the functions present in the .h may be disabled via defines. */ @@ -2088,8 +2113,28 @@ const struct arc_operand arc_operands[] = #define NPS_R_SRC2_3B_64 (NPS_R_SRC1_3B_64 + 1) { 3, 53, 0, ARC_OPERAND_IR | ARC_OPERAND_NCHK, insert_nps_3bit_reg_at_53_src2, extract_nps_3bit_reg_at_53_src2 }, -}; +#define NPS_RA_64 (NPS_R_SRC2_3B_64 + 1) + { 6, 53, 0, ARC_OPERAND_IR, NULL, NULL }, + +#define NPS_RB_64 (NPS_RA_64 + 1) + { 5, 48, 0, ARC_OPERAND_IR, NULL, NULL }, + +#define NPS_RBdup_64 (NPS_RB_64 + 1) + { 5, 43, 0, ARC_OPERAND_IR | ARC_OPERAND_DUPLICATE, NULL, NULL }, + +#define NPS_RBdouble_64 (NPS_RBdup_64 + 1) + { 10, 43, 0, ARC_OPERAND_IR | ARC_OPERAND_NCHK, insert_nps_rbdouble_64, extract_nps_rbdouble_64 }, + +#define NPS_RC_64 (NPS_RBdouble_64 + 1) + { 5, 43, 0, ARC_OPERAND_IR, NULL, NULL }, + +#define NPS_UIMM16_0_64 (NPS_RC_64 + 1) + { 16, 0, 0, ARC_OPERAND_UNSIGNED, NULL, NULL }, + +#define NPS_PROTO_SIZE (NPS_UIMM16_0_64 + 1) + { 6, 16, 0, ARC_OPERAND_UNSIGNED | ARC_OPERAND_NCHK, insert_nps_proto_size, extract_nps_proto_size } +}; const unsigned arc_num_operands = ARRAY_SIZE (arc_operands); const unsigned arc_Toperand = FKT_T; -- cgit v1.1