From: H.J. Lu Date: Thu, 9 Jul 2020 17:33:25 +0000 (-0700) Subject: x86: Properly set YMM/ZMM features X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=39776b1117bdbdc34eb46151edc8e09eecce1530;p=binutils-gdb.git x86: Properly set YMM/ZMM features 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. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 5a713bc1b52..19b17c1f579 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,14 @@ +2020-07-09 H.J. Lu + + * 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 * NEWS: Mention --enable-x86-used-note. diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 2e0eb247535..bb51133ecd5 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -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; diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index 37aa39698c0..0074a13692f 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -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 index 00000000000..0fe6bc7db4e --- /dev/null +++ b/gas/testsuite/gas/i386/property-4.d @@ -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 index 00000000000..dcc28826a4a --- /dev/null +++ b/gas/testsuite/gas/i386/property-4.s @@ -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 index 00000000000..fc6a5181d1d --- /dev/null +++ b/gas/testsuite/gas/i386/property-5.d @@ -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 index 00000000000..ff8ce48db96 --- /dev/null +++ b/gas/testsuite/gas/i386/property-5.s @@ -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 index 00000000000..4a489509d65 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-property-4.d @@ -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 index 00000000000..590d8d585f4 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-property-5.d @@ -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