x86: Support GNU_PROPERTY_X86_FEATURE_2_TMM

Message ID 20200629135658.GA264707@gmail.com
State Superseded
Headers show
Series
  • x86: Support GNU_PROPERTY_X86_FEATURE_2_TMM
Related show

Commit Message

Alan Modra via Binutils June 29, 2020, 1:56 p.m.
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

-- 
2.26.2

Comments

Jan Beulich June 29, 2020, 2:54 p.m. | #1
On 29.06.2020 15:56, H.J. Lu wrote:
> --- 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;


Similar conceptual issue as with the others, as previously pointed
out. For example, ldtilecfg and tilerelease should imo both result
in this flag also getting set, despite there not being any %tmm<N>
operand. I'm anyway still awaiting a proper formal definition of
what these property bits mean - see the earlier thread that didn't
lead anywhere in this regard.

Jan
Alan Modra via Binutils June 29, 2020, 3:31 p.m. | #2
On Mon, Jun 29, 2020 at 7:54 AM Jan Beulich <jbeulich@suse.com> wrote:
>

> On 29.06.2020 15:56, H.J. Lu wrote:

> > --- 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;

>

> Similar conceptual issue as with the others, as previously pointed

> out. For example, ldtilecfg and tilerelease should imo both result

> in this flag also getting set, despite there not being any %tmm<N>


Good point.  Here is the updated patch.

> operand. I'm anyway still awaiting a proper formal definition of

> what these property bits mean - see the earlier thread that didn't

> lead anywhere in this regard.

>


Since architecture states are more relevant than specific ISAs,
X86_FEATURE_2_XXX is used to describe architecture state
requirements of a program.   I appreciate it if you can suggest
improvements in wordings in the spec.

Thanks.

-- 
H.J.
From 8ac67ee644548b84f08ca0c07b5bf85ed85a5e36 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 29 Jun 2020 06:50:38 -0700
Subject: [PATCH] x86: Support GNU_PROPERTY_X86_FEATURE_2_TMM

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.
	* testsuite/gas/i386/x86-64-property-6.d: Likewise.
	* testsuite/gas/i386/x86-64-property-6.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-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 ++
 gas/testsuite/gas/i386/x86-64-property-6.d | 9 +++++++++
 gas/testsuite/gas/i386/x86-64-property-6.s | 2 ++
 include/elf/common.h                       | 1 +
 10 files changed, 44 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
 create mode 100644 gas/testsuite/gas/i386/x86-64-property-6.d
 create mode 100644 gas/testsuite/gas/i386/x86-64-property-6.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..89f484a8cc 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -9209,6 +9209,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.has_regtmm
+	  || 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 fffa7e456b..ff9de27f34 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -1210,6 +1210,9 @@ 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"
+	run_dump_test "x86-64-property-6"
 
 	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/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..23c270b9da
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-property-6.s
@@ -0,0 +1,2 @@
+	.text
+	tilerelease
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

Patch

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