[Bug rtl-optimization/41833] vec_splat followed by vec_splat could be improved
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Oct 27 16:37:00 GMT 2009
------- Comment #2 from pinskia at gcc dot gnu dot org 2009-10-27 16:37 -------
Patch which I am testing:
Index: testsuite/gcc.target/powerpc/altivec-33.c
===================================================================
--- testsuite/gcc.target/powerpc/altivec-33.c (revision 0)
+++ testsuite/gcc.target/powerpc/altivec-33.c (revision 0)
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-O2 -maltivec" } */
+
+/* We should only produce one vspltw as we already splatted the value. */
+/* { dg-final { scan-assembler-times "vspltw" 1 } } */
+
+#include <altivec.h>
+
+vector float f(vector float a)
+{
+ vector float b = vec_splat (a, 2);
+ return vec_splat (b, 0);
+}
+
+
Index: simplify-rtx.c
===================================================================
--- simplify-rtx.c (revision 153603)
+++ simplify-rtx.c (working copy)
@@ -2946,6 +2946,9 @@ simplify_binary_operation_1 (enum rtx_co
tmp_op, gen_rtx_PARALLEL (VOIDmode, vec));
return tmp;
}
+ if (GET_CODE (trueop0) == VEC_DUPLICATE
+ && GET_MODE (XEXP (trueop0, 0)) == mode)
+ return XEXP (trueop0, 0);
}
else
{
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41833
More information about the Gcc-bugs
mailing list