Message ID | a5d738fd-f86f-43e5-a057-a1bddfe2211b@suse.com |
---|---|
State | New |
Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A7F81386480F for <patchwork@sourceware.org>; Thu, 5 Sep 2024 11:31:55 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 389203860C34 for <binutils@sourceware.org>; Thu, 5 Sep 2024 11:31:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 389203860C34 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 389203860C34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::231 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725535890; cv=none; b=Lz9NDtQ7+t2tEBOsHrekDzvIiHwwLr6LbK8a0BVbciCKDgdFMiHTPWvwlM/234jNoGX9Xy3dHWB1Mnv9UfEzl+EcSdi0lbxs/ttUYSSf476sIXLt8IQHXFVNgN8bh6dOvhUwrd3KN27xuAcoMCAWam1+x3V6G0fthtPwv5vrqn8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725535890; c=relaxed/simple; bh=TVTy75/W0MtC3UJJadwVNRTBj9cN1SWlhI2jA27Fx4I=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=fLyT7PFHwmiSMweVhM47EEAJIa9RtVC3s8CncNtFNfBQpWUw+CjZ4vQKCHpEJQV10y8+X0l7OmRwIvGBbeZlty53YoFh5A+lPXCZzYweEWGx6sBU24JlMWDgyJLeTut2Mlyd9QuzFMGzMrzLBYJvyb2Z82+iN5cTD8zkh6AgFTQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2f4f505118fso7440791fa.3 for <binutils@sourceware.org>; Thu, 05 Sep 2024 04:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1725535885; x=1726140685; darn=sourceware.org; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=202j5MdIRkIo73pjdEcjtEPDwoaqKkyUJxOtogZSnew=; b=F7xjs4+KMNxfXTnUpFoxAI24tCjV/hjBdtEPZsjW+tUr4tzp/Bhz9TzulRpKFSHBtS Iz2eXovb2bhehFpMKvoakpsbbUlDrRSLZztZ/1Am/qa0F8QoJO7l0c33kentqXN8ebUR HwZwYcnN1k8vaoZ74cqX3+DrObvML2G6zDByfQcEFgRyjtxnvZPd7T8rkAldoM86iSj5 wjBRULAitVDJweR3KBePKCIGhI1MnFglUnssGlHaBUe+UlbNRZ6sfOdCQaqbu1kSvLsO r08JF9tQNjjVyjOT5i2FAJvtg40RVnS7zAFC9qbhLPC8yKrGqi3BmHWbcuWOGBmM6BEy Ontw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725535885; x=1726140685; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=202j5MdIRkIo73pjdEcjtEPDwoaqKkyUJxOtogZSnew=; b=Nz8DUCADrKP2ZvGmElYd+aGm12RK06usJLJH4YeItU7k0X5giM0ZPw7Lphjbly7G8/ o82RvTNg2tiWx2UenX+OHbdmwPQ85YOMvzZqMixk13RLczA72GY3Sy9a7FLqcP9rot4Y wjXOr7hR3BhtPeCd/s7L91yeJUTBRiOCwk1zADDT7wohsDxd6OXsVvgIlnDtms4GnUBU Jopl/shelXDUtZ+9ZlTkVe9V60mRbX/Pqiwyo7FjCnWIOzyFV7bKyTaPtHdM22uKpRJN vdUzo+VFlHG/KGNJH7oLW1g5ENL0LkJkmsShTpLKLIAar6fNUGms3JjkoCiVTgvW2TIu bRXA== X-Gm-Message-State: AOJu0Yyp1tD724tixajjo5gL46mDWO8aDp0fdwzZaq+NIagQld3z5YQ4 SBM2uO5rSJ//krtkvPakR2zrhoBsJALWDiGdYcBeYkE9I8ZZyOZevOu9O7/bq7T4DIzqtkbkwH8 = X-Google-Smtp-Source: AGHT+IFs0ZxL5qNEetHvSoQy8Hr5geWcfjjCI/sE7xbXDQme3p2wjCRaTs7PBIKjcYuB1kgz7zSDjQ== X-Received: by 2002:a2e:4e0a:0:b0:2ef:2c86:4d45 with SMTP id 38308e7fff4ca-2f626586e11mr112027631fa.27.1725535885358; Thu, 05 Sep 2024 04:31:25 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3cc6a51b0sm1096016a12.86.2024.09.05.04.31.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Sep 2024 04:31:24 -0700 (PDT) Message-ID: <a5d738fd-f86f-43e5-a057-a1bddfe2211b@suse.com> Date: Thu, 5 Sep 2024 13:31:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Binutils <binutils@sourceware.org> Cc: Lili Cui <lili.cui@intel.com>, "H.J. Lu" <hjl.tools@gmail.com> From: Jan Beulich <jbeulich@suse.com> Subject: [PATCH] x86/APX: correct disassembly for EVEX.B4 Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk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zldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3023.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
Series |
x86/APX: correct disassembly for EVEX.B4
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_binutils_build--master-arm | success | Build passed |
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 | success | Build passed |
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 | success | Test passed |
linaro-tcwg-bot/tcwg_binutils_check--master-arm | success | Test passed |
Commit Message
Jan Beulich
Sept. 5, 2024, 11:31 a.m. UTC
EVEX.B4 is used only for GPR (or addressing of memory) operands. SIMD registers encoded via ModR/M.rm (when ModR/M.mod == 3) have their top bit in EVEX.X3. Supposedly (doc version 004) EVEX.B4 is ignored when unused, hence also don't flag such encodings as invalid.
Comments
> -----Original Message----- > From: Jan Beulich <jbeulich@suse.com> > Sent: Thursday, September 5, 2024 7:31 PM > To: Binutils <binutils@sourceware.org> > Cc: Cui, Lili <lili.cui@intel.com>; H.J. Lu <hjl.tools@gmail.com> > Subject: [PATCH] x86/APX: correct disassembly for EVEX.B4 > > EVEX.B4 is used only for GPR (or addressing of memory) operands. SIMD > registers encoded via ModR/M.rm (when ModR/M.mod == 3) have their top bit > in EVEX.X3. Supposedly (doc version 004) EVEX.B4 is ignored when unused, > hence also don't flag such encodings as invalid. > > --- a/opcodes/i386-dis.c > +++ b/opcodes/i386-dis.c > @@ -13001,14 +13001,15 @@ OP_EX (instr_info *ins, int bytemode, in > USED_REX (REX_B); > if (ins->rex & REX_B) > reg += 8; > - if (ins->rex2 & REX_B) > - reg += 16; > if (ins->vex.evex) > { > USED_REX (REX_X); > if ((ins->rex & REX_X)) > reg += 16; > + ins->rex2_used &= ~REX_B; > } > + else if (ins->rex2 & REX_B) > + reg += 16; > > if ((sizeflag & SUFFIX_ALWAYS) > && (bytemode == x_swap_mode when setting ins->vex.evex , we use EVEX.X to decode SIMD, then ins->rex also needs to be put into the else branch since it uses REX_B right? If (ins->vex.evex) { Use REX_X. } else { Use REX_B. } Lili.
On 06.09.2024 04:04, Cui, Lili wrote: > > >> -----Original Message----- >> From: Jan Beulich <jbeulich@suse.com> >> Sent: Thursday, September 5, 2024 7:31 PM >> To: Binutils <binutils@sourceware.org> >> Cc: Cui, Lili <lili.cui@intel.com>; H.J. Lu <hjl.tools@gmail.com> >> Subject: [PATCH] x86/APX: correct disassembly for EVEX.B4 >> >> EVEX.B4 is used only for GPR (or addressing of memory) operands. SIMD >> registers encoded via ModR/M.rm (when ModR/M.mod == 3) have their top bit >> in EVEX.X3. Supposedly (doc version 004) EVEX.B4 is ignored when unused, >> hence also don't flag such encodings as invalid. >> >> --- a/opcodes/i386-dis.c >> +++ b/opcodes/i386-dis.c >> @@ -13001,14 +13001,15 @@ OP_EX (instr_info *ins, int bytemode, in >> USED_REX (REX_B); >> if (ins->rex & REX_B) >> reg += 8; >> - if (ins->rex2 & REX_B) >> - reg += 16; >> if (ins->vex.evex) >> { >> USED_REX (REX_X); >> if ((ins->rex & REX_X)) >> reg += 16; >> + ins->rex2_used &= ~REX_B; >> } >> + else if (ins->rex2 & REX_B) >> + reg += 16; >> >> if ((sizeflag & SUFFIX_ALWAYS) >> && (bytemode == x_swap_mode > > when setting ins->vex.evex , we use EVEX.X to decode SIMD, then ins->rex also needs to be put into the else branch since it uses REX_B right? > > If (ins->vex.evex) > { > Use REX_X. > } > else > { > Use REX_B. > } Except that at that point we don't know yet whether it's a GPR, a memory operand, or a SIMD register. Jan
> >> EVEX.B4 is used only for GPR (or addressing of memory) operands. SIMD > >> registers encoded via ModR/M.rm (when ModR/M.mod == 3) have their top > >> bit in EVEX.X3. Supposedly (doc version 004) EVEX.B4 is ignored when > >> unused, hence also don't flag such encodings as invalid. > >> > >> --- a/opcodes/i386-dis.c > >> +++ b/opcodes/i386-dis.c > >> @@ -13001,14 +13001,15 @@ OP_EX (instr_info *ins, int bytemode, in > >> USED_REX (REX_B); > >> if (ins->rex & REX_B) > >> reg += 8; > >> - if (ins->rex2 & REX_B) > >> - reg += 16; > >> if (ins->vex.evex) > >> { > >> USED_REX (REX_X); > >> if ((ins->rex & REX_X)) > >> reg += 16; > >> + ins->rex2_used &= ~REX_B; > >> } > >> + else if (ins->rex2 & REX_B) > >> + reg += 16; > >> > >> if ((sizeflag & SUFFIX_ALWAYS) > >> && (bytemode == x_swap_mode > > > > when setting ins->vex.evex , we use EVEX.X to decode SIMD, then ins->rex also > needs to be put into the else branch since it uses REX_B right? > > > > If (ins->vex.evex) > > { > > Use REX_X. > > } > > else > > { > > Use REX_B. > > } > > Except that at that point we don't know yet whether it's a GPR, a memory > operand, or a SIMD register. > Oh, I saw that table, EVEX.X3 should be combined with EVEX.B3 to determine the number of SIMD registers, but the use of EVEX.X3 and EVEX.B4 are mutually exclusive. Thanks, Lili.
--- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -13001,14 +13001,15 @@ OP_EX (instr_info *ins, int bytemode, in USED_REX (REX_B); if (ins->rex & REX_B) reg += 8; - if (ins->rex2 & REX_B) - reg += 16; if (ins->vex.evex) { USED_REX (REX_X); if ((ins->rex & REX_X)) reg += 16; + ins->rex2_used &= ~REX_B; } + else if (ins->rex2 & REX_B) + reg += 16; if ((sizeflag & SUFFIX_ALWAYS) && (bytemode == x_swap_mode