re PR target/31334 (Bad codegen for vector initializer with constants prop'd into a vector initializer)

2008-03-28  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR target/31334
        * config/rs6000/rs6000.c (rs6000_expand_vector_init): Create a
        const_vector when all the vectors are constant.

2008-03-28  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR target/31334
        * gcc.target/powerpc/altivec-25.c: Nnew testcase.

From-SVN: r133674
This commit is contained in:
Andrew Pinski 2008-03-28 07:27:11 +00:00 committed by Andrew Pinski
parent 15f4eb4428
commit 501fb355e6
4 changed files with 35 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2008-03-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR target/31334
* config/rs6000/rs6000.c (rs6000_expand_vector_init): Create a
const_vector when all the vectors are constant.
2008-03-27 Bob Wilson <bob.wilson@acm.org>
* config/xtensa/xtensa.c (gen_float_relational): Handle unordered

View File

@ -2965,6 +2965,7 @@ rs6000_expand_vector_init (rtx target, rtx vals)
if (n_var == 0)
{
rtx const_vec = gen_rtx_CONST_VECTOR (mode, XVEC (vals, 0));
if (mode != V4SFmode && all_const_zero)
{
/* Zero register. */
@ -2972,10 +2973,10 @@ rs6000_expand_vector_init (rtx target, rtx vals)
gen_rtx_XOR (mode, target, target)));
return;
}
else if (mode != V4SFmode && easy_vector_constant (vals, mode))
else if (mode != V4SFmode && easy_vector_constant (const_vec, mode))
{
/* Splat immediate. */
emit_insn (gen_rtx_SET (VOIDmode, target, vals));
emit_insn (gen_rtx_SET (VOIDmode, target, const_vec));
return;
}
else if (all_same)
@ -2983,7 +2984,7 @@ rs6000_expand_vector_init (rtx target, rtx vals)
else
{
/* Load from constant pool. */
emit_move_insn (target, gen_rtx_CONST_VECTOR (mode, XVEC (vals, 0)));
emit_move_insn (target, const_vec);
return;
}
}

View File

@ -1,3 +1,8 @@
2008-03-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR target/31334
* gcc.target/powerpc/altivec-25.c: Nnew testcase.
2008-03-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/35724

View File

@ -0,0 +1,20 @@
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec -O2 -Wall" } */
#define vector __attribute__((__vector_size__(16) ))
vector int f()
{
int t = 4;
return (vector int){t,t,t,t};
}
vector int f1()
{
return (vector int){4,4,4,4};
}
/* We should be able to materialize the constant vector without
any lvewx instructions as it is constant. */
/* { dg-final { scan-assembler-not "lvewx" } } */