summaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2017-06-28 11:09:01 +0100
committerJiong Wang <jiong.wang@arm.com>2017-06-28 11:09:01 +0100
commit65a55fbbd949868f7df3c65d39eb8d4455515132 (patch)
tree004ff233f1a34016efc97cef4bf89a5e0003033b /opcodes
parentc604a79ad4d47070bbcc0bc082188fb16892ceef (diff)
[AArch64] Add dot product support for AArch64 to binutils
gas/ * config/tc-aarch64.c (aarch64_reg_parse_32_64): Accept 4B. (aarch64_features): Added dotprod. * doc/c-aarch64.texi: Added dotprod. * testsuite/gas/aarch64/dotproduct.d: New. * testsuite/gas/aarch64/dotproduct.s: New. opcodes/ * aarch64-asm.c (aarch64_ins_reglane): Added 4B dotprod. * aarch64-dis.c (aarch64_ext_reglane): Likewise. * aarch64-tbl.h (QL_V3DOT, QL_V2DOT): New. (aarch64_feature_dotprod, DOT_INSN): New. (udot, sdot): New. * aarch64-dis-2.c: Regenerated. include/ * opcode/aarch64.h: (AARCH64_FEATURE_DOTPROD): New. (aarch64_insn_class): Added dotprod.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog9
-rw-r--r--opcodes/aarch64-asm.c14
-rw-r--r--opcodes/aarch64-dis-2.c382
-rw-r--r--opcodes/aarch64-dis.c15
-rw-r--r--opcodes/aarch64-tbl.h24
5 files changed, 265 insertions, 179 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 8cc85205d0..db23da3206 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,12 @@
+2017-06-28 Tamar Christina <tamar.christina@arm.com>
+
+ * aarch64-asm.c (aarch64_ins_reglane): Added 4B dotprod.
+ * aarch64-dis.c (aarch64_ext_reglane): Likewise.
+ * aarch64-tbl.h (QL_V3DOT, QL_V2DOT): New.
+ (aarch64_feature_dotprod, DOT_INSN): New.
+ (udot, sdot): New.
+ * aarch64-dis-2.c: Regenerated.
+
2017-06-28 Jiong Wang <jiong.wang@arm.com>
* arm-dis.c (coprocessor_opcodes): New entries for vsdot and vudot.
diff --git a/opcodes/aarch64-asm.c b/opcodes/aarch64-asm.c
index 6d2c75a068..345d59902e 100644
--- a/opcodes/aarch64-asm.c
+++ b/opcodes/aarch64-asm.c
@@ -121,6 +121,20 @@ aarch64_ins_reglane (const aarch64_operand *self, const aarch64_opnd_info *info,
insert_field (FLD_imm5, code, value, 0);
}
}
+ else if (inst->opcode->iclass == dotproduct)
+ {
+ unsigned reglane_index = info->reglane.index;
+ switch (info->qualifier)
+ {
+ case AARCH64_OPND_QLF_S_B:
+ /* L:H */
+ assert (reglane_index < 4);
+ insert_fields (code, reglane_index, 0, 2, FLD_L, FLD_H);
+ break;
+ default:
+ assert (0);
+ }
+ }
else
{
/* index for e.g. SQDMLAL <Va><d>, <Vb><n>, <Vm>.<Ts>[<index>]
diff --git a/opcodes/aarch64-dis-2.c b/opcodes/aarch64-dis-2.c
index fe71ebc518..bbe066929e 100644
--- a/opcodes/aarch64-dis-2.c
+++ b/opcodes/aarch64-dis-2.c
@@ -12771,11 +12771,33 @@ aarch64_opcode_lookup_1 (uint32_t word)
{
if (((word >> 11) & 0x1) == 0)
{
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx10x001xxxxx0xx01110xxx
- sqrdmlah. */
- return 364;
+ if (((word >> 12) & 0x1) == 0)
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx100001xxxxx0xx01110xxx
+ sqrdmlah. */
+ return 364;
+ }
+ else
+ {
+ if (((word >> 29) & 0x1) == 0)
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx101001xxxxx0xx011100xx
+ sdot. */
+ return 1987;
+ }
+ else
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx101001xxxxx0xx011101xx
+ udot. */
+ return 1986;
+ }
+ }
}
else
{
@@ -17931,13 +17953,13 @@ aarch64_opcode_lookup_1 (uint32_t word)
{
if (((word >> 28) & 0x1) == 0)
{
- if (((word >> 10) & 0x1) == 0)
+ if (((word >> 14) & 0x1) == 0)
{
- if (((word >> 12) & 0x1) == 0)
+ if (((word >> 10) & 0x1) == 0)
{
- if (((word >> 13) & 0x1) == 0)
+ if (((word >> 12) & 0x1) == 0)
{
- if (((word >> 14) & 0x1) == 0)
+ if (((word >> 13) & 0x1) == 0)
{
/* 33222222222211111111110000000000
10987654321098765432109876543210
@@ -17947,60 +17969,49 @@ aarch64_opcode_lookup_1 (uint32_t word)
}
else
{
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx0x0011xxxxxxxx11110xxx
- sqdmulh. */
- return 109;
- }
- }
- else
- {
- if (((word >> 29) & 0x1) == 0)
- {
- if (((word >> 30) & 0x1) == 0)
- {
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx0x01x1xxxxxxxx1111000x
- smull. */
- return 105;
- }
- else
- {
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx0x01x1xxxxxxxx1111001x
- smull2. */
- return 106;
- }
- }
- else
- {
- if (((word >> 30) & 0x1) == 0)
+ if (((word >> 29) & 0x1) == 0)
{
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx0x01x1xxxxxxxx1111010x
- umull. */
- return 123;
+ if (((word >> 30) & 0x1) == 0)
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx0x0101xxxxxxxx1111000x
+ smull. */
+ return 105;
+ }
+ else
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx0x0101xxxxxxxx1111001x
+ smull2. */
+ return 106;
+ }
}
else
{
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx0x01x1xxxxxxxx1111011x
- umull2. */
- return 124;
+ if (((word >> 30) & 0x1) == 0)
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx0x0101xxxxxxxx1111010x
+ umull. */
+ return 123;
+ }
+ else
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx0x0101xxxxxxxx1111011x
+ umull2. */
+ return 124;
+ }
}
}
}
- }
- else
- {
- if (((word >> 13) & 0x1) == 0)
+ else
{
- if (((word >> 14) & 0x1) == 0)
+ if (((word >> 13) & 0x1) == 0)
{
if (((word >> 23) & 0x1) == 0)
{
@@ -18043,28 +18054,6 @@ aarch64_opcode_lookup_1 (uint32_t word)
}
else
{
- if (((word >> 29) & 0x1) == 0)
- {
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx0x1011xxxxxxxx111100xx
- sqrdmulh. */
- return 110;
- }
- else
- {
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx0x1011xxxxxxxx111101xx
- sqrdmlah. */
- return 127;
- }
- }
- }
- else
- {
- if (((word >> 14) & 0x1) == 0)
- {
if (((word >> 30) & 0x1) == 0)
{
/* 33222222222211111111110000000000
@@ -18082,22 +18071,11 @@ aarch64_opcode_lookup_1 (uint32_t word)
return 108;
}
}
- else
- {
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx0x1111xxxxxxxx11110xxx
- sqrdmlsh. */
- return 128;
- }
}
}
- }
- else
- {
- if (((word >> 11) & 0x1) == 0)
+ else
{
- if (((word >> 14) & 0x1) == 0)
+ if (((word >> 11) & 0x1) == 0)
{
if (((word >> 12) & 0x1) == 0)
{
@@ -18140,173 +18118,217 @@ aarch64_opcode_lookup_1 (uint32_t word)
}
else
{
- if (((word >> 13) & 0x1) == 0)
+ if (((word >> 12) & 0x1) == 0)
{
if (((word >> 29) & 0x1) == 0)
{
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx10x011xxxxxxxx111100xx
- movi. */
- return 135;
+ if (((word >> 30) & 0x1) == 0)
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx110x01xxxxxxxx1111000x
+ rshrn. */
+ return 376;
+ }
+ else
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx110x01xxxxxxxx1111001x
+ rshrn2. */
+ return 377;
+ }
}
else
{
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx10x011xxxxxxxx111101xx
- mvni. */
- return 143;
+ if (((word >> 30) & 0x1) == 0)
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx110x01xxxxxxxx1111010x
+ sqrshrun. */
+ return 400;
+ }
+ else
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx110x01xxxxxxxx1111011x
+ sqrshrun2. */
+ return 401;
+ }
}
}
else
{
- if (((word >> 12) & 0x1) == 0)
+ if (((word >> 29) & 0x1) == 0)
{
- if (((word >> 29) & 0x1) == 0)
+ if (((word >> 30) & 0x1) == 0)
{
/* 33222222222211111111110000000000
10987654321098765432109876543210
- xxxxxxxxxx100111xxxxxxxx111100xx
- movi. */
- return 136;
+ xxxxxxxxxx111x01xxxxxxxx1111000x
+ sqrshrn. */
+ return 380;
}
else
{
/* 33222222222211111111110000000000
10987654321098765432109876543210
- xxxxxxxxxx100111xxxxxxxx111101xx
- movi. */
- return 144;
+ xxxxxxxxxx111x01xxxxxxxx1111001x
+ sqrshrn2. */
+ return 381;
}
}
else
{
- if (((word >> 29) & 0x1) == 0)
+ if (((word >> 30) & 0x1) == 0)
{
/* 33222222222211111111110000000000
10987654321098765432109876543210
- xxxxxxxxxx101111xxxxxxxx111100xx
- fmov. */
- return 137;
+ xxxxxxxxxx111x01xxxxxxxx1111010x
+ uqrshrn. */
+ return 404;
}
else
{
/* 33222222222211111111110000000000
10987654321098765432109876543210
- xxxxxxxxxx101111xxxxxxxx111101xx
- fmov. */
- return 146;
+ xxxxxxxxxx111x01xxxxxxxx1111011x
+ uqrshrn2. */
+ return 405;
}
}
}
}
}
- else
+ }
+ else
+ {
+ if (((word >> 13) & 0x1) == 0)
{
- if (((word >> 12) & 0x1) == 0)
+ if (((word >> 10) & 0x1) == 0)
{
- if (((word >> 29) & 0x1) == 0)
+ if (((word >> 12) & 0x1) == 0)
{
- if (((word >> 30) & 0x1) == 0)
- {
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx110xx1xxxxxxxx1111000x
- rshrn. */
- return 376;
- }
- else
- {
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx110xx1xxxxxxxx1111001x
- rshrn2. */
- return 377;
- }
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx0x0011xxxxxxxx11110xxx
+ sqdmulh. */
+ return 109;
}
else
{
- if (((word >> 30) & 0x1) == 0)
+ if (((word >> 29) & 0x1) == 0)
{
/* 33222222222211111111110000000000
10987654321098765432109876543210
- xxxxxxxxxx110xx1xxxxxxxx1111010x
- sqrshrun. */
- return 400;
+ xxxxxxxxxx0x1011xxxxxxxx111100xx
+ sqrdmulh. */
+ return 110;
}
else
{
/* 33222222222211111111110000000000
10987654321098765432109876543210
- xxxxxxxxxx110xx1xxxxxxxx1111011x
- sqrshrun2. */
- return 401;
+ xxxxxxxxxx0x1011xxxxxxxx111101xx
+ sqrdmlah. */
+ return 127;
}
}
}
else
{
- if (((word >> 13) & 0x1) == 0)
+ if (((word >> 29) & 0x1) == 0)
{
- if (((word >> 29) & 0x1) == 0)
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx1xx011xxxxxxxx111100xx
+ movi. */
+ return 135;
+ }
+ else
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx1xx011xxxxxxxx111101xx
+ mvni. */
+ return 143;
+ }
+ }
+ }
+ else
+ {
+ if (((word >> 12) & 0x1) == 0)
+ {
+ if (((word >> 29) & 0x1) == 0)
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxxxx0111xxxxxxxx111100xx
+ movi. */
+ return 136;
+ }
+ else
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxxxx0111xxxxxxxx111101xx
+ movi. */
+ return 144;
+ }
+ }
+ else
+ {
+ if (((word >> 10) & 0x1) == 0)
+ {
+ /* 33222222222211111111110000000000
+ 10987654321098765432109876543210
+ xxxxxxxxxx0x1111xxxxxxxx11110xxx
+ sqrdmlsh. */
+ return 128;
+ }
+ else
+ {
+ if (((word >> 11) & 0x1) == 0)
{
- if (((word >> 30) & 0x1) == 0)
+ if (((word >> 29) & 0x1) == 0)
{
/* 33222222222211111111110000000000
10987654321098765432109876543210
- xxxxxxxxxx1110x1xxxxxxxx1111000x
- sqrshrn. */
- return 380;
+ xxxxxxxxxx101111xxxxxxxx111100xx
+ fmov. */
+ return 137;
}
else
{
/* 33222222222211111111110000000000
10987654321098765432109876543210
- xxxxxxxxxx1110x1xxxxxxxx1111001x
- sqrshrn2. */
- return 381;
+ xxxxxxxxxx101111xxxxxxxx111101xx
+ fmov. */
+ return 146;
}
}
else
{
- if (((word >> 30) & 0x1) == 0)
+ if (((word >> 29) & 0x1) == 0)
{
/* 33222222222211111111110000000000
10987654321098765432109876543210
- xxxxxxxxxx1110x1xxxxxxxx1111010x
- uqrshrn. */
- return 404;
+ xxxxxxxxxx111111xxxxxxxx111100xx
+ fmov. */
+ return 138;
}
else
{
/* 33222222222211111111110000000000
10987654321098765432109876543210
- xxxxxxxxxx1110x1xxxxxxxx1111011x
- uqrshrn2. */
- return 405;
+ xxxxxxxxxx111111xxxxxxxx111101xx
+ fcvtzu. */
+ return 412;
}
}
}
- else
- {
- if (((word >> 29) & 0x1) == 0)
- {
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx1111x1xxxxxxxx111100xx
- fmov. */
- return 138;
- }
- else
- {
- /* 33222222222211111111110000000000
- 10987654321098765432109876543210
- xxxxxxxxxx1111x1xxxxxxxx111101xx
- fcvtzu. */
- return 412;
- }
- }
}
}
}
@@ -18743,11 +18765,13 @@ aarch64_find_next_opcode (const aarch64_opcode *opcode)
case 403: return NULL; /* uqshrn2 --> NULL. */
case 136: value = 386; break; /* movi --> scvtf. */
case 386: value = 387; break; /* scvtf --> scvtf. */
- case 387: return NULL; /* scvtf --> NULL. */
+ case 387: value = 1989; break; /* scvtf --> sdot. */
+ case 1989: return NULL; /* sdot --> NULL. */
case 144: value = 145; break; /* movi --> movi. */
case 145: value = 410; break; /* movi --> ucvtf. */
case 410: value = 411; break; /* ucvtf --> ucvtf. */
- case 411: return NULL; /* ucvtf --> NULL. */
+ case 411: value = 1988; break; /* ucvtf --> udot. */
+ case 1988: return NULL; /* udot --> NULL. */
case 138: value = 388; break; /* fmov --> fcvtzs. */
case 388: value = 389; break; /* fcvtzs --> fcvtzs. */
case 389: return NULL; /* fcvtzs --> NULL. */
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index a860dbcb00..4fd94e8f7a 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -325,6 +325,21 @@ aarch64_ext_reglane (const aarch64_operand *self, aarch64_opnd_info *info,
info->reglane.index = (unsigned) (value >> 1);
}
}
+ else if (inst->opcode->iclass == dotproduct)
+ {
+ /* Need information in other operand(s) to help decoding. */
+ info->qualifier = get_expected_qualifier (inst, info->idx);
+ switch (info->qualifier)
+ {
+ case AARCH64_OPND_QLF_S_B:
+ /* L:H */
+ info->reglane.index = extract_fields (code, 0, 2, FLD_H, FLD_L);
+ info->reglane.regno &= 0x1f;
+ break;
+ default:
+ return 0;
+ }
+ }
else
{
/* Index only for e.g. SQDMLAL <Va><d>, <Vb><n>, <Vm>.<Ts>[<index>]
diff --git a/opcodes/aarch64-tbl.h b/opcodes/aarch64-tbl.h
index a7510ff5ea..61c2582d01 100644
--- a/opcodes/aarch64-tbl.h
+++ b/opcodes/aarch64-tbl.h
@@ -1982,6 +1982,19 @@
{ \
QLF3(X,X,NIL), \
}
+/* e.g. UDOT <Vd>.2S, <Vn>.8B, <Vm>.8B. */
+#define QL_V3DOT \
+{ \
+ QLF3(V_2S, V_8B, V_8B), \
+ QLF3(V_4S, V_16B, V_16B),\
+}
+
+/* e.g. UDOT <Vd>.2S, <Vn>.8B, <Vm>.4B[<index>]. */
+#define QL_V2DOT \
+{ \
+ QLF3(V_2S, V_8B, S_B),\
+ QLF3(V_4S, V_16B, S_B),\
+}
/* Opcode table. */
@@ -2021,6 +2034,8 @@ static const aarch64_feature_set aarch64_feature_compnum =
AARCH64_FEATURE (AARCH64_FEATURE_COMPNUM, 0);
static const aarch64_feature_set aarch64_feature_rcpc =
AARCH64_FEATURE (AARCH64_FEATURE_RCPC, 0);
+static const aarch64_feature_set aarch64_feature_dotprod =
+ AARCH64_FEATURE (AARCH64_FEATURE_V8_2 | AARCH64_FEATURE_DOTPROD, 0);
#define CORE &aarch64_feature_v8
#define FP &aarch64_feature_fp
@@ -2040,6 +2055,7 @@ static const aarch64_feature_set aarch64_feature_rcpc =
#define FP_V8_3 &aarch64_feature_fp_v8_3
#define COMPNUM &aarch64_feature_compnum
#define RCPC &aarch64_feature_rcpc
+#define DOTPROD &aarch64_feature_dotprod
#define CORE_INSN(NAME,OPCODE,MASK,CLASS,OP,OPS,QUALS,FLAGS) \
{ NAME, OPCODE, MASK, CLASS, OP, CORE, OPS, QUALS, FLAGS, 0, NULL }
@@ -2072,6 +2088,8 @@ static const aarch64_feature_set aarch64_feature_rcpc =
{ NAME, OPCODE, MASK, CLASS, OP, COMPNUM, OPS, QUALS, FLAGS, 0, NULL }
#define RCPC_INSN(NAME,OPCODE,MASK,CLASS,OPS,QUALS,FLAGS) \
{ NAME, OPCODE, MASK, CLASS, 0, RCPC, OPS, QUALS, FLAGS, 0, NULL }
+#define DOT_INSN(NAME,OPCODE,MASK,CLASS,OPS,QUALS,FLAGS) \
+ { NAME, OPCODE, MASK, CLASS, 0, DOTPROD, OPS, QUALS, FLAGS, 0, NULL }
struct aarch64_opcode aarch64_opcode_table[] =
{
@@ -4137,6 +4155,12 @@ struct aarch64_opcode aarch64_opcode_table[] =
_SVE_INSN ("fmov", 0x05104000, 0xff30ffe0, sve_size_hsd, 0, OP3 (SVE_Zd, SVE_Pg4_16, FPIMM0), OP_SVE_VM_HSD, F_ALIAS | F_PSEUDO, 0),
_SVE_INSN ("orn", 0x05000000, 0xfffc0000, sve_limm, 0, OP3 (SVE_Zd, SVE_Zd, SVE_INV_LIMM), OP_SVE_VVU_BHSD, F_ALIAS | F_PSEUDO, 1),
+ /* SIMD Dot Product (optional in v8.2-A). */
+ DOT_INSN ("udot", 0x2e009400, 0xbf20fc00, dotproduct, OP3 (Vd, Vn, Vm), QL_V3DOT, F_SIZEQ),
+ DOT_INSN ("sdot", 0xe009400, 0xbf20fc00, dotproduct, OP3 (Vd, Vn, Vm), QL_V3DOT, F_SIZEQ),
+ DOT_INSN ("udot", 0x2f00e000, 0xbf00f000, dotproduct, OP3 (Vd, Vn, Em), QL_V2DOT, F_SIZEQ),
+ DOT_INSN ("sdot", 0xf00e000, 0xbf00f000, dotproduct, OP3 (Vd, Vn, Em), QL_V2DOT, F_SIZEQ),
+
{0, 0, 0, 0, 0, 0, {}, {}, 0, 0, NULL},
};