x86: Properly set YMM/ZMM features
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 9 Jul 2020 17:33:25 +0000 (10:33 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 9 Jul 2020 17:33:43 +0000 (10:33 -0700)
Since VEX/EVEX vector instructions will always update the full YMM/ZMM
registers, set YMM/ZMM features for VEX/EVEX vector instructions.

* config/tc-i386.c (output_insn): Set YMM/ZMM features for
VEX/EVEX vector instructions.
* testsuite/gas/i386/property-4.d: New file.
* testsuite/gas/i386/property-4.s: Likewise.
* testsuite/gas/i386/property-5.d: Likewise.
* testsuite/gas/i386/property-5.s: Likewise.
* testsuite/gas/i386/x86-64-property-4.d: Likewise.
* testsuite/gas/i386/x86-64-property-5.d: Likewise.

gas/ChangeLog
gas/config/tc-i386.c
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/property-4.d [new file with mode: 0644]
gas/testsuite/gas/i386/property-4.s [new file with mode: 0644]
gas/testsuite/gas/i386/property-5.d [new file with mode: 0644]
gas/testsuite/gas/i386/property-5.s [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-property-4.d [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-property-5.d [new file with mode: 0644]

index 5a713bc1b5228842d7bb18c4f64c29600a43ffeb..19b17c1f579ea83fa0852c87c04ec60e7c854c62 100644 (file)
@@ -1,3 +1,14 @@
+2020-07-09  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * config/tc-i386.c (output_insn): Set YMM/ZMM features for
+       VEX/EVEX vector instructions.
+       * testsuite/gas/i386/property-4.d: New file.
+       * testsuite/gas/i386/property-4.s: Likewise.
+       * testsuite/gas/i386/property-5.d: Likewise.
+       * testsuite/gas/i386/property-5.s: Likewise.
+       * testsuite/gas/i386/x86-64-property-4.d: Likewise.
+       * testsuite/gas/i386/x86-64-property-5.d: Likewise.
+
 2020-07-09  H.J. Lu  <hongjiu.lu@intel.com>
 
        * NEWS: Mention --enable-x86-used-note.
index 2e0eb24753595f516e120810fd559af4b3a9f692..bb51133ecd51eff75884523e62b0e16eb7321206 100644 (file)
@@ -9120,9 +9120,14 @@ output_insn (void)
        x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_MMX;
       if (i.has_regxmm)
        x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_XMM;
-      if (i.has_regymm)
+      if (i.has_regymm
+         || (i.has_regxmm
+             && (i.tm.opcode_modifier.vex
+                 || i.tm.opcode_modifier.evex)))
        x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_YMM;
-      if (i.has_regzmm)
+      if (i.has_regzmm
+         || ((i.has_regxmm || i.has_regymm)
+             && i.tm.opcode_modifier.evex))
        x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_ZMM;
       if (i.tm.cpu_flags.bitfield.cpufxsr)
        x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_FXSR;
index 37aa39698c03a4635ca27dcd3bc69c436df1b9e3..0074a13692f3a8cf022445eb1f7bc3b24f71d0e8 100644 (file)
@@ -622,6 +622,8 @@ if [expr ([istarget "i*86-*-*"] ||  [istarget "x86_64-*-*"]) && [gas_32_check]]
        run_dump_test "property-1"
        run_dump_test "property-2"
        run_dump_test "property-3"
+       run_dump_test "property-4"
+       run_dump_test "property-5"
 
        if {[istarget "*-*-linux*"]} then {
            run_dump_test "align-branch-3"
@@ -1207,6 +1209,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/property-4.d b/gas/testsuite/gas/i386/property-4.d
new file mode 100644 (file)
index 0000000..0fe6bc7
--- /dev/null
@@ -0,0 +1,9 @@
+#name: i386 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: AVX
+       x86 feature used: x86, XMM, YMM
diff --git a/gas/testsuite/gas/i386/property-4.s b/gas/testsuite/gas/i386/property-4.s
new file mode 100644 (file)
index 0000000..dcc2882
--- /dev/null
@@ -0,0 +1,2 @@
+       .text
+       {vex} vmovaps %xmm0, %xmm0
diff --git a/gas/testsuite/gas/i386/property-5.d b/gas/testsuite/gas/i386/property-5.d
new file mode 100644 (file)
index 0000000..fc6a518
--- /dev/null
@@ -0,0 +1,9 @@
+#name: i386 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: AVX512F
+       x86 feature used: x86, XMM, YMM, ZMM
diff --git a/gas/testsuite/gas/i386/property-5.s b/gas/testsuite/gas/i386/property-5.s
new file mode 100644 (file)
index 0000000..ff8ce48
--- /dev/null
@@ -0,0 +1,2 @@
+       .text
+       {evex} vmovaps %xmm0, %xmm0
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 (file)
index 0000000..4a48950
--- /dev/null
@@ -0,0 +1,10 @@
+#name: x86-64 property 4
+#source: property-4.s
+#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: AVX
+       x86 feature used: x86, XMM, YMM
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 (file)
index 0000000..590d8d5
--- /dev/null
@@ -0,0 +1,10 @@
+#name: x86-64 property 5
+#source: property-5.s
+#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: AVX512F
+       x86 feature used: x86, XMM, YMM, ZMM