This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Enable Intel RDPID instruction.


On Tue, May 3, 2016 at 5:05 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, May 3, 2016 at 3:26 AM, Alexander Fomin
> <afomin.mailbox@gmail.com> wrote:
>> Hi,
>> This patch enables Intel RDPID instruction.
>>
>> Please refer to Intel SDM Vol. 2 (r58) for details about the instruction
>> and corresponding CPUID.
>>
>> I've eliminated i386-init.h and i386-tbl.h from the patch as they were
>> just regenerated.
>>
>> Any objectionis?
>>
>> Alexander
>> ---
>> gas/
>>
>>         * doc/c-i386.texi: Document RDPID.
>>
>> gas/testsuite/
>>
>>         * gas/i386/i386.exp: Add RDPID tests.
>>         * gas/i386/prefix.d: Adjust.
>>         * gas/i386/rdpid.s: New test.
>>         * gas/i386/rdpid.d: Ditto.
>>         * gas/i386/rdpid-intel.d: Ditto.
>>         * gas/i386/x86-64-rdpid.s: Ditto.
>>         * gas/i386/x86-64-rdpid.d: Ditto.
>>         * gas/i386/x86-64-rdpid-intel.d: Ditto.
>>
>> opcodes/
>>
>>         * i386-dis.c (prefix_table): Add RDPID instruction.
>>         * i386-gen.c (cpu_flag_init): Add RDPID flag.
>>         (cpu_flags): Add RDPID bitfield.
>>         * i386-opc.h (enum): Add RDPID element.
>>         (i386_cpu_flags): Add RDPID field.
>>         * i386-opc.tbl: Add RDPID instruction.
>>         * i386-init.h: Regenerate.
>>         * i386-tbl.h: Regenerate.
>> ---
>>  gas/doc/c-i386.texi                         |     3 +-
>>  gas/testsuite/gas/i386/i386.exp             |     4 +
>>  gas/testsuite/gas/i386/prefix.d             |     3 +-
>>  gas/testsuite/gas/i386/rdpid-intel.d        |    11 +
>>  gas/testsuite/gas/i386/rdpid.d              |    11 +
>>  gas/testsuite/gas/i386/rdpid.s              |     5 +
>>  gas/testsuite/gas/i386/x86-64-rdpid-intel.d |    11 +
>>  gas/testsuite/gas/i386/x86-64-rdpid.d       |    11 +
>>  gas/testsuite/gas/i386/x86-64-rdpid.s       |     5 +
>>  opcodes/i386-dis.c                          |     2 +-
>>  opcodes/i386-gen.c                          |     3 +
>>  opcodes/i386-init.h                         |   223 +-
>>  opcodes/i386-opc.h                          |     3 +
>>  opcodes/i386-opc.tbl                        |     7 +
>>  opcodes/i386-tbl.h                          | 10791 +++++++++++++-------------
>>  15 files changed, 5656 insertions(+), 5437 deletions(-)
>>  create mode 100644 gas/testsuite/gas/i386/rdpid-intel.d
>>  create mode 100644 gas/testsuite/gas/i386/rdpid.d
>>  create mode 100644 gas/testsuite/gas/i386/rdpid.s
>>  create mode 100644 gas/testsuite/gas/i386/x86-64-rdpid-intel.d
>>  create mode 100644 gas/testsuite/gas/i386/x86-64-rdpid.d
>>  create mode 100644 gas/testsuite/gas/i386/x86-64-rdpid.s
>>
>> diff --git a/gas/doc/c-i386.texi b/gas/doc/c-i386.texi
>> index adbcb99..edd187b 100644
>> --- a/gas/doc/c-i386.texi
>> +++ b/gas/doc/c-i386.texi
>> @@ -153,6 +153,7 @@ accept various extension mnemonics.  For example,
>>  @code{smap},
>>  @code{mpx},
>>  @code{sha},
>> +@code{rdpid},
>>  @code{prefetchwt1},
>>  @code{clflushopt},
>>  @code{se1},
>> @@ -1173,7 +1174,7 @@ supported on the CPU specified.  The choices for @var{cpu_type} are:
>>  @item @samp{.3dnow} @tab @samp{.3dnowa} @tab @samp{.sse4a} @tab @samp{.sse5}
>>  @item @samp{.syscall} @tab @samp{.rdtscp} @tab @samp{.svme} @tab @samp{.abm}
>>  @item @samp{.lwp} @tab @samp{.fma4} @tab @samp{.xop} @tab @samp{.cx16}
>> -@item @samp{.padlock} @tab @samp{.clzero} @tab @samp{.mwaitx}
>> +@item @samp{.padlock} @tab @samp{.clzero} @tab @samp{.mwaitx} @tab @samp{.rdpid}
>>  @end multitable
>>
>>  Apart from the warning, there are only two other effects on
>> diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
>> index 9c4fdea..df1518b 100644
>> --- a/gas/testsuite/gas/i386/i386.exp
>> +++ b/gas/testsuite/gas/i386/i386.exp
>> @@ -346,6 +346,8 @@ if [expr ([istarget "i*86-*-*"] ||  [istarget "x86_64-*-*"]) && [gas_32_check]]
>>      run_dump_test "mwaitx-bdver4"
>>      run_list_test "mwaitx-reg"
>>      run_dump_test "ospke"
>> +    run_dump_test "rdpid"
>> +    run_dump_test "rdpid-intel"
>>
>>      # These tests require support for 8 and 16 bit relocs,
>>      # so we only run them for ELF and COFF targets.
>> @@ -737,6 +739,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
>>      run_dump_test "x86-64-mwaitx-bdver4"
>>      run_list_test "x86-64-mwaitx-reg"
>>      run_dump_test "x86-64-ospke"
>> +    run_dump_test "x86-64-rdpid"
>> +    run_dump_test "x86-64-rdpid-intel"
>>      run_dump_test "x86-64-fence-as-lock-add-yes"
>>      run_dump_test "x86-64-fence-as-lock-add-no"
>>
>> diff --git a/gas/testsuite/gas/i386/prefix.d b/gas/testsuite/gas/i386/prefix.d
>> index 7afb0c1..8dd200b 100644
>> --- a/gas/testsuite/gas/i386/prefix.d
>> +++ b/gas/testsuite/gas/i386/prefix.d
>> @@ -63,8 +63,7 @@ Disassembly of section .text:
>>  [      ]*[a-f0-9]+:    f3 f0 66 3e 36 90       lock data16 ds ss pause
>>  [      ]*[a-f0-9]+:    f3 f2 67 3e 36 90       repz repnz addr16 ds ss nop
>>  [      ]*[a-f0-9]+:    f3 67 f2 66 3e 36 90    repz addr16 repnz ds ss xchg %ax,%ax
>> -[      ]*[a-f0-9]+:    f3 0f c7                \(bad\)
>> -[      ]*[a-f0-9]+:    f8                      clc
>> +[      ]*[a-f0-9]+:    f3 0f c7 f8             rdpid  %eax
>>  [      ]*[a-f0-9]+:    90                      nop
>>  [      ]*[a-f0-9]+:    f3 0f c7                \(bad\)
>>  [      ]*[a-f0-9]+:    f0 90                   lock nop
>> diff --git a/gas/testsuite/gas/i386/rdpid-intel.d b/gas/testsuite/gas/i386/rdpid-intel.d
>> new file mode 100644
>> index 0000000..f733b17
>> --- /dev/null
>> +++ b/gas/testsuite/gas/i386/rdpid-intel.d
>> @@ -0,0 +1,11 @@
>> +#objdump: -dwMintel
>> +#name: i386 RDPID (Intel disassembly)
>> +#source: rdpid.s
>> +
>> +.*: +file format .*
>> +
>> +Disassembly of section .text:
>> +
>> +0+ <_start>:
>> +[      ]*[a-f0-9]+:[   ]*f3 0f c7 f8[  ]*rdpid  eax
>> +#pass
>> diff --git a/gas/testsuite/gas/i386/rdpid.d b/gas/testsuite/gas/i386/rdpid.d
>> new file mode 100644
>> index 0000000..ef67c84
>> --- /dev/null
>> +++ b/gas/testsuite/gas/i386/rdpid.d
>> @@ -0,0 +1,11 @@
>> +#objdump: -dw
>> +#name: i386 RDPID insns
>> +
>> +.*: +file format .*
>> +
>> +
>> +Disassembly of section .text:
>> +
>> +0+ <_start>:
>> +[      ]*[a-f0-9]+:[   ]*f3 0f c7 f8[  ]*rdpid  %eax
>> +#pass
>> diff --git a/gas/testsuite/gas/i386/rdpid.s b/gas/testsuite/gas/i386/rdpid.s
>> new file mode 100644
>> index 0000000..fe6e401
>> --- /dev/null
>> +++ b/gas/testsuite/gas/i386/rdpid.s
>> @@ -0,0 +1,5 @@
>> +# Check 32bit RDPID instructions.
>> +
>> +       .text
>> +_start:
>> +       rdpid %eax
>> diff --git a/gas/testsuite/gas/i386/x86-64-rdpid-intel.d b/gas/testsuite/gas/i386/x86-64-rdpid-intel.d
>> new file mode 100644
>> index 0000000..df695ca
>> --- /dev/null
>> +++ b/gas/testsuite/gas/i386/x86-64-rdpid-intel.d
>> @@ -0,0 +1,11 @@
>> +#objdump: -dwMintel
>> +#name: x86_64 RDPID (Intel disassembly)
>> +#source: x86-64-rdpid.s
>> +
>> +.*: +file format .*
>> +
>> +Disassembly of section .text:
>> +
>> +0+ <_start>:
>> +[      ]*[a-f0-9]+:[   ]*f3 48 0f c7 f8[       ]*rdpid  rax
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> rdpid doesn't need the REX prefix.

Please add a testcase for %r10.


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]