Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit 9207325cc5237c17ebe2c9074a1a8eec23a9f6dc
- Author: Dmitry Selyutin <[email protected]>
- Date: Sat Jan 29 14:54:41 2022 +0000
- svp64: hack powerpc_opcode struct
- diff --git a/gas/config/tc-ppc-svp64.c b/gas/config/tc-ppc-svp64.c
- index 451242dad27..dd5405b55b3 100644
- --- a/gas/config/tc-ppc-svp64.c
- +++ b/gas/config/tc-ppc-svp64.c
- @@ -1,5 +1,10 @@
- +#include <assert.h>
- +#include <stdalign.h>
- +#include <stddef.h>
- #include <stdint.h>
- +#include "opcode/ppc.h"
- +
- struct svp64_rm {
- uint64_t flags;
- const char *pme;
- @@ -869,30 +874,35 @@ svp64_setup_opcodes (htab_t ppc_hash)
- const struct svp64_entry *svp64_end;
- char name[SVP64_NAME_MAX + sizeof(".")];
- + static_assert(alignof(struct svp64_record) == alignof(struct powerpc_opcode),
- + "svp64_record alignment mismatch");
- + static_assert(sizeof(struct svp64_record) == sizeof(uint64_t),
- + "svp64_record size mismatch");
- +
- svp64_end = svp64_entries + svp64_num_entries;
- for (svp64 = svp64_entries; svp64 < svp64_end; svp64++)
- {
- size_t len;
- - struct powerpc_opcode *ppc;
- + struct svp64_record *ppc_svp64;
- len = strlen(svp64->name);
- memcpy(name, svp64->name, len);
- name[len] = '\0';
- - ppc = (struct powerpc_opcode *) str_hash_find (ppc_hash, name);
- - if (!ppc)
- + ppc_svp64 = (struct svp64_record *) str_hash_find (ppc_hash, name);
- + if (!ppc_svp64)
- as_fatal (_("SVP64 instruction missing: %s"), name);
- - ppc->svp64 = svp64->record;
- - ppc->svp64.active = 1;
- + *ppc_svp64 = svp64->record;
- + ppc_svp64->active = 1;
- name[len] = '.';
- name[len + 1] = '\0';
- - ppc = (struct powerpc_opcode *) str_hash_find (ppc_hash, name);
- - if (ppc) {
- - if (ppc->svp64.active)
- + ppc_svp64 = (struct svp64_record *) str_hash_find (ppc_hash, name);
- + if (ppc_svp64) {
- + if (ppc_svp64->active)
- as_fatal (_("SVP64 instruction collision: '%s'"), name);
- - ppc->svp64 = svp64->record;
- - ppc->svp64.active = 1;
- + *ppc_svp64 = svp64->record;
- + ppc_svp64->active = 1;
- }
- }
- }
- diff --git a/include/opcode/ppc.h b/include/opcode/ppc.h
- index e791523211a..3f1bab61b7b 100644
- --- a/include/opcode/ppc.h
- +++ b/include/opcode/ppc.h
- @@ -36,6 +36,12 @@ typedef uint64_t ppc_cpu_t;
- struct powerpc_opcode
- {
- + /*
- + * SVP64 extensions record placeholder.
- + * This placeholder must always be the first entry.
- + */
- + uint64_t : 64;
- +
- /* The opcode name. */
- const char *name;
- @@ -63,9 +69,6 @@ struct powerpc_opcode
- operand table. They appear in the order which the operands must
- appear in assembly code, and are terminated by a zero. */
- unsigned char operands[8];
- -
- - /* SVP64 extensions record. */
- - struct svp64_record svp64;
- };
- /* The table itself is sorted by major opcode number, and is otherwise
- diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
- index 3aac79dbb41..11fb48306d5 100644
- --- a/opcodes/ppc-opc.c
- +++ b/opcodes/ppc-opc.c
- @@ -4329,8 +4329,6 @@ const unsigned int num_powerpc_operands = (sizeof (powerpc_operands)
- #define EXT PPC_OPCODE_RAW
- /* Opcode tables below might have zero-initialized SVP64 entry. */
- -#pragma GCC diagnostic push
- -#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
- /* The opcode table.
- @@ -10831,6 +10829,4 @@ struct powerpc_opcode spe2_opcodes[] = {
- const unsigned int spe2_num_opcodes =
- sizeof (spe2_opcodes) / sizeof (spe2_opcodes[0]);
- -#pragma GCC diagnostic pop
- -
- #include "ppc-svp64-opc.c"
Advertisement
Add Comment
Please, Sign In to add comment