From 913f377d4362f2910b803d59bc1749c289e69bef Mon Sep 17 00:00:00 2001 From: Igor Tsimbalist Date: Mon, 15 Jan 2018 19:21:32 +0300 Subject: [PATCH 1/2] Enable WBNOINVD instruction. gas/ * config/tc-i386.c (cpu_arch): Add .wbnoinvd. * doc/c-i386.texi: Document .wbnoinvd. * testsuite/gas/i386/i386.exp: Add WBNOINVD tests. * testsuite/gas/i386/wbnoinvd-intel.d: New test. * testsuite/gas/i386/wbnoinvd.d: Likewise. * testsuite/gas/i386/wbnoinvd.s: Likewise. * testsuite/gas/i386/x86-64-wbnoinvd-intel.d: Likewise. * testsuite/gas/i386/x86-64-wbnoinvd.d: Likewise. * testsuite/gas/i386/x86-64-wbnoinvd.s: Likewise. opcodes/ * i386-dis.c (enum): Add PREFIX_0F09. * i386-gen.c (cpu_flag_init): Add CPU_WBNOINVD_FLAGS. (cpu_flags): Add CpuWBNOINVD. * i386-opc.h (enum): Add CpuWBNOINVD. (i386_cpu_flags): Add cpuwbnoinvd. * i386-opc.tbl: Add WBNOINVD instruction. * i386-init.h: Regenerate. * i386-tbl.h: Likewise. --- gas/ChangeLog | 12 + gas/config/tc-i386.c | 2 + gas/doc/c-i386.texi | 2 + gas/testsuite/gas/i386/i386.exp | 4 + gas/testsuite/gas/i386/wbnoinvd-intel.d | 11 + gas/testsuite/gas/i386/wbnoinvd.d | 11 + gas/testsuite/gas/i386/wbnoinvd.s | 5 + gas/testsuite/gas/i386/x86-64-wbnoinvd-intel.d | 11 + gas/testsuite/gas/i386/x86-64-wbnoinvd.d | 11 + gas/testsuite/gas/i386/x86-64-wbnoinvd.s | 5 + opcodes/ChangeLog | 11 + opcodes/i386-dis.c | 9 +- opcodes/i386-gen.c | 3 + opcodes/i386-init.h | 408 +- opcodes/i386-opc.h | 3 + opcodes/i386-opc.tbl | 6 + opcodes/i386-tbl.h | 10572 ++++++++++++----------- 17 files changed, 5606 insertions(+), 5480 deletions(-) create mode 100644 gas/testsuite/gas/i386/wbnoinvd-intel.d create mode 100644 gas/testsuite/gas/i386/wbnoinvd.d create mode 100644 gas/testsuite/gas/i386/wbnoinvd.s create mode 100644 gas/testsuite/gas/i386/x86-64-wbnoinvd-intel.d create mode 100644 gas/testsuite/gas/i386/x86-64-wbnoinvd.d create mode 100644 gas/testsuite/gas/i386/x86-64-wbnoinvd.s diff --git a/gas/ChangeLog b/gas/ChangeLog index 4166359..65778fe 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,15 @@ +2018-01-23 Igor Tsimbalist + + * config/tc-i386.c (cpu_arch): Add .wbnoinvd. + * doc/c-i386.texi: Document .wbnoinvd. + * testsuite/gas/i386/i386.exp: Add WBNOINVD tests. + * testsuite/gas/i386/wbnoinvd-intel.d: New test. + * testsuite/gas/i386/wbnoinvd.d: Likewise. + * testsuite/gas/i386/wbnoinvd.s: Likewise. + * testsuite/gas/i386/x86-64-wbnoinvd-intel.d: Likewise. + * testsuite/gas/i386/x86-64-wbnoinvd.d: Likewise. + * testsuite/gas/i386/x86-64-wbnoinvd.s: Likewise. + 2018-01-15 Nick Clifton * po/uk.po: Updated Ukranian translation. diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 5cd83da..af06cac 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -1005,6 +1005,8 @@ static const arch_entry cpu_arch[] = CPU_VAES_FLAGS, 0 }, { STRING_COMMA_LEN (".vpclmulqdq"), PROCESSOR_UNKNOWN, CPU_VPCLMULQDQ_FLAGS, 0 }, + { STRING_COMMA_LEN (".wbnoinvd"), PROCESSOR_UNKNOWN, + CPU_WBNOINVD_FLAGS, 0 }, }; static const noarch_entry cpu_noarch[] = diff --git a/gas/doc/c-i386.texi b/gas/doc/c-i386.texi index e500e7c..19d92a7 100644 --- a/gas/doc/c-i386.texi +++ b/gas/doc/c-i386.texi @@ -229,6 +229,7 @@ accept various extension mnemonics. For example, @code{clflush}, @code{mwaitx}, @code{clzero}, +@code{wbnoinvd}, @code{lwp}, @code{fma4}, @code{xop}, @@ -1240,6 +1241,7 @@ supported on the CPU specified. The choices for @var{cpu_type} are: @item @samp{.avx512_vpopcntdq} @tab @samp{.avx512_vbmi2} @tab @samp{.avx512_vnni} @item @samp{.avx512_bitalg} @item @samp{.clwb} @tab @samp{.rdpid} @tab @samp{.ptwrite} @tab @item @samp{.cet} +@item @samp{.wbnoinvd} @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} diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index 184c65e..5cc969b 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -413,6 +413,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] run_dump_test "vaes-intel" run_dump_test "vpclmulqdq" run_dump_test "vpclmulqdq-intel" + run_dump_test "wbnoinvd" + run_dump_test "wbnoinvd-intel" run_list_test "avx512vl-1" "-al" run_list_test "avx512vl-2" "-al" run_dump_test "fpu-bad" @@ -878,6 +880,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t run_dump_test "x86-64-vaes-intel" run_dump_test "x86-64-vpclmulqdq" run_dump_test "x86-64-vpclmulqdq-intel" + run_dump_test "x86-64-wbnoinvd" + run_dump_test "x86-64-wbnoinvd-intel" run_dump_test "x86-64-fence-as-lock-add-yes" run_dump_test "x86-64-fence-as-lock-add-no" run_dump_test "x86-64-pr20141" diff --git a/gas/testsuite/gas/i386/wbnoinvd-intel.d b/gas/testsuite/gas/i386/wbnoinvd-intel.d new file mode 100644 index 0000000..34d390e --- /dev/null +++ b/gas/testsuite/gas/i386/wbnoinvd-intel.d @@ -0,0 +1,11 @@ +#objdump: -dwMintel +#name: i386 WBNOINVD (Intel disassembly) +#source: wbnoinvd.s + +.*: +file format .* + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+:[ ]*f3 0f 09[ ]*wbnoinvd[ ]* +#pass diff --git a/gas/testsuite/gas/i386/wbnoinvd.d b/gas/testsuite/gas/i386/wbnoinvd.d new file mode 100644 index 0000000..051b3d0 --- /dev/null +++ b/gas/testsuite/gas/i386/wbnoinvd.d @@ -0,0 +1,11 @@ +#objdump: -dw +#name: i386 WBNOINVD insn + +.*: +file format .* + + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+:[ ]*f3 0f 09[ ]*wbnoinvd[ ]* +#pass diff --git a/gas/testsuite/gas/i386/wbnoinvd.s b/gas/testsuite/gas/i386/wbnoinvd.s new file mode 100644 index 0000000..28f9ae3 --- /dev/null +++ b/gas/testsuite/gas/i386/wbnoinvd.s @@ -0,0 +1,5 @@ +# Check 32bit WBNOINVD instructions. + + .text +_start: + wbnoinvd diff --git a/gas/testsuite/gas/i386/x86-64-wbnoinvd-intel.d b/gas/testsuite/gas/i386/x86-64-wbnoinvd-intel.d new file mode 100644 index 0000000..34d390e --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-wbnoinvd-intel.d @@ -0,0 +1,11 @@ +#objdump: -dwMintel +#name: i386 WBNOINVD (Intel disassembly) +#source: wbnoinvd.s + +.*: +file format .* + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+:[ ]*f3 0f 09[ ]*wbnoinvd[ ]* +#pass diff --git a/gas/testsuite/gas/i386/x86-64-wbnoinvd.d b/gas/testsuite/gas/i386/x86-64-wbnoinvd.d new file mode 100644 index 0000000..051b3d0 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-wbnoinvd.d @@ -0,0 +1,11 @@ +#objdump: -dw +#name: i386 WBNOINVD insn + +.*: +file format .* + + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+:[ ]*f3 0f 09[ ]*wbnoinvd[ ]* +#pass diff --git a/gas/testsuite/gas/i386/x86-64-wbnoinvd.s b/gas/testsuite/gas/i386/x86-64-wbnoinvd.s new file mode 100644 index 0000000..c0359bf --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-wbnoinvd.s @@ -0,0 +1,5 @@ +# Check 64bit WBNOINVD instructions. + + .text +_start: + wbnoinvd diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index d889c45..468c376 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,14 @@ +2018-01-23 Igor Tsimbalist + + * i386-dis.c (enum): Add PREFIX_0F09. + * i386-gen.c (cpu_flag_init): Add CPU_WBNOINVD_FLAGS. + (cpu_flags): Add CpuWBNOINVD. + * i386-opc.h (enum): Add CpuWBNOINVD. + (i386_cpu_flags): Add cpuwbnoinvd. + * i386-opc.tbl: Add WBNOINVD instruction. + * i386-init.h: Regenerate. + * i386-tbl.h: Likewise. + 2018-01-15 Nick Clifton * po/uk.po: Updated Ukranian translation. diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c index 86a2cdd..6154924 100644 --- a/opcodes/i386-dis.c +++ b/opcodes/i386-dis.c @@ -956,6 +956,7 @@ enum PREFIX_MOD_0_0F01_REG_5, PREFIX_MOD_3_0F01_REG_5_RM_0, PREFIX_MOD_3_0F01_REG_5_RM_2, + PREFIX_0F09, PREFIX_0F10, PREFIX_0F11, PREFIX_0F12, @@ -2869,7 +2870,7 @@ static const struct dis386 dis386_twobyte[] = { { "sysret%LP", { XX }, 0 }, /* 08 */ { "invd", { XX }, 0 }, - { "wbinvd", { XX }, 0 }, + { PREFIX_TABLE (PREFIX_0F09) }, { Bad_Opcode }, { "ud2", { XX }, 0 }, { Bad_Opcode }, @@ -3840,6 +3841,12 @@ static const struct dis386 prefix_table[][4] = { { "saveprevssp", { Skip_MODRM }, PREFIX_OPCODE }, }, + /* PREFIX_0F09 */ + { + { "wbinvd", { XX }, 0 }, + { "wbnoinvd", { XX }, 0 }, + }, + /* PREFIX_0F10 */ { { "movups", { XM, EXx }, PREFIX_OPCODE }, diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c index d193278..729ba18 100644 --- a/opcodes/i386-gen.c +++ b/opcodes/i386-gen.c @@ -277,6 +277,8 @@ static initializer cpu_flag_init[] = "CpuVAES" }, { "CPU_VPCLMULQDQ_FLAGS", "CpuVPCLMULQDQ" }, + { "CPU_WBNOINVD_FLAGS", + "CpuWBNOINVD" }, { "CPU_ANY_X87_FLAGS", "CPU_ANY_287_FLAGS|Cpu8087" }, { "CPU_ANY_287_FLAGS", @@ -562,6 +564,7 @@ static bitfield cpu_flags[] = BITFIELD (CpuGFNI), BITFIELD (CpuVAES), BITFIELD (CpuVPCLMULQDQ), + BITFIELD (CpuWBNOINVD), BITFIELD (CpuRegMMX), BITFIELD (CpuRegXMM), BITFIELD (CpuRegYMM), diff --git a/opcodes/i386-opc.h b/opcodes/i386-opc.h index 57482ab..1d0fd06 100644 --- a/opcodes/i386-opc.h +++ b/opcodes/i386-opc.h @@ -222,6 +222,8 @@ enum CpuVAES, /* VPCLMULQDQ instructions required */ CpuVPCLMULQDQ, + /* WBNOINVD instructions required */ + CpuWBNOINVD, /* MMX register support required */ CpuRegMMX, /* XMM register support required */ @@ -350,6 +352,7 @@ typedef union i386_cpu_flags unsigned int cpugfni:1; unsigned int cpuvaes:1; unsigned int cpuvpclmulqdq:1; + unsigned int cpuwbnoinvd:1; unsigned int cpuregmmx:1; unsigned int cpuregxmm:1; unsigned int cpuregymm:1; diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl index 4c24771..01d1aa2 100644 --- a/opcodes/i386-opc.tbl +++ b/opcodes/i386-opc.tbl @@ -6133,3 +6133,9 @@ endbr32, 0, 0xf30f1efb, None, 3, CpuCET, IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_s notrack, 0, 0x3e, None, 1, CpuCET, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|IsPrefix, { 0 } // CET instructions end. + +// WBNOINVD instruction. + +wbnoinvd, 0, 0xf30f09, None, 2, CpuWBNOINVD, No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 } + +// WBNOINVD instruction end. -- 1.8.3.1