From ae2387feae3f0798dd77c98a7107fdec38a99fe3 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Tue, 31 Jul 2018 10:57:09 +0200 Subject: x86: fold various AVX512 templates with so far differing Masking attributes There's no insn allowing ZEROING_MASKING alone. Re-purpose its value for handling the not uncommon case of insns allowing either form of masking with register operands, but only merging masking with a memory operand. --- gas/ChangeLog | 5 +++++ gas/config/tc-i386.c | 38 ++++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 6 deletions(-) (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index ff34836..4472821 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,10 @@ 2018-07-31 Jan Beulich + * config/tc-i386.c (check_VecOperands): Convert masking handling + to switch(), to deal with DYNAMIC_MASKING. + +2018-07-31 Jan Beulich + * testsuite/gas/i386/inval-avx512f.s: Add invalid zeroing- masking tests. * testsuite/gas/i386/inval-avx512f.l: Adjust expectations. diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 438bae9..8761e97 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -5241,13 +5241,39 @@ check_VecOperands (const insn_template *t) op = MAX_OPERANDS - 1; /* Avoid uninitialized variable warning. */ /* Check if requested masking is supported. */ - if (i.mask - && (!t->opcode_modifier.masking - || (i.mask->zeroing - && t->opcode_modifier.masking == MERGING_MASKING))) + if (i.mask) { - i.error = unsupported_masking; - return 1; + switch (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.types[op].bitfield.mem) + break; + gas_assert (op < i.operands); + if (op == i.operands - 1) + { + i.error = unsupported_masking; + return 1; + } + } + break; + default: + abort (); + } } /* Check if masking is applied to dest operand. */ -- cgit v1.1