[PATCH] x86: Support GNU_PROPERTY_X86_FEATURE_2_TMM
H.J. Lu
hjl.tools@gmail.com
Mon Jun 29 13:56:58 GMT 2020
On Mon, Jun 29, 2020 at 05:46:42AM -0700, H.J. Lu wrote:
> On Mon, Jun 29, 2020 at 3:03 AM Jan Beulich <jbeulich@suse.com> wrote:
> >
> > On 28.06.2020 09:43, Cui, Lili via Binutils wrote:
> > > @@ -372,6 +373,9 @@ struct _i386_insn
> > > /* Has ZMM register operands. */
> > > bfd_boolean has_regzmm;
> > >
> > > + /* Has TMM register operands. */
> > > + bfd_boolean has_regtmm;
> >
> > I'm sad to see widening of this (imo) bad model, but unfortunately
> > I didn't get around yet to clean this up. However, adding the field
> > is pointless as it only ever gets set, but never read.
>
> I have a patch to use it.
>
Here is the patch.
H.J.
----
Support GNU_PROPERTY_X86_FEATURE_2_TMM in
https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/1
#define GNU_PROPERTY_X86_FEATURE_2_TMM (1U << 10)
binutils/
* readelf.c (decode_x86_feature_2): Handle
GNU_PROPERTY_X86_FEATURE_2_TMM.
gas/
* config/tc-i386.c (output_insn): Check i.has_regtmm to set
GNU_PROPERTY_X86_FEATURE_2_TMM.
* testsuite/gas/i386/i386.exp: Run x86-64-property-4 and
x86-64-property-5.
* testsuite/gas/i386/x86-64-property-4.d: New file.
* testsuite/gas/i386/x86-64-property-4.s: Likewise.
* testsuite/gas/i386/x86-64-property-5.d: Likewise.
* testsuite/gas/i386/x86-64-property-5.s: Likewise.
include/
* elf/common.h (GNU_PROPERTY_X86_FEATURE_2_TMM): New.
---
binutils/readelf.c | 3 +++
gas/config/tc-i386.c | 2 ++
gas/testsuite/gas/i386/i386.exp | 2 ++
gas/testsuite/gas/i386/x86-64-property-4.d | 9 +++++++++
gas/testsuite/gas/i386/x86-64-property-4.s | 2 ++
gas/testsuite/gas/i386/x86-64-property-5.d | 9 +++++++++
gas/testsuite/gas/i386/x86-64-property-5.s | 2 ++
include/elf/common.h | 1 +
8 files changed, 30 insertions(+)
create mode 100644 gas/testsuite/gas/i386/x86-64-property-4.d
create mode 100644 gas/testsuite/gas/i386/x86-64-property-4.s
create mode 100644 gas/testsuite/gas/i386/x86-64-property-5.d
create mode 100644 gas/testsuite/gas/i386/x86-64-property-5.s
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 1d7cfbcf03..1298307e15 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -18144,6 +18144,9 @@ decode_x86_feature_2 (unsigned int bitmask)
case GNU_PROPERTY_X86_FEATURE_2_ZMM:
printf ("ZMM");
break;
+ case GNU_PROPERTY_X86_FEATURE_2_TMM:
+ printf ("TMM");
+ break;
case GNU_PROPERTY_X86_FEATURE_2_FXSR:
printf ("FXSR");
break;
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 2936b28f1a..7c59718ddb 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -9201,6 +9201,8 @@ output_insn (void)
x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_YMM;
if (i.has_regzmm)
x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_ZMM;
+ if (i.has_regtmm)
+ x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_TMM;
if (i.tm.cpu_flags.bitfield.cpufxsr)
x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_FXSR;
if (i.tm.cpu_flags.bitfield.cpuxsave)
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index fffa7e456b..12ea130e3b 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -1210,6 +1210,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
run_dump_test "x86-64-property-1"
run_dump_test "x86-64-property-2"
run_dump_test "x86-64-property-3"
+ run_dump_test "x86-64-property-4"
+ run_dump_test "x86-64-property-5"
if {[istarget "*-*-linux*"]} then {
run_dump_test "x86-64-align-branch-3"
diff --git a/gas/testsuite/gas/i386/x86-64-property-4.d b/gas/testsuite/gas/i386/x86-64-property-4.d
new file mode 100644
index 0000000000..e938cc90da
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-property-4.d
@@ -0,0 +1,9 @@
+#name: x86-64 property 4
+#as: -mx86-used-note=yes --generate-missing-build-notes=no
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: <None>
+ x86 feature used: x86, TMM
diff --git a/gas/testsuite/gas/i386/x86-64-property-4.s b/gas/testsuite/gas/i386/x86-64-property-4.s
new file mode 100644
index 0000000000..14d8c5d041
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-property-4.s
@@ -0,0 +1,2 @@
+ .text
+ tileloaddt1 (%rcx), %tmm5
diff --git a/gas/testsuite/gas/i386/x86-64-property-5.d b/gas/testsuite/gas/i386/x86-64-property-5.d
new file mode 100644
index 0000000000..e938cc90da
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-property-5.d
@@ -0,0 +1,9 @@
+#name: x86-64 property 4
+#as: -mx86-used-note=yes --generate-missing-build-notes=no
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+[ ]+Owner[ ]+Data size[ ]+Description
+ GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: <None>
+ x86 feature used: x86, TMM
diff --git a/gas/testsuite/gas/i386/x86-64-property-5.s b/gas/testsuite/gas/i386/x86-64-property-5.s
new file mode 100644
index 0000000000..bfa255b688
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-property-5.s
@@ -0,0 +1,2 @@
+ .text
+ tdpbuud %tmm3, %tmm2, %tmm1
diff --git a/include/elf/common.h b/include/elf/common.h
index 4d94c4fd5b..6db84d7549 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -846,6 +846,7 @@
#define GNU_PROPERTY_X86_FEATURE_2_XSAVE (1U << 7)
#define GNU_PROPERTY_X86_FEATURE_2_XSAVEOPT (1U << 8)
#define GNU_PROPERTY_X86_FEATURE_2_XSAVEC (1U << 9)
+#define GNU_PROPERTY_X86_FEATURE_2_TMM (1U << 10)
/* AArch64 specific GNU PROPERTY. */
#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
--
2.26.2
More information about the Binutils
mailing list