From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by sourceware.org (Postfix) with ESMTPS id F40543858D38 for ; Fri, 14 Oct 2022 17:29:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F40543858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-x72f.google.com with SMTP id m6so2914003qkm.4 for ; Fri, 14 Oct 2022 10:29:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ICaewz19tiDTJnXLhx3sZAq/Ztsw7kuLpjdq6BBqPks=; b=VLmJPhGG4VJoAbR4zYNrBbLfjphQK4oI5qaXXPhblDjpbO/PQxrOOrtnVdb5uz10kA UaUt1WykH6PV2Vz3NfkeJtlHFZ6ctQhHi037amlOaemIJnPrb4SllWQ/cjJSqACxwkSI 6l9XJsW1bnqr08SeDYos38goeBArQoaT+CtxUgZ1Io5PafENiLmxvcQA5GdNiQBcmPQ5 XisaeHtMzU25L1M6yuFFhEttnEsd4AFSjg/CFRaezd5noF62Dy/jGGjXvvumxADOubs7 5y8oShTFKAAbD3gHIcy//CHVlj2WUlZRKUYoxECMCTNr5BmQ7Vn044qwJtDOzPBcJb4C c18Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ICaewz19tiDTJnXLhx3sZAq/Ztsw7kuLpjdq6BBqPks=; b=eFE8DFIJ5JXMhDbjddRXd5b83Url91Z+ToYkQa0jW02UIHV9ltYphaP2DVsHns909L 9plFuot5n31N5/cB+dNRjPUjNzDg/1p690hK4aib3/Kb5xFvqpgWwKZT9hWZOa43J4wJ X+FA/j5gGYDgBUe7phKaumGieBtN+EGNnOY252i5Nt5LWfiGCKnIIIXKN+nqSmN3i4Zk 0Ce332DQIcSdptrOT7sMdVBaQ4zBAk91fBKK2A7PdZjd0fyLXJIpItrRLIWqYAaZiik1 E18uD+sxzJgeT6tl3cw/3Ro5pHQfy+XVB2QiQoXc9KiDCDDTBD5bZ9vnhI4qSLlTWoYg VBPQ== X-Gm-Message-State: ACrzQf3sjVrTdNAMLg1ScA7tBcazWy04wBevQl257mGcLOjH/cInFHDH 4laXXSy2NfSpgbIHLgF/b82BHtJE0yVOlv/kF/iGrJh6OGE= X-Google-Smtp-Source: AMsMyM4dK3fnZCUA5c1fQMvyCktIltgMwN3CkBvP4kMDEuh7RBHauwy+DAcNzhq1yYa2vzo8QiAGjffqpWXC4sk8QWA= X-Received: by 2002:a05:620a:13f3:b0:6ee:92b9:fe2f with SMTP id h19-20020a05620a13f300b006ee92b9fe2fmr4470726qkl.477.1665768565362; Fri, 14 Oct 2022 10:29:25 -0700 (PDT) MIME-Version: 1.0 References: <7bac66be-535e-9051-d674-f2f5ba180e17@suse.com> In-Reply-To: <7bac66be-535e-9051-d674-f2f5ba180e17@suse.com> From: "H.J. Lu" Date: Fri, 14 Oct 2022 10:28:49 -0700 Message-ID: Subject: Re: [PATCH] x86: fold AVX512-VNNI disassembler entries with AVX-VNNI ones To: Jan Beulich Cc: Binutils , "Jiang, Haochen" , wwwhhhyyy Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3018.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, Oct 14, 2022 at 3:22 AM Jan Beulich wrote: > > Make %XV also print the separating blank in the VEX case, while making > it do nothing for EVEX-encoded insns. This way the AVX-VNNI entries > can be re-used for AVX512-VNNI, at the same time fixing the lack of > EVEX.W decoding. > > For the AVX-VNNI ones further make sure only VEX.66 forms are actually > decoded. > --- > Irrespective of this change I continue to disagree with the arbitrary > printing of "{vex}" for the AVX-VNNI insns: If that's meant for > disambiguation purposes, then EVEX-encoded insns not using EVEX-specific > functionality by having VEX counterparts (vaddps %xmm0, %xmm0, %xmm0) > should also be prefixed by "{evex}". This is done to match the assembler. There are 3 kinds of VNNI processors: 1. AVX512-VNNI only. 2. AVX-VNNI only. 3. AVX512-VNNI and AVX-VNNI. Since AVX512-VNNI came out first, all VNNI instructions without a prefix are encoded as AVX512-VNNI. The existing VNNI instructions without a prefix, generated by compiler or hand written, are encoded with EVEX. If one needs VNNI with VEX encoding, the {vex} prefix should be used. This applies to any AVX extensions which come after EVEX ones, including AVX-IFMA. > --- a/opcodes/i386-dis.c > +++ b/opcodes/i386-dis.c > @@ -1755,7 +1755,7 @@ struct dis386 { > "XD" => print 'd' if !EVEX or EVEX.W=1, EVEX.W=0 is not a valid encoding > "XH" => print 'h' if EVEX.W=0, EVEX.W=1 is not a valid encoding (for FP16) > "XS" => print 's' if !EVEX or EVEX.W=0, EVEX.W=1 is not a valid encoding > - "XV" => print "{vex3}" pseudo prefix > + "XV" => print "{vex} " pseudo prefix > "LQ" => print 'l' ('d' in Intel mode) or 'q' for memory operand, cond > being false, or no operand at all in 64bit mode, or if suffix_always > is true. > @@ -7545,19 +7545,19 @@ static const struct dis386 vex_w_table[] > }, > { > /* VEX_W_0F3850 */ > - { "%XV vpdpbusd", { XM, Vex, EXx }, 0 }, > + { "%XVvpdpbusd", { XM, Vex, EXx }, PREFIX_DATA }, > }, > { > /* VEX_W_0F3851 */ > - { "%XV vpdpbusds", { XM, Vex, EXx }, 0 }, > + { "%XVvpdpbusds", { XM, Vex, EXx }, PREFIX_DATA }, > }, > { > /* VEX_W_0F3852 */ > - { "%XV vpdpwssd", { XM, Vex, EXx }, 0 }, > + { "%XVvpdpwssd", { XM, Vex, EXx }, PREFIX_DATA }, > }, > { > /* VEX_W_0F3853 */ > - { "%XV vpdpwssds", { XM, Vex, EXx }, 0 }, > + { "%XVvpdpwssds", { XM, Vex, EXx }, PREFIX_DATA }, > }, > { > /* VEX_W_0F3858 */ > @@ -10711,22 +10711,29 @@ putop (instr_info *ins, const char *in_t > case 'V': > if (l == 0) > abort (); > - else if (l == 1 > - && (last[0] == 'L' || last[0] == 'X')) > + else if (l == 1) > { > - if (last[0] == 'X') > + switch (last[0]) > { > + case 'X': > + if (ins->vex.evex) > + break; > *ins->obufp++ = '{'; > *ins->obufp++ = 'v'; > *ins->obufp++ = 'e'; > *ins->obufp++ = 'x'; > *ins->obufp++ = '}'; > - } > - else if (ins->rex & REX_W) > - { > + *ins->obufp++ = ' '; > + break; > + case 'L': > + if (!(ins->rex & REX_W)) > + break; > *ins->obufp++ = 'a'; > *ins->obufp++ = 'b'; > *ins->obufp++ = 's'; > + break; > + default: > + abort (); > } > } > else > --- a/opcodes/i386-dis-evex.h > +++ b/opcodes/i386-dis-evex.h > @@ -383,8 +383,8 @@ static const struct dis386 evex_table[][ > { "vrsqrt14p%XW", { XM, EXx }, 0 }, > { "vrsqrt14s%XW", { XMScalar, VexScalar, EXdq }, PREFIX_DATA }, > /* 50 */ > - { "vpdpbusd", { XM, Vex, EXx }, PREFIX_DATA }, > - { "vpdpbusds", { XM, Vex, EXx }, PREFIX_DATA }, > + { VEX_W_TABLE (VEX_W_0F3850) }, > + { VEX_W_TABLE (VEX_W_0F3851) }, > { PREFIX_TABLE (PREFIX_EVEX_0F3852) }, > { PREFIX_TABLE (PREFIX_EVEX_0F3853) }, > { "vpopcnt%BW", { XM, EXx }, PREFIX_DATA }, > --- a/opcodes/i386-dis-evex-prefix.h > +++ b/opcodes/i386-dis-evex-prefix.h > @@ -233,14 +233,14 @@ > { > { Bad_Opcode }, > { "vdpbf16p%XS", { XM, Vex, EXx }, 0 }, > - { "vpdpwssd", { XM, Vex, EXx }, 0 }, > + { VEX_W_TABLE (VEX_W_0F3852) }, > { "vp4dpwssd", { XM, Vex, EXxmm }, 0 }, > }, > /* PREFIX_EVEX_0F3853 */ > { > { Bad_Opcode }, > { Bad_Opcode }, > - { "vpdpwssds", { XM, Vex, EXx }, 0 }, > + { VEX_W_TABLE (VEX_W_0F3853) }, > { "vp4dpwssds", { XM, Vex, EXxmm }, 0 }, > }, > /* PREFIX_EVEX_0F3868 */ OK. -- H.J.