diff mbox

Fix PR 47755 on powerpc, make vector constant of all 0's not generate a load instruction

Message ID 20110215182210.GA7950@hungry-tiger.westford.ibm.com
State New
Headers show

Commit Message

Michael Meissner Feb. 15, 2011, 6:22 p.m. UTC
Here is a revised patch that explains the removal of TImode in
easy_vector_constant in the ChangeLog.

[gcc]
2011-02-15  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/47755
	* config/rs6000/predicates.md (easy_vector_constant): Allow V2DI
	mode for vector constants.  Remove code that checks for TImode,
	since TImode is not a vector type, nor presently allowed in VSX
	and Altivec registers.

[gcc/testsuite]
2011-02-15  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/47755
	* gcc.target/powerpc/pr47755.c: New file, test all 0 vector
	constant does not generate a load from memory.

Comments

David Edelsohn Feb. 15, 2011, 6:25 p.m. UTC | #1
Mike,

Thanks for the revised ChangeLog.  The explanation should not be in
the ChangeLog, only "Remove code that checks for TImode."  The
explanation should be in this email thread.

The patch is okay with the second ChangeLog changed.

Thanks, David

On Tue, Feb 15, 2011 at 1:22 PM, Michael Meissner
<meissner@linux.vnet.ibm.com> wrote:
> Here is a revised patch that explains the removal of TImode in
> easy_vector_constant in the ChangeLog.
>
> [gcc]
> 2011-02-15  Michael Meissner  <meissner@linux.vnet.ibm.com>
>
>        PR target/47755
>        * config/rs6000/predicates.md (easy_vector_constant): Allow V2DI
>        mode for vector constants.  Remove code that checks for TImode,
>        since TImode is not a vector type, nor presently allowed in VSX
>        and Altivec registers.
>
> [gcc/testsuite]
> 2011-02-15  Michael Meissner  <meissner@linux.vnet.ibm.com>
>
>        PR target/47755
>        * gcc.target/powerpc/pr47755.c: New file, test all 0 vector
>        constant does not generate a load from memory.
diff mbox

Patch

Index: gcc/config/rs6000/predicates.md
===================================================================
--- gcc/config/rs6000/predicates.md	(revision 170149)
+++ gcc/config/rs6000/predicates.md	(working copy)
@@ -328,13 +328,11 @@  (define_predicate "easy_vector_constant"
   if (TARGET_PAIRED_FLOAT)
     return false;
 
-  if ((VSX_VECTOR_MODE (mode) || mode == TImode) && zero_constant (op, mode))
-    return true;
-
-  if (ALTIVEC_VECTOR_MODE (mode))
+  if (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode))
     {
       if (zero_constant (op, mode))
-        return true;
+	return true;
+
       return easy_altivec_constant (op, mode);
     }
 
Index: gcc/testsuite/gcc.target/powerpc/pr47755.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pr47755.c	(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/pr47755.c	(revision 0)
@@ -0,0 +1,16 @@ 
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O3 -mcpu=power7" } */
+/* { dg-final { scan-assembler "xxlxor" } } */
+/* { dg-final { scan-assembler-not "lxvd2x" } } */
+/* { dg-final { scan-assembler-not "lxvw4x" } } */
+/* { dg-final { scan-assembler-not "lvx" } } */
+
+/* PR 47755: Compiler loads vector constant of 0 from TOC instead of using
+   xxlxor.  */
+void
+func (vector long long *p)
+{
+  *p = (vector long long) { 0LL, 0LL };
+}