[PATCH] x86: Support GNU_PROPERTY_X86_FEATURE_2_TMM

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] x86: Support GNU_PROPERTY_X86_FEATURE_2_TMM

Sourceware - binutils list mailing list
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.xstate to set
        GNU_PROPERTY_X86_FEATURE_2_TMM.
        * testsuite/gas/i386/i386.exp: Run x86-64-property-6,
        x86-64-property-7 and x86-64-property-8.
        * testsuite/gas/i386/x86-64-property-6.d: New file.
        * testsuite/gas/i386/x86-64-property-6.s: Likewise.
        * testsuite/gas/i386/x86-64-property-7.d: Likewise.
        * testsuite/gas/i386/x86-64-property-7.s: Likewise.
        * testsuite/gas/i386/x86-64-property-8.d: Likewise.
        * testsuite/gas/i386/x86-64-property-8.s: Likewise.

include/

        * elf/common.h (GNU_PROPERTY_X86_FEATURE_2_TMM): New.
---
 binutils/readelf.c                         | 3 +++
 gas/config/tc-i386.c                       | 4 ++++
 gas/testsuite/gas/i386/i386.exp            | 3 +++
 gas/testsuite/gas/i386/x86-64-property-6.d | 9 +++++++++
 gas/testsuite/gas/i386/x86-64-property-6.s | 2 ++
 gas/testsuite/gas/i386/x86-64-property-7.d | 9 +++++++++
 gas/testsuite/gas/i386/x86-64-property-7.s | 2 ++
 gas/testsuite/gas/i386/x86-64-property-8.d | 9 +++++++++
 gas/testsuite/gas/i386/x86-64-property-8.s | 2 ++
 include/elf/common.h                       | 1 +
 10 files changed, 44 insertions(+)
 create mode 100644 gas/testsuite/gas/i386/x86-64-property-6.d
 create mode 100644 gas/testsuite/gas/i386/x86-64-property-6.s
 create mode 100644 gas/testsuite/gas/i386/x86-64-property-7.d
 create mode 100644 gas/testsuite/gas/i386/x86-64-property-7.s
 create mode 100644 gas/testsuite/gas/i386/x86-64-property-8.d
 create mode 100644 gas/testsuite/gas/i386/x86-64-property-8.s

diff --git a/binutils/readelf.c b/binutils/readelf.c
index 0feeed9831..2406304fe3 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -18183,6 +18183,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 0eb2b94e04..18f685c8b1 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -9183,6 +9183,10 @@ output_insn (void)
  x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_XSAVEOPT;
       if (i.tm.cpu_flags.bitfield.cpuxsavec)
  x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_XSAVEC;
+
+      if ((i.xstate & xstate_tmm) == xstate_tmm
+  || i.tm.cpu_flags.bitfield.cpuamx_tile)
+ x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_TMM;
     }
 #endif
 
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index eabc09893f..55aacbc245 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -1215,6 +1215,9 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
  run_dump_test "x86-64-property-3"
  run_dump_test "x86-64-property-4"
  run_dump_test "x86-64-property-5"
+ run_dump_test "x86-64-property-6"
+ run_dump_test "x86-64-property-7"
+ run_dump_test "x86-64-property-8"
 
  if {[istarget "*-*-linux*"]} then {
     run_dump_test "x86-64-align-branch-3"
diff --git a/gas/testsuite/gas/i386/x86-64-property-6.d b/gas/testsuite/gas/i386/x86-64-property-6.d
new file mode 100644
index 0000000000..e938cc90da
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-property-6.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-6.s b/gas/testsuite/gas/i386/x86-64-property-6.s
new file mode 100644
index 0000000000..14d8c5d041
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-property-6.s
@@ -0,0 +1,2 @@
+ .text
+ tileloaddt1 (%rcx), %tmm5
diff --git a/gas/testsuite/gas/i386/x86-64-property-7.d b/gas/testsuite/gas/i386/x86-64-property-7.d
new file mode 100644
index 0000000000..e938cc90da
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-property-7.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-7.s b/gas/testsuite/gas/i386/x86-64-property-7.s
new file mode 100644
index 0000000000..bfa255b688
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-property-7.s
@@ -0,0 +1,2 @@
+ .text
+ tdpbuud %tmm3, %tmm2, %tmm1
diff --git a/gas/testsuite/gas/i386/x86-64-property-8.d b/gas/testsuite/gas/i386/x86-64-property-8.d
new file mode 100644
index 0000000000..e938cc90da
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-property-8.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-8.s b/gas/testsuite/gas/i386/x86-64-property-8.s
new file mode 100644
index 0000000000..23c270b9da
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-property-8.s
@@ -0,0 +1,2 @@
+ .text
+ tilerelease
diff --git a/include/elf/common.h b/include/elf/common.h
index 88dd1c9983..2138868c9b 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