[PATCH 07/10] Support Intel WRMSRNS

Jiang, Haochen haochen.jiang@intel.com
Mon Oct 24 05:56:06 GMT 2022


> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Monday, October 17, 2022 3:18 PM
> To: Jiang, Haochen <haochen.jiang@intel.com>
> Cc: hjl.tools@gmail.com; Hu, Lin1 <lin1.hu@intel.com>;
> 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.

> 
> > --- /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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-Support-Intel-WRMSRNS.patch
Type: application/octet-stream
Size: 10076 bytes
Desc: 0007-Support-Intel-WRMSRNS.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20221024/b220e0b2/attachment-0001.obj>


More information about the Binutils mailing list