Patchwork PATCH: PR target/46295: Missing vzeroupper

login
register
mail settings
Submitter H.J. Lu
Date Nov. 3, 2010, 9:03 p.m.
Message ID <20101103210304.GA4483@intel.com>
Download mbox | patch
Permalink /patch/70071/
State New
Headers show

Comments

H.J. Lu - Nov. 3, 2010, 9:03 p.m.
Hi,

We should set use_avx256_p if 256bit AVX register is used in vector
move.  OK for trunk?

Thanks.



H.J.
---
gcc/

2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/46295
	* config/i386/i386.c (ix86_expand_vector_move): Set use_avx256_p
	if 256bit AVX register is used.

gcc/testsuite/

2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR target/46295
	* gcc.target/i386/pr46295.c: New.
Uros Bizjak - Nov. 3, 2010, 9:12 p.m.
On Wed, Nov 3, 2010 at 10:03 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:

> We should set use_avx256_p if 256bit AVX register is used in vector
> move.  OK for trunk?
>
> Thanks.
>
>
>
> H.J.
> ---
> gcc/
>
> 2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR target/46295
>        * config/i386/i386.c (ix86_expand_vector_move): Set use_avx256_p
>        if 256bit AVX register is used.
>
> gcc/testsuite/
>
> 2010-11-03  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR target/46295
>        * gcc.target/i386/pr46295.c: New.

OK.

Thanks,
Uros.

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index ba1e4fc..3558899 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -15144,6 +15144,9 @@  ix86_expand_vector_move (enum machine_mode mode, rtx operands[])
   rtx op0 = operands[0], op1 = operands[1];
   unsigned int align = GET_MODE_ALIGNMENT (mode);
 
+  if (use_avx256_p (mode, NULL_TREE))
+    cfun->machine->use_avx256_p = true;
+
   /* Force constants other than zero into memory.  We do not know how
      the instructions used to build constants modify the upper 64 bits
      of the register, once we have that information we may be able
diff --git a/gcc/testsuite/gcc.target/i386/pr46295.c b/gcc/testsuite/gcc.target/i386/pr46295.c
new file mode 100644
index 0000000..219f34e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr46295.c
@@ -0,0 +1,15 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O3 -mavx -mtune=generic -dp" } */
+
+typedef double EXPRESS[5];
+void Parse_Rel_Factor (EXPRESS Express,int *Terms);
+void Parse_Vector ()
+{
+   EXPRESS Express;
+   int Terms;
+   for (Terms = 0; Terms < 5; Terms++)
+     Express[Terms] = 0.0;
+   Parse_Rel_Factor(Express,&Terms);
+}
+
+/* { dg-final { scan-assembler-times "avx_vzeroupper" 1 } } */