From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1386) id 824C53857708; Tue, 4 Jul 2023 15:02:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 824C53857708 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jan Beulich To: bfd-cvs@sourceware.org Subject: [binutils-gdb] x86: flag EVEX.z set when destination is memory X-Act-Checkin: binutils-gdb X-Git-Author: Jan Beulich X-Git-Refname: refs/heads/master X-Git-Oldrev: ac500f1772cfd5b1cf92acfa3ea4e7c43fab4fe3 X-Git-Newrev: 1f83c96159d55af9caa96aa8f335ca1fd501a953 Message-Id: <20230704150239.824C53857708@sourceware.org> Date: Tue, 4 Jul 2023 15:02:39 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jul 2023 15:02:39 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D1f83c96159d5= 5af9caa96aa8f335ca1fd501a953 commit 1f83c96159d55af9caa96aa8f335ca1fd501a953 Author: Jan Beulich Date: Tue Jul 4 17:01:10 2023 +0200 x86: flag EVEX.z set when destination is memory =20 Zeroing-masking is not permitted in this case. See the code comment for how this is being dealt with. Diff: --- gas/testsuite/gas/i386/avx512f-nondef.d | 1 + gas/testsuite/gas/i386/avx512f-nondef.s | 3 +++ opcodes/i386-dis.c | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/gas/testsuite/gas/i386/avx512f-nondef.d b/gas/testsuite/gas/i3= 86/avx512f-nondef.d index efa3f58a621..9c1d3272669 100644 --- a/gas/testsuite/gas/i386/avx512f-nondef.d +++ b/gas/testsuite/gas/i386/avx512f-nondef.d @@ -21,4 +21,5 @@ Disassembly of section .text: [ ]*[a-f0-9]+: 62 f2 7d cf 92 04 08 vgatherdps \(%eax,%zmm1(,1)?\),%zmm0= \{%k7\}\{z\}/\(bad\) [ ]*[a-f0-9]+: 62 f2 7d 48 92 04 08 vgatherdps \(%eax,%zmm1(,1)?\),%zmm0= /\(bad\) [ ]*[a-f0-9]+: 62 f1 7c cf c2 c0 00 vcmpeqps %zmm0,%zmm0,%k0\{%k7\}\{z\}= /\(bad\) +[ ]*[a-f0-9]+: 62 f1 7c cf 29 00 vmovaps %zmm0,\(%eax\)\{%k7\}\{z\}/\= (bad\) #pass diff --git a/gas/testsuite/gas/i386/avx512f-nondef.s b/gas/testsuite/gas/i3= 86/avx512f-nondef.s index 0216003f347..77426b1b7f5 100644 --- a/gas/testsuite/gas/i386/avx512f-nondef.s +++ b/gas/testsuite/gas/i386/avx512f-nondef.s @@ -29,3 +29,6 @@ =20 # vcmpeqps %zmm0, %zmm0, %k0{%k7} with EVEX.z set .insn EVEX.0f 0xc2, $0, %zmm0, %zmm0, %k0{%k7}{z} + + # vmovaps %zmm0, (%eax){%k7} with EVEX.z set + .insn EVEX.0f 0x29, %zmm0, (%eax){%k7}{z} diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index e440b694f1a..7c4130245e1 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -11855,6 +11855,13 @@ OP_E_memory (instr_info *ins, int bytemode, int si= zeflag) =20 if (ins->vex.evex) { + + /* Zeroing-masking is invalid for memory destinations. Set the flag + uniformly, as the consumer will inspect it only for the destination + operand. */ + if (ins->vex.zeroing) + ins->illegal_masking =3D true; + switch (bytemode) { case dw_mode: