From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id ED5BC3858412 for ; Mon, 24 Oct 2022 19:14:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ED5BC3858412 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-lj1-x22f.google.com with SMTP id bx35so8019050ljb.2 for ; Mon, 24 Oct 2022 12:14:55 -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=E2Vxc2cEasB/JyW1rHkHBhSI43nEkV8c+z/h2zUafY0=; b=GtaBfCK+eqcwm3dXpjKygquGbyK1rAzzs6Pm31G9AH/qf11gGX/SIkCm6to1HJnpKi zhDbPJhVWKjoYa+FOIkgiinW0XV4lEz6asgioNz3xnIKifFnAO0XAUV2V/CnDscEFJlL 5F6giNItUudmUKH8SGniFIilOWSqSgPTfANn+IYFRskM9g/Oq7oOrz0Aw3qCAjL10zUJ WYd9+Rn+tM+73guz/HoAN6oHNFDMTlbwy8FUDH/IVjIC2iTDUpi4SbJnWUzPiVxf103R MU+HS+LYnRI4n+19xOZcNJkos1H0kOGblrGx0L+BmiFfHWSzMNn3Vw7TBDVu+Dz/6gqm ZWwQ== 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=E2Vxc2cEasB/JyW1rHkHBhSI43nEkV8c+z/h2zUafY0=; b=dXL9xllDC4JunLZ29WahPQXlqedKdL5WY7JC8JysxT4RqNmqT7StMsoa+oRM63dp09 SBnyTYQseccFI0E6oW/6/9gRSnewAIPzKhfQz+r+TjK4RTxRiVCo4PHj2g784+oQV51v I/uWMaEGBwpL/UninW3pzBfWqbAifqqlBjARKMig+5w6owgYxFLe9B7q2Kg8+kgwf0LP YuSMsJC6TOtNIpQHZ3fkFF2HVVEdhX3bWnkGzJenJOf673CV4qHdNs3lHqdAQr8of1SP Ih2s2wkzAr0mvtZyNmxF1L/xw9bdcfuEqHASpo2t3iLxV6mAUyFgr2ljFw7dLonOZdNy 3i2w== X-Gm-Message-State: ACrzQf0HO/Scni9+CmRo4/IXjsAiJkCQBbmMdzcf76n1GQBJaFPA8dMU iFKoMYjIlR92y9mOacqHh3aBetAgVj36fXZbEcg= X-Google-Smtp-Source: AMsMyM63iRiuUMu1qLS+q6NL08SBfi8MUysdF3fCzA9GVx6Izwz7qn+vkuq152wYf3kB66PEjzFfMnJdgWmfXiDEiOU= X-Received: by 2002:a2e:a1c8:0:b0:261:e4e5:1cc3 with SMTP id c8-20020a2ea1c8000000b00261e4e51cc3mr13425326ljm.248.1666638894425; Mon, 24 Oct 2022 12:14:54 -0700 (PDT) MIME-Version: 1.0 References: <20221014091248.4920-1-haochen.jiang@intel.com> <20221014091248.4920-8-haochen.jiang@intel.com> <180b7336-c2f5-3c65-fea6-d891c57c9ff8@suse.com> In-Reply-To: From: "H.J. Lu" Date: Mon, 24 Oct 2022 12:14:18 -0700 Message-ID: Subject: Re: [PATCH 07/10] Support Intel WRMSRNS To: "Jiang, Haochen" Cc: "Beulich, Jan" , "Hu, Lin1" , "binutils@sourceware.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3017.1 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 Sun, Oct 23, 2022 at 10:56 PM Jiang, Haochen wrote: > > > -----Original Message----- > > From: Jan Beulich > > Sent: Monday, October 17, 2022 3:18 PM > > To: Jiang, Haochen > > Cc: hjl.tools@gmail.com; Hu, Lin1 ; > > binutils@sourceware.org > > Subject: Re: [PATCH 07/10] Support Intel WRMSRNS > > > > On 14.10.2022 11:12, Haochen Jiang wrote: > > > --- a/gas/config/tc-i386.c > > > +++ b/gas/config/tc-i386.c > > > @@ -1099,6 +1099,7 @@ static const arch_entry cpu_arch[] = > > > SUBARCH (avx_ne_convert, AVX_NE_CONVERT, ANY_AVX_NE_CONVERT, > > false), > > > SUBARCH (cmpccxadd, CMPCCXADD, ANY_CMPCCXADD, false), > > > SUBARCH (raoint, RAOINT, ANY_RAOINT, false), > > > + SUBARCH (wrmsrns, WRMSRNS, ANY_WRMSRNS, false), > > > > As for some of the earlier patches - no need for ANY_WRMSRNS afaics. > > Done. Please also remove CPU_ANY_WRMSRNS_FLAGS since it isn't used. > > > > > --- /dev/null > > > +++ b/gas/testsuite/gas/i386/wrmsrns.s > > > @@ -0,0 +1,9 @@ > > > +# Check WRMSRNS instructions > > > + > > > + .allow_index_reg > > > > Nit: Why? > > Removed since there is no register usage. > > > > > > --- a/gas/testsuite/gas/i386/x86-64-lockbad-1.l > > > +++ b/gas/testsuite/gas/i386/x86-64-lockbad-1.l > > > @@ -36,9 +36,9 @@ > > > .*:41: Error: .* > > > .*:42: Error: .* > > > .*:43: Error: .* > > > -.*:46: Error: .* > > > +.*:44: Error: .* > > > .*:47: Error: .* > > > -.*:49: Error: .* > > > +.*:48: Error: .* > > > .*:50: Error: .* > > > .*:51: Error: .* > > > .*:52: Error: .* > > > @@ -66,13 +66,15 @@ > > > .*:74: Error: .* > > > .*:75: Error: .* > > > .*:76: Error: .* > > > -.*:78: Error: .* > > > +.*:77: Error: .* > > > .*:79: Error: .* > > > .*:80: Error: .* > > > .*:81: Error: .* > > > .*:82: Error: .* > > > .*:83: Error: .* > > > .*:84: Error: .* > > > +.*:85: Error: .* > > > +.*:86: Error: .* > > > GAS LISTING .* > > > > While for the diagnostics line numbers matter, ... > > > > > @@ -119,47 +121,49 @@ GAS LISTING .* > > > [ ]*41[ ]+lock sbb \(%rbx\), %eax > > > [ ]*42[ ]+lock sub \(%rbx\), %eax > > > [ ]*43[ ]+lock xor \(%rbx\), %eax > > > -[ ]*44[ ]+ > > > -[ ]*45[ ]+\.intel_syntax noprefix > > > -[ ]*46[ ]+lock mov eax,ebx > > > -[ ]*47[ ]+lock mov eax,DWORD PTR \[rbx\] > > > -[ ]*48[ ]+ > > > -[ ]*49[ ]+lock add eax,ebx > > > -[ ]*50[ ]+lock add ebx,0x64 > > > -[ ]*51[ ]+lock adc eax,ebx > > > -[ ]*52[ ]+lock adc ebx,0x64 > > > -[ ]*53[ ]+lock and eax,ebx > > > -[ ]*54[ ]+lock and ebx,0x64 > > > -[ ]*55[ ]+lock btc ebx,eax > > > -[ ]*56[ ]+lock btc ebx,0x64 > > > -[ ]*57[ ]+lock btr ebx,eax > > > +[ ]*44[ ]+lock wrmsrns > > > +[ ]*45[ ]+ > > > +[ ]*46[ ]+\.intel_syntax noprefix > > > +[ ]*47[ ]+lock mov eax,ebx > > > +[ ]*48[ ]+lock mov eax,DWORD PTR \[rbx\] > > > +[ ]*49[ ]+ > > > +[ ]*50[ ]+lock add eax,ebx > > > +[ ]*51[ ]+lock add ebx,0x64 > > > +[ ]*52[ ]+lock adc eax,ebx > > > +[ ]*53[ ]+lock adc ebx,0x64 > > > +[ ]*54[ ]+lock and eax,ebx > > > +[ ]*55[ ]+lock and ebx,0x64 > > > +[ ]*56[ ]+lock btc ebx,eax > > > +[ ]*57[ ]+lock btc ebx,0x64 > > > > > > > GAS LISTING .* > > > > .. please abstract away line numbers (see many other testcases) rather than > > updating them here. > > > > > --- a/gas/testsuite/gas/i386/x86-64-lockbad-1.s > > > +++ b/gas/testsuite/gas/i386/x86-64-lockbad-1.s > > > @@ -41,6 +41,7 @@ foo: > > > lock sbb (%rbx), %eax > > > lock sub (%rbx), %eax > > > lock xor (%rbx), %eax > > > + lock wrmsrns > > > > I wonder whether this is really necessary. If you limited yourself to ... > > > > > .intel_syntax noprefix > > > lock mov eax,ebx > > > @@ -82,3 +83,4 @@ foo: > > > lock sbb eax,DWORD PTR [rbx] > > > lock sub eax,DWORD PTR [rbx] > > > lock xor eax,DWORD PTR [rbx] > > > + lock wrmsrns > > > > ... this addition (which already seems excessive, as we don't test the majority of > > insns here anyway), the overall diff to the testcase would end up much smaller. > > We removed the lockbad testcases here since most of insts are lockbad. > > > > > > --- /dev/null > > > +++ b/gas/testsuite/gas/i386/x86-64-wrmsrns-intel.d > > > @@ -0,0 +1,12 @@ > > > +#as: > > > +#objdump: -dw -Mintel > > > +#name: x86_64 WRMSRNS insns (Intel disassembly) > > > +#source: wrmsrns.s > > > > It's not just the source which can be shared here, but also the output > > expectations. > > I get your point. But how to share here? > > > > > > --- a/opcodes/i386-opc.tbl > > > +++ b/opcodes/i386-opc.tbl > > > @@ -3326,3 +3326,9 @@ aor, 0xf20f38fc, None, CpuRAOINT, > > > Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_ld > > > axor, 0xf30f38fc, None, CpuRAOINT, > > > Modrm|IgnoreSize|No_bSuf|No_wSuf|No_sSuf|No_ldSuf,{ Reg32|Reg64, > > > Dword|Qword|Unspecified|BaseIndex} > > > > > > // RAOINT instructions end. > > > + > > > +// WRMSRNS instructions. > > > + > > > +wrmsrns, 0x0f01c6, None, CpuWRMSRNS, > > > +No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, {} > > > + > > > +// WRMSRNS instructions end. > > > > Nit: Use singular in the comments? > > Done. > > Haochen > > > > Jan -- H.J.