[PATCH] x86: Support x86 USER_DOITM/SUP_DOITM instructions
Haochen Jiang
haochen.jiang@intel.com
Mon Nov 16 08:00:06 GMT 2026
Hi all,
There are several new ISAs disclosed last week. USER_DOITM and SUP_DOITM
info is in a separate documenation. Its documentation is here:
https://www.intel.com/content/www/us/en/content-details/932747/user-doitm-and-sup-doitm-extensions-architecture-specification.html
Ok for trunk?
Opens: The two cpuids are sharing the same instructions under user mode
and supervisior mode. It seems to me that for assembler and disassembler,
we do not need to distinguish that mode. So I choose to use .doitm switch
to control the instructions to avoid confusion. Is there a better proposal?
Thx,
Haochen
---
USER_DOITM and SUP_DOITM info could be found here:
https://www.intel.com/content/www/us/en/content-details/932747/user-doitm-and-sup-doitm-extensions-architecture-specification.html
USER_DOITM and SUP_DOITM are sharing the same instructions
under user mode and supervisor mode. We will use .doitm
switch for both of them.
gas/ChangeLog:
* NEWS: Mention USER_DOITM/SUP_DOITM support.
* config/tc-i386.c: Add doitm.
* doc/c-i386.texi: Ditto.
* testsuite/gas/i386/nops-8.d: Modify nop output due
to USER_DOITM/SUP_DOITM.
* testsuite/gas/i386/i386.exp: Run DOITM tests.
* testsuite/gas/i386/x86-64.exp: Ditto.
* testsuite/gas/i386/doitm-intel.d: New test.
* testsuite/gas/i386/doitm.d: Ditto.
* testsuite/gas/i386/doitm.s: Ditto.
* testsuite/gas/i386/x86-64-doitm-intel.d: Ditto.
* testsuite/gas/i386/x86-64-doitm.d: Ditto.
* testsuite/gas/i386/x86-64-doitm.s: Ditto.
opcodes/ChangeLog:
* i386-dis.c (REG_0F1E_P_3_MOD_3): New.
(MOD_0F1E_PREFIX_3): Ditto.
(REG_0F1E_P_1_MOD_3): Add rddoitm.
(PREFIX_0F1E): Modify entry for doitm.
(RM_0F1E_P_1_MOD_3_REG_7): Modify entry for setdoitm.
* i386-gen.c: Add DOITM.
* i386-opc.h: Ditto.
* i386-opc.tbl: Add USER_DOITM/SUP_DOITM instructions.
* i386-init.h: Regenerated.
* i386-mnem.h: Ditto.
* i386-tbl.h: Ditto.
---
gas/NEWS | 2 +
gas/config/tc-i386.c | 1 +
gas/doc/c-i386.texi | 3 +-
gas/testsuite/gas/i386/doitm-intel.d | 14 +
gas/testsuite/gas/i386/doitm.d | 12 +
gas/testsuite/gas/i386/doitm.s | 13 +
gas/testsuite/gas/i386/i386.exp | 2 +
gas/testsuite/gas/i386/nops-8.d | 34 +-
gas/testsuite/gas/i386/x86-64-doitm-intel.d | 18 +
gas/testsuite/gas/i386/x86-64-doitm.d | 16 +
gas/testsuite/gas/i386/x86-64-doitm.s | 21 +
gas/testsuite/gas/i386/x86-64.exp | 2 +
opcodes/i386-dis.c | 24 +-
opcodes/i386-gen.c | 1 +
opcodes/i386-init.h | 929 ++++-----
opcodes/i386-mnem.h | 2055 ++++++++++---------
opcodes/i386-opc.h | 3 +
opcodes/i386-opc.tbl | 8 +
opcodes/i386-tbl.h | 1263 ++++++------
19 files changed, 2296 insertions(+), 2125 deletions(-)
create mode 100644 gas/testsuite/gas/i386/doitm-intel.d
create mode 100644 gas/testsuite/gas/i386/doitm.d
create mode 100644 gas/testsuite/gas/i386/doitm.s
create mode 100644 gas/testsuite/gas/i386/x86-64-doitm-intel.d
create mode 100644 gas/testsuite/gas/i386/x86-64-doitm.d
create mode 100644 gas/testsuite/gas/i386/x86-64-doitm.s
diff --git a/gas/NEWS b/gas/NEWS
index e28d66e6150..c50ef7cc609 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -1,5 +1,7 @@
-*- text -*-
+* Add support for the x86 USER_DOITM/SUP_DOITM instructions.
+
* Add support for the x86 AVX10_VPMLDSABFLYDQ instructions.
* Add support for the x86 ACE V1 instructions.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index fa2117fa27f..034afeaa27b 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1275,6 +1275,7 @@ static const arch_entry cpu_arch[] =
SUBARCH (movrs, MOVRS, MOVRS, false),
VECARCH (avx10_vpmldsabflydq, AVX10_VPMLDSABFLYDQ, ANY_AVX10_VPMLDSABFLYDQ,
reset),
+ SUBARCH (doitm, DOITM, DOITM, false),
};
#undef SUBARCH
diff --git a/gas/doc/c-i386.texi b/gas/doc/c-i386.texi
index 050d2d7a54b..b2e872c14a8 100644
--- a/gas/doc/c-i386.texi
+++ b/gas/doc/c-i386.texi
@@ -236,6 +236,7 @@ accept various extension mnemonics. For example,
@code{avx10v2aux},
@code{movrs},
@code{avx10_vpmldsabflydq},
+@code{doitm},
@code{amx_int8},
@code{amx_bf16},
@code{amx_fp16},
@@ -1736,7 +1737,7 @@ supported on the CPU specified. The choices for @var{cpu_type} are:
@item @samp{.avx_vnni_int16} @tab @samp{.sha512} @tab @samp{.sm3} @tab @samp{.sm4}
@item @samp{.pbndkb} @tab @samp{.user_msr} @tab @samp{.msr_imm}
@item @samp{.avx_ifma} @tab @samp{.avx_vnni_int8} @tab @samp{.movrs}
-@item @samp{.avx10_vpmldsabflydq}
+@item @samp{.avx10_vpmldsabflydq} @tab @samp{.doitm}
@item @samp{.wbnoinvd} @tab @samp{.pconfig} @tab @samp{.waitpkg} @tab @samp{.cldemote}
@item @samp{.shstk} @tab @samp{.gfni} @tab @samp{.vaes} @tab @samp{.vpclmulqdq}
@item @samp{.movdiri} @tab @samp{.movdir64b} @tab @samp{.enqcmd} @tab @samp{.tsxldtrk}
diff --git a/gas/testsuite/gas/i386/doitm-intel.d b/gas/testsuite/gas/i386/doitm-intel.d
new file mode 100644
index 00000000000..e55cf1a24e4
--- /dev/null
+++ b/gas/testsuite/gas/i386/doitm-intel.d
@@ -0,0 +1,14 @@
+#objdump: -dw -Mintel
+#name: i386 DOITM insns (Intel disassembly)
+#source: doitm.s
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+#...
+[a-f0-9]+ <_intel>:
+[ ]*[a-f0-9]+:[ ]*f3 0f 1e f0[ ]*rddoitm eax
+[ ]*[a-f0-9]+:[ ]*f3 0f 1e fc[ ]*setdoitm
+[ ]*[a-f0-9]+:[ ]*f2 0f 1e f3[ ]*wrdoitm ebx
+#pass
diff --git a/gas/testsuite/gas/i386/doitm.d b/gas/testsuite/gas/i386/doitm.d
new file mode 100644
index 00000000000..15ce4b72081
--- /dev/null
+++ b/gas/testsuite/gas/i386/doitm.d
@@ -0,0 +1,12 @@
+#objdump: -dw
+#name: i386 DOITM insns
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+0+ <_start>:
+[ ]*[a-f0-9]+:[ ]*f3 0f 1e f0[ ]*rddoitm %eax
+[ ]*[a-f0-9]+:[ ]*f3 0f 1e fc[ ]*setdoitm
+[ ]*[a-f0-9]+:[ ]*f2 0f 1e f3[ ]*wrdoitm %ebx
+#pass
diff --git a/gas/testsuite/gas/i386/doitm.s b/gas/testsuite/gas/i386/doitm.s
new file mode 100644
index 00000000000..962c2e066e9
--- /dev/null
+++ b/gas/testsuite/gas/i386/doitm.s
@@ -0,0 +1,13 @@
+# Check 32bit DOITM instructions
+
+ .text
+_start:
+ rddoitm %eax
+ setdoitm
+ wrdoitm %ebx
+
+_intel:
+ .intel_syntax noprefix
+ rddoitm eax
+ setdoitm
+ wrdoitm ebx
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 74486a7a3c5..16e093202b0 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -557,6 +557,8 @@ if [gas_32_check] then {
run_list_test "movrs-inval"
run_dump_test "avx10-vpmldsabflydq"
run_dump_test "avx10-vpmldsabflydq-intel"
+ run_dump_test "doitm"
+ run_dump_test "doitm-intel"
run_list_test "sg"
run_dump_test "clzero"
run_dump_test "invlpgb"
diff --git a/gas/testsuite/gas/i386/nops-8.d b/gas/testsuite/gas/i386/nops-8.d
index d0be54d2aac..101805835ae 100644
--- a/gas/testsuite/gas/i386/nops-8.d
+++ b/gas/testsuite/gas/i386/nops-8.d
@@ -1938,19 +1938,19 @@ Disassembly of section .text:
+[a-f0-9]+: f3 0f 1e ed repz nop %ebp
+[a-f0-9]+: f3 0f 1e ee repz nop %esi
+[a-f0-9]+: f3 0f 1e ef repz nop %edi
- +[a-f0-9]+: f3 0f 1e f0 repz nop %eax
- +[a-f0-9]+: f3 0f 1e f1 repz nop %ecx
- +[a-f0-9]+: f3 0f 1e f2 repz nop %edx
- +[a-f0-9]+: f3 0f 1e f3 repz nop %ebx
- +[a-f0-9]+: f3 0f 1e f4 repz nop %esp
- +[a-f0-9]+: f3 0f 1e f5 repz nop %ebp
- +[a-f0-9]+: f3 0f 1e f6 repz nop %esi
- +[a-f0-9]+: f3 0f 1e f7 repz nop %edi
+ +[a-f0-9]+: f3 0f 1e f0 rddoitm %eax
+ +[a-f0-9]+: f3 0f 1e f1 rddoitm %ecx
+ +[a-f0-9]+: f3 0f 1e f2 rddoitm %edx
+ +[a-f0-9]+: f3 0f 1e f3 rddoitm %ebx
+ +[a-f0-9]+: f3 0f 1e f4 rddoitm %esp
+ +[a-f0-9]+: f3 0f 1e f5 rddoitm %ebp
+ +[a-f0-9]+: f3 0f 1e f6 rddoitm %esi
+ +[a-f0-9]+: f3 0f 1e f7 rddoitm %edi
+[a-f0-9]+: f3 0f 1e f8 repz nop %eax
+[a-f0-9]+: f3 0f 1e f9 repz nop %ecx
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: f3 0f 1e fb endbr32
- +[a-f0-9]+: f3 0f 1e fc repz nop %esp
+ +[a-f0-9]+: f3 0f 1e fc setdoitm
+[a-f0-9]+: f3 0f 1e fd repz nop %ebp
+[a-f0-9]+: f3 0f 1e fe repz nop %esi
+[a-f0-9]+: f3 0f 1e ff repz nop %edi
@@ -2010,14 +2010,14 @@ Disassembly of section .text:
+[a-f0-9]+: f2 0f 1e ed repnz nop %ebp
+[a-f0-9]+: f2 0f 1e ee repnz nop %esi
+[a-f0-9]+: f2 0f 1e ef repnz nop %edi
- +[a-f0-9]+: f2 0f 1e f0 repnz nop %eax
- +[a-f0-9]+: f2 0f 1e f1 repnz nop %ecx
- +[a-f0-9]+: f2 0f 1e f2 repnz nop %edx
- +[a-f0-9]+: f2 0f 1e f3 repnz nop %ebx
- +[a-f0-9]+: f2 0f 1e f4 repnz nop %esp
- +[a-f0-9]+: f2 0f 1e f5 repnz nop %ebp
- +[a-f0-9]+: f2 0f 1e f6 repnz nop %esi
- +[a-f0-9]+: f2 0f 1e f7 repnz nop %edi
+ +[a-f0-9]+: f2 0f 1e f0 wrdoitm %eax
+ +[a-f0-9]+: f2 0f 1e f1 wrdoitm %ecx
+ +[a-f0-9]+: f2 0f 1e f2 wrdoitm %edx
+ +[a-f0-9]+: f2 0f 1e f3 wrdoitm %ebx
+ +[a-f0-9]+: f2 0f 1e f4 wrdoitm %esp
+ +[a-f0-9]+: f2 0f 1e f5 wrdoitm %ebp
+ +[a-f0-9]+: f2 0f 1e f6 wrdoitm %esi
+ +[a-f0-9]+: f2 0f 1e f7 wrdoitm %edi
+[a-f0-9]+: f2 0f 1e f8 repnz nop %eax
+[a-f0-9]+: f2 0f 1e f9 repnz nop %ecx
+[a-f0-9]+: f2 0f 1e fa repnz nop %edx
diff --git a/gas/testsuite/gas/i386/x86-64-doitm-intel.d b/gas/testsuite/gas/i386/x86-64-doitm-intel.d
new file mode 100644
index 00000000000..ff89e42d4bc
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-doitm-intel.d
@@ -0,0 +1,18 @@
+#objdump: -dw -Mintel
+#name: x86_64 DOITM insns (Intel disassembly)
+#source: x86-64-doitm.s
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+#...
+[a-f0-9]+ <_intel>:
+[ ]*[a-f0-9]+:[ ]*f3 49 0f 1e f4[ ]*rddoitm r12
+[ ]*[a-f0-9]+:[ ]*f3 48 0f 1e f3[ ]*rddoitm rbx
+[ ]*[a-f0-9]+:[ ]*f3 d5 98 1e f6[ ]*rddoitm r22
+[ ]*[a-f0-9]+:[ ]*f3 0f 1e fc[ ]*setdoitm
+[ ]*[a-f0-9]+:[ ]*f2 49 0f 1e f6[ ]*wrdoitm r14
+[ ]*[a-f0-9]+:[ ]*f2 48 0f 1e f1[ ]*wrdoitm rcx
+[ ]*[a-f0-9]+:[ ]*f2 d5 99 1e f0[ ]*wrdoitm r24
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-doitm.d b/gas/testsuite/gas/i386/x86-64-doitm.d
new file mode 100644
index 00000000000..5cd61558938
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-doitm.d
@@ -0,0 +1,16 @@
+#objdump: -dw
+#name: x86_64 DOITM insns
+
+.*: +file format .*
+
+Disassembly of section \.text:
+
+0+ <_start>:
+[ ]*[a-f0-9]+:[ ]*f3 49 0f 1e f4[ ]*rddoitm %r12
+[ ]*[a-f0-9]+:[ ]*f3 48 0f 1e f3[ ]*rddoitm %rbx
+[ ]*[a-f0-9]+:[ ]*f3 d5 98 1e f6[ ]*rddoitm %r22
+[ ]*[a-f0-9]+:[ ]*f3 0f 1e fc[ ]*setdoitm
+[ ]*[a-f0-9]+:[ ]*f2 49 0f 1e f6[ ]*wrdoitm %r14
+[ ]*[a-f0-9]+:[ ]*f2 48 0f 1e f1[ ]*wrdoitm %rcx
+[ ]*[a-f0-9]+:[ ]*f2 d5 99 1e f0[ ]*wrdoitm %r24
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-doitm.s b/gas/testsuite/gas/i386/x86-64-doitm.s
new file mode 100644
index 00000000000..849fd8aca3d
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-doitm.s
@@ -0,0 +1,21 @@
+# Check 64bit DOITM instructions
+
+ .text
+_start:
+ rddoitm %r12
+ rddoitm %rbx
+ rddoitm %r22
+ setdoitm
+ wrdoitm %r14
+ wrdoitm %rcx
+ wrdoitm %r24
+
+_intel:
+ .intel_syntax noprefix
+ rddoitm r12
+ rddoitm rbx
+ rddoitm r22
+ setdoitm
+ wrdoitm r14
+ wrdoitm rcx
+ wrdoitm r24
diff --git a/gas/testsuite/gas/i386/x86-64.exp b/gas/testsuite/gas/i386/x86-64.exp
index 5a80df54bd7..4ef2c0620d2 100644
--- a/gas/testsuite/gas/i386/x86-64.exp
+++ b/gas/testsuite/gas/i386/x86-64.exp
@@ -556,6 +556,8 @@ run_dump_test "x86-64-movrs-avx10_2-256"
run_dump_test "x86-64-movrs-avx10_2-256-intel"
run_dump_test "x86-64-avx10-vpmldsabflydq"
run_dump_test "x86-64-avx10-vpmldsabflydq-intel"
+run_dump_test "x86-64-doitm"
+run_dump_test "x86-64-doitm-intel"
run_dump_test "x86-64-clzero"
run_dump_test "x86-64-mwaitx-bdver4"
run_list_test "x86-64-mwaitx-reg"
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 863e1bdb767..5190bdd5c21 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -897,6 +897,7 @@ enum
REG_0F18,
REG_0F1C_P_0_MOD_0,
REG_0F1E_P_1_MOD_3,
+ REG_0F1E_P_3_MOD_3,
REG_0F38D8_PREFIX_1,
REG_0F3A0F_P_1,
REG_0F71,
@@ -961,6 +962,7 @@ enum
MOD_0F1B_PREFIX_1,
MOD_0F1C_PREFIX_0,
MOD_0F1E_PREFIX_1,
+ MOD_0F1E_PREFIX_3,
MOD_0FAE_REG_0,
MOD_0FAE_REG_1,
MOD_0FAE_REG_2,
@@ -3006,9 +3008,20 @@ static const struct dis386 reg_table[][8] = {
{ "nopQ", { Ev }, PREFIX_IGNORED },
{ "nopQ", { Ev }, PREFIX_IGNORED },
{ "nopQ", { Ev }, PREFIX_IGNORED },
- { "nopQ", { Ev }, PREFIX_IGNORED },
+ { "rddoitm", { Ev }, 0 },
{ RM_TABLE (RM_0F1E_P_1_MOD_3_REG_7) },
},
+ /* REG_0F1E_P_3_MOD_3 */
+ {
+ { "nopQ", { Ev }, PREFIX_IGNORED },
+ { "nopQ", { Ev }, PREFIX_IGNORED },
+ { "nopQ", { Ev }, PREFIX_IGNORED },
+ { "nopQ", { Ev }, PREFIX_IGNORED },
+ { "nopQ", { Ev }, PREFIX_IGNORED },
+ { "nopQ", { Ev }, PREFIX_IGNORED },
+ { "wrdoitm", { Ev }, 0 },
+ { "nopQ", { Ev }, PREFIX_IGNORED },
+ },
/* REG_0F38D8_PREFIX_1 */
{
{ "aesencwide128kl", { M }, 0 },
@@ -3448,7 +3461,7 @@ static const struct dis386 prefix_table[][4] = {
{ "nopQ", { Ev }, 0 },
{ MOD_TABLE (MOD_0F1E_PREFIX_1) },
{ "nopQ", { Ev }, 0 },
- { NULL, { XX }, PREFIX_IGNORED },
+ { MOD_TABLE (MOD_0F1E_PREFIX_3) },
},
/* PREFIX_0F2A */
@@ -8700,6 +8713,11 @@ static const struct dis386 mod_table[][2] = {
{ "nopQ", { Ev }, PREFIX_IGNORED },
{ REG_TABLE (REG_0F1E_P_1_MOD_3) },
},
+ {
+ /* MOD_0F1E_PREFIX_3 */
+ { "nopQ", { Ev }, PREFIX_IGNORED },
+ { REG_TABLE (REG_0F1E_P_3_MOD_3) },
+ },
{
/* MOD_0FAE_REG_0 */
{ "fxsave", { FXSAVE }, 0 },
@@ -8855,7 +8873,7 @@ static const struct dis386 rm_table[][8] = {
{ "nopQ", { Ev }, PREFIX_IGNORED },
{ "endbr64", { Skip_MODRM }, 0 },
{ "endbr32", { Skip_MODRM }, 0 },
- { "nopQ", { Ev }, PREFIX_IGNORED },
+ { "setdoitm", { Skip_MODRM }, 0 },
{ "nopQ", { Ev }, PREFIX_IGNORED },
{ "nopQ", { Ev }, PREFIX_IGNORED },
{ "nopQ", { Ev }, PREFIX_IGNORED },
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index 46cf12075e7..21771124b37 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -469,6 +469,7 @@ static bitfield cpu_flags[] =
BITFIELD (AVX10_V2_AUX),
BITFIELD (MOVRS),
BITFIELD (AVX10_VPMLDSABFLYDQ),
+ BITFIELD (DOITM),
BITFIELD (MWAITX),
BITFIELD (CLZERO),
BITFIELD (OSPKE),
diff --git a/opcodes/i386-opc.h b/opcodes/i386-opc.h
index 397fcade41d..8adeac656e2 100644
--- a/opcodes/i386-opc.h
+++ b/opcodes/i386-opc.h
@@ -249,6 +249,8 @@ enum i386_cpu
CpuMOVRS,
/* AVX10_VPMLDSABFLYDQ Instructions support required. */
CpuAVX10_VPMLDSABFLYDQ,
+ /* USER_DOITM/SUP_DOITM Instructions support required. */
+ CpuDOITM,
/* mwaitx instruction required */
CpuMWAITX,
/* Clzero instruction required */
@@ -544,6 +546,7 @@ typedef union i386_cpu_flags
unsigned int cpumsr_imm:1;
unsigned int cpumovrs:1;
unsigned int cpuavx10_vpmldsabflydq:1;
+ unsigned int cpudoitm:1;
unsigned int cpumwaitx:1;
unsigned int cpuclzero:1;
unsigned int cpuospke:1;
diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl
index a4e35d0561d..9259dc2e34a 100644
--- a/opcodes/i386-opc.tbl
+++ b/opcodes/i386-opc.tbl
@@ -3724,3 +3724,11 @@ vmovrs<dq>, 0xf36f, AVX10_2&MOVRS&x64, Modrm|Masking|Map5|<dq:vexw>|Disp8ShiftVL
vpmldsabflydq, 0x66dc, AVX10_VPMLDSABFLYDQ, Modrm|Space0F3A|Src1VVVV|VexW1|Disp8ShiftVL|CheckOperandSize|NoSuf, { Imm8, RegXMM|RegYMM|RegZMM|Unspecified|BaseIndex, RegXMM|RegYMM|RegZMM, RegXMM|RegYMM|RegZMM }
// AVX10_VPMLDSABFLYDQ instructions end.
+
+// USER_DOITM/SUP_DOITM instructions.
+
+rddoitm, 0xf30f1e/6, DOITM, Modrm|NoSuf, { Reg32|Reg64 }
+setdoitm, 0xf30f1efc, DOITM, NoSuf, {}
+wrdoitm, 0xf20f1e/6, DOITM, Modrm|NoSuf, { Reg32|Reg64 }
+
+// USER_DOITM/SUP_DOITM instructions end.
--
2.31.1
More information about the Binutils
mailing list