From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1386) id D51E43858D28; Fri, 2 Dec 2022 08:54:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D51E43858D28 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: simplify and slightly correct XCHG vs NOP checking X-Act-Checkin: binutils-gdb X-Git-Author: Jan Beulich X-Git-Refname: refs/heads/master X-Git-Oldrev: a33ef3c24a85759af9a629d673cb49c822466547 X-Git-Newrev: 4473201422ad238f90f3151454959a6d35cfb6c2 Message-Id: <20221202085426.D51E43858D28@sourceware.org> Date: Fri, 2 Dec 2022 08:54:26 +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: Fri, 02 Dec 2022 08:54:26 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D4473201422ad= 238f90f3151454959a6d35cfb6c2 commit 4473201422ad238f90f3151454959a6d35cfb6c2 Author: Jan Beulich Date: Fri Dec 2 09:53:33 2022 +0100 x86: simplify and slightly correct XCHG vs NOP checking =20 For one, because of CheckRegSize, there's no need to check the size of both (register) operands. And then in process_suffix() check opcode space rather than the (potentially ambiguous) extension opcode. Diff: --- gas/config/tc-i386.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index c58a570123f..3c1e2c91afc 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -6686,8 +6686,7 @@ match_template (char mnem_suffix) && t->opcode_modifier.opcodespace =3D=3D SPACE_BASE && i.types[0].bitfield.instance =3D=3D Accum && i.types[0].bitfield.dword - && i.types[1].bitfield.instance =3D=3D Accum - && i.types[1].bitfield.dword) + && i.types[1].bitfield.instance =3D=3D Accum) continue; /* xrelease mov %eax, is another special case. It must not match the accumulator-only encoding of mov. */ @@ -7408,11 +7407,10 @@ process_suffix (void) need rex64. */ && ! (i.operands =3D=3D 2 && i.tm.base_opcode =3D=3D 0x90 - && i.tm.extension_opcode =3D=3D None + && i.tm.opcode_modifier.opcodespace =3D=3D SPACE_BASE && i.types[0].bitfield.instance =3D=3D Accum && i.types[0].bitfield.qword - && i.types[1].bitfield.instance =3D=3D Accum - && i.types[1].bitfield.qword)) + && i.types[1].bitfield.instance =3D=3D Accum)) i.rex |=3D REX_W; =20 break;