public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2114] Don't issue vzeroupper for vzeroupper call_insn.
@ 2023-06-27  6:13 hongtao Liu
  0 siblings, 0 replies; only message in thread
From: hongtao Liu @ 2023-06-27  6:13 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a90f558bbb87c0b5d2b1e07d55bd585b2285cf3d

commit r14-2114-ga90f558bbb87c0b5d2b1e07d55bd585b2285cf3d
Author: liuhongt <hongtao.liu@intel.com>
Date:   Mon Jun 26 13:59:29 2023 +0800

    Don't issue vzeroupper for vzeroupper call_insn.
    
    gcc/ChangeLog:
    
            PR target/82735
            * config/i386/i386.cc (ix86_avx_u127_mode_needed): Don't emit
            vzeroupper for vzeroupper call_insn.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/i386/avx-vzeroupper-30.c: New test.

Diff:
---
 gcc/config/i386/i386.cc                           |  5 +++--
 gcc/testsuite/gcc.target/i386/avx-vzeroupper-30.c | 15 +++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 0761965344b..caca74d6dec 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -14489,8 +14489,9 @@ ix86_avx_u128_mode_needed (rtx_insn *insn)
 	 modes wider than 256 bits.  It's only safe to issue a
 	 vzeroupper if all SSE registers are clobbered.  */
       const function_abi &abi = insn_callee_abi (insn);
-      if (!hard_reg_set_subset_p (reg_class_contents[SSE_REGS],
-				  abi.mode_clobbers (V4DImode)))
+      if (vzeroupper_pattern (PATTERN (insn), VOIDmode)
+	  || !hard_reg_set_subset_p (reg_class_contents[SSE_REGS],
+				     abi.mode_clobbers (V4DImode)))
 	return AVX_U128_ANY;
 
       return AVX_U128_CLEAN;
diff --git a/gcc/testsuite/gcc.target/i386/avx-vzeroupper-30.c b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-30.c
new file mode 100644
index 00000000000..c1c9baa8fc4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx-vzeroupper-30.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx -mvzeroupper -dp" } */
+
+#include <immintrin.h>
+
+extern __m256 x, y;
+
+void
+foo ()
+{
+  x = y;
+  _mm256_zeroupper ();
+}
+
+/* { dg-final { scan-assembler-times "avx_vzeroupper" 1 } } */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-27  6:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27  6:13 [gcc r14-2114] Don't issue vzeroupper for vzeroupper call_insn hongtao Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).