From ff329288d503d392de11f34ce64c7fdd3c62e50f Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Wed, 16 May 2018 12:13:42 +0100 Subject: [PATCH] Fix disassembly mask for vector sdot on AArch64. This patch corrects the disassembly masks for by element dot product instructions. The bit 10 was wrong and supposed to be 1. This caused incorrect disassembly of instructions in the unallocated space to disassemble as dot product instructions. No encoding errors can arrise from this issue. opcodes/ PR binutils/23109 * aarch64-tbl.h (aarch64_opcode_table): Correct sdot and udot. * aarch64-dis-2.c: Regenerate. --- opcodes/ChangeLog | 6 + opcodes/aarch64-dis-2.c | 336 +++++++++++++++++++++------------------- opcodes/aarch64-tbl.h | 4 +- 3 files changed, 186 insertions(+), 160 deletions(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 6baa67ed03..5de393b6ef 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +2018-05-16 Tamar Christina + + PR binutils/23109 + * aarch64-tbl.h (aarch64_opcode_table): Correct sdot and udot. + * aarch64-dis-2.c: Regenerate. + 2018-05-15 Tamar Christina PR binutils/21446 diff --git a/opcodes/aarch64-dis-2.c b/opcodes/aarch64-dis-2.c index c4ec3ca1a3..cf0288f048 100644 --- a/opcodes/aarch64-dis-2.c +++ b/opcodes/aarch64-dis-2.c @@ -18448,13 +18448,13 @@ aarch64_opcode_lookup_1 (uint32_t word) { if (((word >> 28) & 0x1) == 0) { - if (((word >> 14) & 0x1) == 0) + if (((word >> 10) & 0x1) == 0) { - if (((word >> 10) & 0x1) == 0) + if (((word >> 12) & 0x1) == 0) { - if (((word >> 12) & 0x1) == 0) + if (((word >> 13) & 0x1) == 0) { - if (((word >> 13) & 0x1) == 0) + if (((word >> 14) & 0x1) == 0) { if (((word >> 29) & 0x1) == 0) { @@ -18485,6 +18485,39 @@ aarch64_opcode_lookup_1 (uint32_t word) } } else + { + if (((word >> 29) & 0x1) == 0) + { + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + xx001111xxxxxxxx1100x0xxxxxxxxxx + sqdmulh. */ + return 109; + } + else + { + if (((word >> 30) & 0x1) == 0) + { + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + x0101111xxxxxxxx1100x0xxxxxxxxxx + fmlsl2. */ + return 2035; + } + else + { + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + x1101111xxxxxxxx1100x0xxxxxxxxxx + fmlsl2. */ + return 2039; + } + } + } + } + else + { + if (((word >> 14) & 0x1) == 0) { if (((word >> 29) & 0x1) == 0) { @@ -18525,10 +18558,32 @@ aarch64_opcode_lookup_1 (uint32_t word) } } } + else + { + if (((word >> 29) & 0x1) == 0) + { + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + xx001111xxxxxxxx1110x0xxxxxxxxxx + sdot. */ + return 2006; + } + else + { + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + xx101111xxxxxxxx1110x0xxxxxxxxxx + udot. */ + return 2005; + } + } } - else + } + else + { + if (((word >> 13) & 0x1) == 0) { - if (((word >> 13) & 0x1) == 0) + if (((word >> 14) & 0x1) == 0) { if (((word >> 23) & 0x1) == 0) { @@ -18570,6 +18625,28 @@ aarch64_opcode_lookup_1 (uint32_t word) } } else + { + if (((word >> 29) & 0x1) == 0) + { + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + xx001111xxxxxxxx1101x0xxxxxxxxxx + sqrdmulh. */ + return 110; + } + else + { + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + xx101111xxxxxxxx1101x0xxxxxxxxxx + sqrdmlah. */ + return 127; + } + } + } + else + { + if (((word >> 14) & 0x1) == 0) { if (((word >> 30) & 0x1) == 0) { @@ -18588,11 +18665,22 @@ aarch64_opcode_lookup_1 (uint32_t word) return 108; } } + else + { + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + xxx01111xxxxxxxx1111x0xxxxxxxxxx + sqrdmlsh. */ + return 128; + } } } - else + } + else + { + if (((word >> 11) & 0x1) == 0) { - if (((word >> 11) & 0x1) == 0) + if (((word >> 14) & 0x1) == 0) { if (((word >> 12) & 0x1) == 0) { @@ -18635,239 +18723,173 @@ aarch64_opcode_lookup_1 (uint32_t word) } else { - if (((word >> 12) & 0x1) == 0) + if (((word >> 13) & 0x1) == 0) { if (((word >> 29) & 0x1) == 0) { - if (((word >> 30) & 0x1) == 0) - { - /* 33222222222211111111110000000000 - 10987654321098765432109876543210 - x0001111xxxxxxxx10x011xxxxxxxxxx - rshrn. */ - return 376; - } - else - { - /* 33222222222211111111110000000000 - 10987654321098765432109876543210 - x1001111xxxxxxxx10x011xxxxxxxxxx - rshrn2. */ - return 377; - } + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + xx001111xxxxxxxx110x01xxxxxxxxxx + movi. */ + return 135; } else { - if (((word >> 30) & 0x1) == 0) - { - /* 33222222222211111111110000000000 - 10987654321098765432109876543210 - x0101111xxxxxxxx10x011xxxxxxxxxx - sqrshrun. */ - return 400; - } - else - { - /* 33222222222211111111110000000000 - 10987654321098765432109876543210 - x1101111xxxxxxxx10x011xxxxxxxxxx - sqrshrun2. */ - return 401; - } + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + xx101111xxxxxxxx110x01xxxxxxxxxx + mvni. */ + return 143; } } else { - if (((word >> 29) & 0x1) == 0) + if (((word >> 12) & 0x1) == 0) { - if (((word >> 30) & 0x1) == 0) + if (((word >> 29) & 0x1) == 0) { /* 33222222222211111111110000000000 10987654321098765432109876543210 - x0001111xxxxxxxx10x111xxxxxxxxxx - sqrshrn. */ - return 380; + xx001111xxxxxxxx111001xxxxxxxxxx + movi. */ + return 136; } else { /* 33222222222211111111110000000000 10987654321098765432109876543210 - x1001111xxxxxxxx10x111xxxxxxxxxx - sqrshrn2. */ - return 381; + xx101111xxxxxxxx111001xxxxxxxxxx + movi. */ + return 144; } } else { - if (((word >> 30) & 0x1) == 0) + if (((word >> 29) & 0x1) == 0) { /* 33222222222211111111110000000000 10987654321098765432109876543210 - x0101111xxxxxxxx10x111xxxxxxxxxx - uqrshrn. */ - return 404; + xx001111xxxxxxxx111101xxxxxxxxxx + fmov. */ + return 137; } else { /* 33222222222211111111110000000000 10987654321098765432109876543210 - x1101111xxxxxxxx10x111xxxxxxxxxx - uqrshrn2. */ - return 405; + xx101111xxxxxxxx111101xxxxxxxxxx + fmov. */ + return 146; } } } } } - } - else - { - if (((word >> 13) & 0x1) == 0) + else { - if (((word >> 10) & 0x1) == 0) + if (((word >> 12) & 0x1) == 0) { - if (((word >> 12) & 0x1) == 0) + if (((word >> 29) & 0x1) == 0) { - if (((word >> 29) & 0x1) == 0) + if (((word >> 30) & 0x1) == 0) { /* 33222222222211111111110000000000 10987654321098765432109876543210 - xx001111xxxxxxxx1100x0xxxxxxxxxx - sqdmulh. */ - return 109; + x0001111xxxxxxxx1xx011xxxxxxxxxx + rshrn. */ + return 376; } else { - if (((word >> 30) & 0x1) == 0) - { - /* 33222222222211111111110000000000 - 10987654321098765432109876543210 - x0101111xxxxxxxx1100x0xxxxxxxxxx - fmlsl2. */ - return 2035; - } - else - { - /* 33222222222211111111110000000000 - 10987654321098765432109876543210 - x1101111xxxxxxxx1100x0xxxxxxxxxx - fmlsl2. */ - return 2039; - } + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + x1001111xxxxxxxx1xx011xxxxxxxxxx + rshrn2. */ + return 377; } } else { - if (((word >> 29) & 0x1) == 0) + if (((word >> 30) & 0x1) == 0) { /* 33222222222211111111110000000000 10987654321098765432109876543210 - xx001111xxxxxxxx1101x0xxxxxxxxxx - sqrdmulh. */ - return 110; + x0101111xxxxxxxx1xx011xxxxxxxxxx + sqrshrun. */ + return 400; } else { /* 33222222222211111111110000000000 10987654321098765432109876543210 - xx101111xxxxxxxx1101x0xxxxxxxxxx - sqrdmlah. */ - return 127; + x1101111xxxxxxxx1xx011xxxxxxxxxx + sqrshrun2. */ + return 401; } } } else { - if (((word >> 29) & 0x1) == 0) - { - /* 33222222222211111111110000000000 - 10987654321098765432109876543210 - xx001111xxxxxxxx110xx1xxxxxxxxxx - movi. */ - return 135; - } - else - { - /* 33222222222211111111110000000000 - 10987654321098765432109876543210 - xx101111xxxxxxxx110xx1xxxxxxxxxx - mvni. */ - return 143; - } - } - } - else - { - if (((word >> 12) & 0x1) == 0) - { - if (((word >> 29) & 0x1) == 0) - { - /* 33222222222211111111110000000000 - 10987654321098765432109876543210 - xx001111xxxxxxxx1110xxxxxxxxxxxx - movi. */ - return 136; - } - else - { - /* 33222222222211111111110000000000 - 10987654321098765432109876543210 - xx101111xxxxxxxx1110xxxxxxxxxxxx - movi. */ - return 144; - } - } - else - { - if (((word >> 10) & 0x1) == 0) - { - /* 33222222222211111111110000000000 - 10987654321098765432109876543210 - xxx01111xxxxxxxx1111x0xxxxxxxxxx - sqrdmlsh. */ - return 128; - } - else + if (((word >> 13) & 0x1) == 0) { - if (((word >> 11) & 0x1) == 0) + if (((word >> 29) & 0x1) == 0) { - if (((word >> 29) & 0x1) == 0) + if (((word >> 30) & 0x1) == 0) { /* 33222222222211111111110000000000 10987654321098765432109876543210 - xx001111xxxxxxxx111101xxxxxxxxxx - fmov. */ - return 137; + x0001111xxxxxxxx1x0111xxxxxxxxxx + sqrshrn. */ + return 380; } else { /* 33222222222211111111110000000000 10987654321098765432109876543210 - xx101111xxxxxxxx111101xxxxxxxxxx - fmov. */ - return 146; + x1001111xxxxxxxx1x0111xxxxxxxxxx + sqrshrn2. */ + return 381; } } else { - if (((word >> 29) & 0x1) == 0) + if (((word >> 30) & 0x1) == 0) { /* 33222222222211111111110000000000 10987654321098765432109876543210 - xx001111xxxxxxxx111111xxxxxxxxxx - fmov. */ - return 138; + x0101111xxxxxxxx1x0111xxxxxxxxxx + uqrshrn. */ + return 404; } else { /* 33222222222211111111110000000000 10987654321098765432109876543210 - xx101111xxxxxxxx111111xxxxxxxxxx - fcvtzu. */ - return 412; + x1101111xxxxxxxx1x0111xxxxxxxxxx + uqrshrn2. */ + return 405; } } } + else + { + if (((word >> 29) & 0x1) == 0) + { + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + xx001111xxxxxxxx1x1111xxxxxxxxxx + fmov. */ + return 138; + } + else + { + /* 33222222222211111111110000000000 + 10987654321098765432109876543210 + xx101111xxxxxxxx1x1111xxxxxxxxxx + fcvtzu. */ + return 412; + } + } } } } @@ -19337,13 +19359,11 @@ 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: value = 2006; break; /* scvtf --> sdot. */ - case 2006: return NULL; /* sdot --> NULL. */ + case 387: return NULL; /* scvtf --> NULL. */ case 144: value = 145; break; /* movi --> movi. */ case 145: value = 410; break; /* movi --> ucvtf. */ case 410: value = 411; break; /* ucvtf --> ucvtf. */ - case 411: value = 2005; break; /* ucvtf --> udot. */ - case 2005: return NULL; /* udot --> NULL. */ + case 411: return NULL; /* ucvtf --> 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-tbl.h b/opcodes/aarch64-tbl.h index 1e1b2e4ffe..b416ded37e 100644 --- a/opcodes/aarch64-tbl.h +++ b/opcodes/aarch64-tbl.h @@ -4313,8 +4313,8 @@ struct aarch64_opcode aarch64_opcode_table[] = /* 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), + DOT_INSN ("udot", 0x2f00e000, 0xbf00f400, dotproduct, OP3 (Vd, Vn, Em), QL_V2DOT, F_SIZEQ), + DOT_INSN ("sdot", 0xf00e000, 0xbf00f400, dotproduct, OP3 (Vd, Vn, Em), QL_V2DOT, F_SIZEQ), /* Crypto SHA2 (optional in ARMv8.2-a). */ SHA2_INSN ("sha512h", 0xce608000, 0xffe0fc00, cryptosha2, OP3 (Fd, Fn, Vm), QL_SHA512UPT, 0), SHA2_INSN ("sha512h2", 0xce608400, 0xffe0fc00, cryptosha2, OP3 (Fd, Fn, Vm), QL_SHA512UPT, 0), -- 2.34.1