diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-03 15:18:50 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-03 15:18:50 +0000 |
commit | 91cf53d57229fde78340ed7c24e3d07cc5b524eb (patch) | |
tree | 059bf88d3d7061144003b1f54c1c90062b165a56 /gcc/testsuite/gcc.dg/vect | |
parent | a1ce652b477210d1723fbe22abbe7842380cca3f (diff) | |
download | gcc-91cf53d57229fde78340ed7c24e3d07cc5b524eb.tar.gz |
PR tree-optimization/46009
* tree-ssa-phiopt.c (tree_ssa_phiopt_worker): Call
cond_if_else_store_replacement if bb1 and bb2 have the same
single successor.
(cond_store_replacement): Use gimple_assign_single_p, don't
check if rhs is SSA_NAME or invariant. Call release_defs for
assign.
(cond_if_else_store_replacement): New function.
* gcc.dg/vect/pr46009.c: New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166251 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/vect')
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr46009.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/pr46009.c b/gcc/testsuite/gcc.dg/vect/pr46009.c new file mode 100644 index 00000000000..457dd37907a --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr46009.c @@ -0,0 +1,74 @@ +/* PR tree-optimization/46009 */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +int a[1024] __attribute__((aligned)); +int b[1024] __attribute__((aligned)); +int c[1024] __attribute__((aligned)); +int d[1024] __attribute__((aligned)); +int e[1024] __attribute__((aligned)); + +void __attribute__((noinline)) +foo (void) +{ + int i, g; + for (i = 0; i < 1024; i++) + { + g = a[i] + b[i] + c[i] * d[i];; + e[i] = g < 10 ? 1 : g; + } +} + +void __attribute__((noinline)) +bar (void) +{ + int i, g; + for (i = 0; i < 1024; i++) + { + g = a[i] + b[i] + c[i] * d[i];; + if (g < 10) + e[i] = 1; + else + e[i] = g; + } +} + +int +main (void) +{ + int i; + check_vect (); + for (i = 0; i < 1024; i++) + { + asm volatile ("" : "+r" (i)); + a[i] = i % 10; + b[i] = i % 10; + c[i] = 1; + d[i] = -1; + e[i] = -1; + } + foo (); + for (i = 0; i < 1024; i++) + { + int g; + asm volatile ("" : "+r" (i)); + g = 2 * (i % 10) - 1; + if (e[i] != (g < 10 ? 1 : g)) + abort (); + e[i] = -1; + } + bar (); + for (i = 0; i < 1024; i++) + { + int g; + asm volatile ("" : "+r" (i)); + g = 2 * (i % 10) - 1; + if (e[i] != (g < 10 ? 1 : g)) + abort (); + } + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ |