From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 62D2A3945C09 for ; Mon, 15 Feb 2021 13:37:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 62D2A3945C09 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8383CACBF; Mon, 15 Feb 2021 13:37:49 +0000 (UTC) Subject: [PATCH 2/4] x86: record register use for SIMD insns without respective explicit operands To: Binutils References: <5b09d5f3-b832-78c8-07e1-202f27a56ca3@suse.com> From: Jan Beulich Message-ID: Date: Mon, 15 Feb 2021 14:37:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <5b09d5f3-b832-78c8-07e1-202f27a56ca3@suse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3033.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 13:37:51 -0000 VZERO{ALL,UPPER} modify YMM registers despite having no operands. While {,V}{LD,ST}MXCSR don't modify XMM registers, MXCSR and XMMn collectively form underlying machine state. gas/ 2021-02-XX Jan Beulich * config/tc-i386.c (output_insn): Handle ldmxcsr, stmxcsr, vldmxcsr, vstmxcsr, vzeroall, and vzeroupper. * testsuite/gas/i386/property-ldmxcsr.s, testsuite/gas/i386/property-ldmxcsr.d, testsuite/gas/i386/property-vldmxcsr.s, testsuite/gas/i386/property-vldmxcsr.d, testsuite/gas/i386/property-vzeroall.s, testsuite/gas/i386/property-vzeroall.d: New. * testsuite/gas/i386/i386.exp: Run new tests. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -9208,10 +9208,12 @@ output_insn (void) || i.tm.cpu_flags.bitfield.cpu687 || i.tm.cpu_flags.bitfield.cpufisttp) x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_X87; + if ((i.xstate & xstate_mmx) || i.tm.base_opcode == 0xf77 /* emms */ || i.tm.base_opcode == 0xf0e /* femms */) x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_MMX; + if (i.index_reg) { if (i.index_reg->reg_type.bitfield.zmmword) @@ -9221,10 +9223,20 @@ output_insn (void) else if (i.index_reg->reg_type.bitfield.xmmword) i.xstate |= xstate_xmm; } + + /* vzeroall / vzeroupper */ + if (i.tm.base_opcode == 0x77 && i.tm.cpu_flags.bitfield.cpuavx) + i.xstate |= xstate_ymm; + if ((i.xstate & xstate_xmm) + /* ldmxcsr / stmxcsr */ + || (i.tm.base_opcode == 0xfae && i.tm.cpu_flags.bitfield.cpusse) + /* vldmxcsr / vstmxcsr */ + || (i.tm.base_opcode == 0xae && i.tm.cpu_flags.bitfield.cpuavx) || i.tm.cpu_flags.bitfield.cpuwidekl || i.tm.cpu_flags.bitfield.cpukl) x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_XMM; + if ((i.xstate & xstate_ymm) == xstate_ymm) x86_feature_2_used |= GNU_PROPERTY_X86_FEATURE_2_YMM; if ((i.xstate & xstate_zmm) == xstate_zmm) --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -725,6 +725,9 @@ if {[is_elf_format] || [istarget "*-*-vx run_dump_test "property-11" run_dump_test "property-12" run_dump_test "property-13" + run_dump_test "property-ldmxcsr" + run_dump_test "property-vldmxcsr" + run_dump_test "property-vzeroall" if {![istarget "*-*-dragonfly*"] && ![istarget "*-*-gnu*"] --- /dev/null +++ b/gas/testsuite/gas/i386/property-ldmxcsr.d @@ -0,0 +1,9 @@ +#name: i386 property ldmxcsr +#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: x86-64-baseline + x86 feature used: x86, XMM --- /dev/null +++ b/gas/testsuite/gas/i386/property-ldmxcsr.s @@ -0,0 +1,2 @@ + .text + ldmxcsr (%eax) --- /dev/null +++ b/gas/testsuite/gas/i386/property-vldmxcsr.d @@ -0,0 +1,9 @@ +#name: i386 property vldmxcsr +#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: x86-64-baseline, x86-64-v3 + x86 feature used: x86, XMM --- /dev/null +++ b/gas/testsuite/gas/i386/property-vldmxcsr.s @@ -0,0 +1,2 @@ + .text + vldmxcsr (%eax) --- /dev/null +++ b/gas/testsuite/gas/i386/property-vzeroall.d @@ -0,0 +1,9 @@ +#name: i386 property vzeroall +#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: x86-64-baseline, x86-64-v3 + x86 feature used: x86, XMM, YMM --- /dev/null +++ b/gas/testsuite/gas/i386/property-vzeroall.s @@ -0,0 +1,2 @@ + .text + vzeroall