diff options
author | Jan Beulich <jbeulich@suse.com> | 2023-06-16 09:23:26 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2023-06-16 09:23:26 +0200 |
commit | b1c792568662d7e00158d19e0439b64f98b78e47 (patch) | |
tree | c7f05f2aead63173ff4a41d5cd2bcd906d173758 /gas/config | |
parent | 2a4da0730829376aeaee4dd8eab345fb6a8ddf03 (diff) | |
download | gdb-b1c792568662d7e00158d19e0439b64f98b78e47.zip gdb-b1c792568662d7e00158d19e0439b64f98b78e47.tar.gz gdb-b1c792568662d7e00158d19e0439b64f98b78e47.tar.bz2 |
x86: shrink Masking insn attribute to a single bit (boolean)
The logic can actually be expressed with less code that way, utilizing
that there are common patterns of when which form of masking is
permitted. This then also eliminates the large set of open-codings of
BOTH_MASKING in the opcode table.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-i386.c | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 690f6ee..de35ee2 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -6530,36 +6530,25 @@ check_VecOperands (const insn_template *t) /* Check if requested masking is supported. */ if (i.mask.reg) { - switch (t->opcode_modifier.masking) + if (!t->opcode_modifier.masking) { - case BOTH_MASKING: - break; - case MERGING_MASKING: - if (i.mask.zeroing) - { - case 0: - i.error = unsupported_masking; - return 1; - } - break; - case DYNAMIC_MASKING: - /* Memory destinations allow only merging masking. */ - if (i.mask.zeroing && i.mem_operands) - { - /* Find memory operand. */ - for (op = 0; op < i.operands; op++) - if (i.flags[op] & Operand_Mem) - break; - gas_assert (op < i.operands); - if (op == i.operands - 1) - { - i.error = unsupported_masking; - return 1; - } - } - break; - default: - abort (); + i.error = unsupported_masking; + return 1; + } + + /* Common rules for masking: + - mask register destinations permit only zeroing-masking, without + that actually being expressed by a {z} operand suffix or EVEX.z, + - memory destinations allow only merging-masking, + - scatter/gather insns (i.e. ones using vSIB) only allow merging- + masking. */ + if (i.mask.zeroing + && (t->operand_types[t->operands - 1].bitfield.class == RegMask + || (i.flags[t->operands - 1] & Operand_Mem) + || t->opcode_modifier.sib)) + { + i.error = unsupported_masking; + return 1; } } |