tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees.

* tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees.
        * tree-vectorizer.h: New File: Same.
        * Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files.
        * common.opt (ftree-vectorize): New flag to enable vectorization.
        * timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization
        pass.
        * tree-data-ref.h (init_data_ref): Additional argument.
        (array_base_name_differ_p): Moved to tree-data-ref.c.
        * tree-data-ref.c (array_base_name_differ_p): Revised.
        (initialize_data_dependence_relation): Call array_base_name_differ_p
        with an extra argument.
        (analyze_all_data_dependences): Same.
        (init_data_ref): Additional argument is_read to set DR_IS_READ.
        * tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file.
        * tree-flow.h (vectorize_loops, empty_block_p): Add declaration.
        * tree-optimize.c (pass_vectorize): Schedule the vectorization pass.
        * tree-pass.h (tree_opt_pass pass_vectorize): Declare the new
        vectorization pass.
        * tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize.
        (tree_ssa_loop_done): Call scev_finalize.
        (tree_vectorize): Define the new vectorization pass.
        * defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of
        the vector they support (until support for multiple vector sizes is
        added to the vectorizer).
        * config/i386/i386.h (UNITS_PER_SIMD_WORD): Define.
        * config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define.
        * invoke.texi (fdump-tree-vect, ftree-vectorize): Add
        documentation.

From-SVN: r86131
This commit is contained in:
Dorit Naishlos 2004-08-17 16:17:14 +00:00 committed by Dorit Nuzman
parent baeff9708e
commit 79fe1b3bd0
81 changed files with 8167 additions and 29 deletions

View File

@ -1,3 +1,34 @@
2004-08-17 Dorit Naishlos <dorit@il.ibm.com>
* tree-vectorizer.c: New File: loop vectorization on SSAed GIMPLE trees.
* tree-vectorizer.h: New File: Same.
* Makefile.in (tree-vectorizer.c, tree-vectorizer.h): Add new files.
* common.opt (ftree-vectorize): New flag to enable vectorization.
* timevar.def (TV_TREE_VECTORIZATION): New dump file for vectorization
pass.
* tree-data-ref.h (init_data_ref): Additional argument.
(array_base_name_differ_p): Moved to tree-data-ref.c.
* tree-data-ref.c (array_base_name_differ_p): Revised.
(initialize_data_dependence_relation): Call array_base_name_differ_p
with an extra argument.
(analyze_all_data_dependences): Same.
(init_data_ref): Additional argument is_read to set DR_IS_READ.
* tree-ssa-phiopt.c (empty_block_p): Expose for usage out of this file.
* tree-flow.h (vectorize_loops, empty_block_p): Add declaration.
* tree-optimize.c (pass_vectorize): Schedule the vectorization pass.
* tree-pass.h (tree_opt_pass pass_vectorize): Declare the new
vectorization pass.
* tree-ssa-loop.c (tree_ssa_loop_init): Call scev_initialize.
(tree_ssa_loop_done): Call scev_finalize.
(tree_vectorize): Define the new vectorization pass.
* defaults.h (UNITS_PER_SIMD_WORD): Allow targets to specify the size of
the vector they support (until support for multiple vector sizes is
added to the vectorizer).
* config/i386/i386.h (UNITS_PER_SIMD_WORD): Define.
* config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Define.
* invoke.texi (fdump-tree-vect, ftree-vectorize): Add
documentation.
2004-08-17 Nathan Sidwell <nathan@codesourcery.com>
* objc/objc-act.c (build_protocol_initializer): Fix build_int_cst

View File

@ -887,6 +887,7 @@ OBJS-common = \
tree-ssa-dom.o domwalk.o tree-tailcall.o gimple-low.o tree-iterator.o \
tree-phinodes.o tree-ssanames.o tree-sra.o tree-complex.o tree-ssa-loop.o \
tree-ssa-loop-niter.o tree-ssa-loop-manip.o tree-ssa-threadupdate.o \
tree-vectorizer.o \
alias.o bb-reorder.o bitmap.o builtins.o caller-save.o calls.o \
cfg.o cfganal.o cfgbuild.o cfgcleanup.o cfglayout.o cfgloop.o \
cfgloopanal.o cfgloopmanip.o loop-init.o loop-unswitch.o loop-unroll.o \
@ -1727,6 +1728,10 @@ tree-data-ref.o: tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
errors.h $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) diagnostic.h \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) cfgloop.h \
tree-data-ref.h $(SCEV_H) tree-pass.h lambda.h
tree-vectorizer.o: tree-vectorizer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
errors.h $(GGC_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) diagnostic.h \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) cfgloop.h tree-pass.h \
tree-vectorizer.h tree-data-ref.h $(SCEV_H)
tree-gimple.o : tree-gimple.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(EXPR_H) \
$(RTL_H) $(TREE_GIMPLE_H) $(TM_H) coretypes.h bitmap.h $(GGC_H)
tree-mudflap.o : $(CONFIG_H) errors.h $(SYSTEM_H) $(TREE_H) tree-inline.h \

View File

@ -907,6 +907,10 @@ fvar-tracking
Common Report Var(flag_var_tracking) VarExists
Perform variable tracking
ftree-vectorize
Common Report Var(flag_tree_vectorize)
Enable loop vectorization on trees
; -fverbose-asm causes extra commentary information to be produced in
; the generated assembly code (to make it more readable). This option
; is generally only of use to those who actually need to read the

View File

@ -674,6 +674,10 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE!
#define VECTOR_MODE_SUPPORTED_P(MODE) 0
#endif
#ifndef UNITS_PER_SIMD_WORD
#define UNITS_PER_SIMD_WORD 0
#endif
/* Determine whether __cxa_atexit, rather than atexit, is used to
register C++ destructors for local statics and global objects. */
#ifndef DEFAULT_USE_CXA_ATEXIT

View File

@ -263,7 +263,7 @@ Objective-C and Objective-C++ Dialects}.
-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
-fdump-tree-nrv @gol
-fdump-tree-nrv -fdump-tree-vect @gol
-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
@ -318,7 +318,7 @@ Objective-C and Objective-C++ Dialects}.
-ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol
-ftree-lim @gol
-ftree-dominator-opts -ftree-dse -ftree-copyrename @gol
-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre @gol
-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol
--param @var{name}=@var{value}
-O -O0 -O1 -O2 -O3 -Os}
@ -3664,6 +3664,11 @@ Dump each function after applying the named return value optimization on
generic trees. The file name is made by appending @file{.nrv} to the source
file name.
@item vect
@opindex fdump-tree-vect
Dump each function after applying vectorization of loops. The file name is
made by appending @file{.vect} to the source file name.
@item all
@opindex fdump-tree-all
Enable all the available tree dumps with the flags provided in this option.
@ -4499,6 +4504,9 @@ Perform live range splitting during the SSA->normal phase. Distinct live
ranges of a variable are split into unique variables, allowing for better
optimization later. This is enabled by default at -O and higher.
@item -ftree-vectorize
Perform loop vectorization on trees.
@item -ftracer
@opindex ftracer
Perform tail duplication to enlarge superblock size. This transformation

View File

@ -1,3 +1,8 @@
2004-08-17 Dorit Naishlos <dorit@il.ibm.com>
* gcc.dg/vect: New directory for vectorizer tests.
(vect-*.c): New tests.
2004-08-17 Paul Brook <paul@codesourcery.com>
PR fortran/13082

View File

@ -0,0 +1,22 @@
/* { dg-do compile { target powerpc*-*-* i?86-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* } } */
#define VECTOR_SIZE 512
typedef float afloat __attribute__ ((__aligned__(16)));
extern void check(const afloat * __restrict__ v);
void square(const afloat * __restrict__ a,
afloat * __restrict__ out)
{
unsigned int i;
for (i = 0; i < VECTOR_SIZE; i++) {
float ai = a[i];
float a2 = ai * ai;
out[i] = a2;
}
check(out);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"} } */

View File

@ -0,0 +1,24 @@
/* Check if system supports SIMD */
#include <signal.h>
extern void abort (void);
extern void exit (int);
void
sig_ill_handler (int sig)
{
exit(0);
}
void check_vect (void)
{
signal(SIGILL, sig_ill_handler);
#if defined(__ppc__) || defined(__ppc64__)
/* Altivec instruction, 'vor %v0,%v0,%v0'. */
asm volatile (".long 0x10000484");
#elif defined(__i386__) || defined(__x86_64__)
/* SSE2 instruction: movsd %xmm0,%xmm0 */
asm volatile (".byte 0xf2,0x0f,0x10,0xc0");
#endif
signal (SIGILL, SIG_DFL);
}

View File

@ -0,0 +1,102 @@
/* { dg-do compile { target powerpc*-*-* i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#define N 16
void fbar (float *);
void ibar (int *);
void sbar (short *);
/* multiple loops */
foo (int n)
{
float a[N+1];
float b[N];
float c[N];
float d[N];
int ia[N];
int ib[N];
int ic[N];
short sa[N];
short sb[N];
short sc[N];
int i,j;
int diff = 0;
char cb[N];
char cc[N];
char image[N][N];
char block[N][N];
/* Not vetorizable yet (cross-iteration cycle). */
diff = 0;
for (i = 0; i < N; i++) {
diff += (cb[i] - cc[i]);
}
ibar (&diff);
/* Not vetorizable yet (outer-loop: not attempted.
inner-loop: cross iteration cycle; multi-dimensional arrays). */
diff = 0;
for (i = 0; i < N; i++) {
for (i = 0; i < N; i++) {
diff += (image[i][j] - block[i][j]);
}
}
ibar (&diff);
/* Vectorizable. */
for (i = 0; i < N; i++){
a[i] = b[i];
}
fbar (a);
/* Vectorizable. */
for (i = 0; i < N; i++){
a[i] = b[i] + c[i] + d[i];
}
fbar (a);
/* Not vetorizable yet (access pattern). */
for (i = 0; i < N/2; i++){
a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
}
fbar (a);
/* Vectorizable. */
for (i = 0; i < N; i++){
a[i] = b[i] + c[i];
d[i] = b[i] + c[i];
ia[i] = ib[i] + ic[i];
}
ibar (ia);
fbar (a);
fbar (d);
/* Not vectorizable yet (two types with different nunits in vector). */
for (i = 0; i < N; i++){
ia[i] = ib[i] + ic[i];
sa[i] = sb[i] + sc[i];
}
ibar (ia);
sbar (sa);
/* Not vetorizable yet (too conservative dependence test). */
for (i = 0; i < N; i++){
a[i] = b[i] + c[i];
a[i+1] = b[i] + c[i];
}
fbar (a);
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,27 @@
/* { dg-do compile { target powerpc*-*-* i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#define N 16
short a[N];
short d[N];
int foo ()
{
int i;
short b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
/* Not vetorizable yet (strided access pattern). */
for (i = 0; i < N/2; i++)
{
a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */

View File

@ -0,0 +1,41 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
int i;
int ia[N];
int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Not vetorizable yet (integer mult). */
for (i = 0; i < N; i++)
{
ia[i] = ib[i] * ic[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != ib[i] * ic[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */

View File

@ -0,0 +1,45 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
int i;
int ia[N];
int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short sa[N];
short sc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Not vetorizable yet (multiple types with different nunits in vector). */
for (i = 0; i < N; i++)
{
ia[i] = ib[i] + ic[i];
sa[i] = sb[i] + sc[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != ib[i] + ic[i] || sa[i] != sb[i] + sc[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,25 @@
/* { dg-do compile { target powerpc*-*-* i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#define N 16
int a[N];
int results[N] = {0,1,2,3,0,0,0,0,0,0,0,0,12,13,14,15};
int main ()
{
int i;
int b[N] = {0,1,2,3,-4,-5,-6,-7,-8,-9,-10,-11,12,13,14,15};
/* Not vectorizable yet (condition in loop). */
for (i = 0; i < N; i++)
{
a[i] = (b[i] >= 0 ? b[i] : 0);
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,39 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
int i;
int ia[N];
/* Not vetorizable yet (induction). */
for ( i = 0; i < N; i++) {
ia[i] = i;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != i)
abort ();
}
return 0;
}
int main (void)
{
check_vect();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,40 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
int i;
int a[N];
int b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Not vetorizable yet (reverse access and forward access). */
for (i = N; i > 0; i--)
{
a[N-i] = b[i-1];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (a[i] != b[N-1-i])
abort ();
}
return 0;
}
int main (void)
{
check_vect();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,39 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define DIFF 240
int main1 ()
{
int i;
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
float diff;
/* Not vetorizable yet (reduction). */
diff = 0;
for (i = 0; i < N; i++) {
diff += (b[i] - c[i]);
}
/* check results: */
if (diff != DIFF)
abort ();
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,130 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
int
main1 ()
{
int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
int ic[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char ca[N];
char cb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char cc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sa[N];
short sb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
/* Check ints. */
for (i = 0; i < N; i++)
{
ia[i] = ib[i] & ic[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ia[i] != ib[i] & ic[i])
abort ();
}
/* Check chars. */
for (i = 0; i < N; i++)
{
ca[i] = cb[i] & cc[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ca[i] != cb[i] & cc[i])
abort ();
}
/* Check shorts. */
for (i = 0; i < N; i++)
{
sa[i] = sb[i] & sc[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (sa[i] != sb[i] & sc[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,129 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
int
main1 ()
{
int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
int ic[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char ca[N];
char cb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char cc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sa[N];
short sb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
/* Check ints. */
for (i = 0; i < N; i++)
{
ia[i] = (ib[i] | ic[i]);
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ia[i] != (ib[i] | ic[i]))
abort ();
}
/* Check chars. */
for (i = 0; i < N; i++)
{
ca[i] = (cb[i] | cc[i]);
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ca[i] != (cb[i] | cc[i]))
abort ();
}
/* Check shorts. */
for (i = 0; i < N; i++)
{
sa[i] = (sb[i] | sc[i]);
}
/* check results: */
for (i = 0; i <N; i++)
{
if (sa[i] != (sb[i] | sc[i]))
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,129 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
int
main1 ()
{
int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
int ic[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char ca[N];
char cb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char cc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sa[N];
short sb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
/* Check ints. */
for (i = 0; i < N; i++)
{
ia[i] = ib[i] ^ ic[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ia[i] != ib[i] ^ ic[i])
abort ();
}
/* Check chars. */
for (i = 0; i < N; i++)
{
ca[i] = cb[i] ^ cc[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ca[i] != cb[i] ^ cc[i])
abort ();
}
/* Check shorts. */
for (i = 0; i < N; i++)
{
sa[i] = sb[i] ^ sc[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (sa[i] != sb[i] ^ sc[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,40 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char ca[N];
int i;
for (i = 0; i < N; i++)
{
ca[i] = cb[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ca[i] != cb[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,129 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
int
main1 ()
{
int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
int ic[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char ca[N];
char cb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char cc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sa[N];
short sb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
/* Check ints. */
for (i = 0; i < N; i++)
{
ia[i] = ~ib[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ia[i] != ~ib[i])
abort ();
}
/* Check chars. */
for (i = 0; i < N; i++)
{
ca[i] = ~cb[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ca[i] != ~cb[i])
abort ();
}
/* Check shorts. */
for (i = 0; i < N; i++)
{
sa[i] = ~sb[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (sa[i] != ~sb[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,130 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
int
main1 ()
{
int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
int ic[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char ca[N];
char cb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char cc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sa[N];
short sb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
/* Check ints. */
for (i = 0; i < N; i++)
{
ia[i] = !ib[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ia[i] != !ib[i])
abort ();
}
/* Check chars. */
for (i = 0; i < N; i++)
{
ca[i] = !cb[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ca[i] != !cb[i])
abort ();
}
/* Check shorts. */
for (i = 0; i < N; i++)
{
sa[i] = !sb[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (sa[i] != !sb[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,130 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
int
main1 ()
{
int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
int ic[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char ca[N];
char cb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char cc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sa[N];
short sb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
/* Check ints. */
for (i = 0; i < N; i++)
{
ia[i] = -ib[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ia[i] != -ib[i])
abort ();
}
/* Check chars. */
for (i = 0; i < N; i++)
{
ca[i] = -cb[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ca[i] != -cb[i])
abort ();
}
/* Check shorts. */
for (i = 0; i < N; i++)
{
sa[i] = -sb[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (sa[i] != -sb[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,130 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
int
main1 ()
{
int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
int ic[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char ca[N];
char cb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char cc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sa[N];
short sb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
/* Check ints. */
for (i = 0; i < N; i++)
{
ia[i] = ib[i] && ic[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ia[i] != ib[i] && ic[i])
abort ();
}
/* Check chars. */
for (i = 0; i < N; i++)
{
ca[i] = cb[i] && cc[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ca[i] != cb[i] && cc[i])
abort ();
}
/* Check shorts. */
for (i = 0; i < N; i++)
{
sa[i] = sb[i] && sc[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (sa[i] != sb[i] && sc[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,130 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
int
main1 ()
{
int i;
int ia[N];
int ib[N]=
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
int ic[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char ca[N];
char cb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
char cc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sa[N];
short sb[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
short sc[N] =
{1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0,
1,1,0,0,1,0,1,0};
/* Check ints. */
for (i = 0; i < N; i++)
{
ia[i] = (ib[i] || ic[i]);
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ia[i] != (ib[i] || ic[i]))
abort ();
}
/* Check chars. */
for (i = 0; i < N; i++)
{
ca[i] = (cb[i] || cc[i]);
}
/* check results: */
for (i = 0; i <N; i++)
{
if (ca[i] != (cb[i] || cc[i]))
abort ();
}
/* Check shorts. */
for (i = 0; i < N; i++)
{
sa[i] = (sb[i] || sc[i]);
}
/* check results: */
for (i = 0; i <N; i++)
{
if (sa[i] != (sb[i] || sc[i]))
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,56 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 128
int main1 (int n, int *p)
{
int i;
int ib[N];
int ia[N];
int k;
for (i = 0; i < N; i++)
{
ia[i] = n;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != n)
abort ();
}
k = *p;
for (i = 0; i < N; i++)
{
ib[i] = k;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ib[i] != k)
abort ();
}
return 0;
}
int main (void)
{
int m = 8;
check_vect ();
return main1 (m, &m);
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,41 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 128
/* unaligned store. */
int main1 ()
{
int i;
int ia[N+1];
for (i = 1; i <= N; i++)
{
ia[i] = 5;
}
/* check results: */
for (i = 1; i <= N; i++)
{
if (ia[i] != 5)
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,47 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 128
/* unaligned load. */
int main1 ()
{
int i;
int ia[N];
int ib[N+1];
for (i=0; i < N; i++)
{
ib[i] = i;
}
for (i = 1; i <= N; i++)
{
ia[i-1] = ib[i];
}
/* check results: */
for (i = 1; i <= N; i++)
{
if (ia[i-1] != ib[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,44 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 128
#define OFF 3
/* unaligned store. */
int main1 (int off)
{
int i;
int ia[N+OFF];
for (i = 0; i < N; i++)
{
ia[i+off] = 5;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i+off] != 5)
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
main1 (0); /* aligned */
main1 (OFF); /* unaligned */
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,50 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 128
#define OFF 3
/* unaligned load. */
int main1 (int off)
{
int i;
int ia[N];
int ib[N+OFF];
for (i = 0; i < N+OFF; i++)
{
ib[i] = i;
}
for (i = 0; i < N; i++)
{
ia[i] = ib[i+off];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != ib[i+off])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
main1 (0); /* aligned */
main1 (OFF); /* unaligned */
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,54 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 20
int
main1 ()
{
int i;
float a[N];
float e[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ia[N];
for (i = 0; i < N; i++)
{
a[i] = b[i] + c[i] + d[i];
e[i] = b[i] + c[i] + d[i];
ia[i] = ib[i] + ic[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
float fres = b[i] + c[i] + d[i];
int ires = ib[i] + ic[i];
if (a[i] != fres || e[i] != fres || ia[i] != ires)
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,65 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
float b[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
float a[N];
float c[N];
int main1 (int n)
{
int i=0;
/* Vectorized: unknown loop bound. */
while (n--) {
a[i] = b[i];
i++;
}
/* check results: */
for (i = 0; i < n; i++)
{
if (a[i] != b[i])
abort ();
}
return 0;
}
int main2 (unsigned int n)
{
int i=0;
int nn = n;
/* Vectorized: unknown loop bound. */
while (n--) {
c[i] = b[i];
i++;
}
/* check results: */
for (i = 0; i < nn; i++)
{
if (c[i] != b[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
main1 (N);
main2 (N);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,92 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 32
struct t{
int k[N];
int l;
};
struct s{
char a; /* aligned */
char b[N-1]; /* unaligned (offset 1B) */
char c[N]; /* aligned (offset NB) */
struct t d; /* aligned (offset 2NB) */
struct t e; /* unaligned (offset 2N+4N+4 B) */
};
int main1 ()
{
int i;
struct s tmp;
/* unaligned */
for (i = 0; i < N/2; i++)
{
tmp.b[i] = 5;
}
/* check results: */
for (i = 0; i <N/2; i++)
{
if (tmp.b[i] != 5)
abort ();
}
/* aligned */
for (i = 0; i < N/2; i++)
{
tmp.c[i] = 6;
}
/* check results: */
for (i = 0; i <N/2; i++)
{
if (tmp.c[i] != 6)
abort ();
}
/* aligned */
for (i = 0; i < N/2; i++)
{
tmp.d.k[i] = 7;
}
/* check results: */
for (i = 0; i <N/2; i++)
{
if (tmp.d.k[i] != 7)
abort ();
}
/* unaligned */
for (i = 0; i < N/2; i++)
{
tmp.e.k[i] = 8;
}
/* check results: */
for (i = 0; i <N/2; i++)
{
if (tmp.e.k[i] != 8)
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,41 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
struct {
char ca[N];
} s;
int i;
for (i = 0; i < N; i++)
{
s.ca[i] = 5;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (s.ca[i] != 5)
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,41 @@
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-S -O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-S -O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
struct test {
char ca[N];
};
extern struct test s;
int main1 ()
{
int i;
for (i = 0; i < N; i++)
{
s.ca[i] = 5;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (s.ca[i] != 5)
abort ();
}
return 0;
}
int main (void)
{
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,42 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
struct {
char ca[N];
} s;
char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int i;
for (i = 0; i < N; i++)
{
s.ca[i] = cb[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (s.ca[i] != cb[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,50 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
typedef char achar __attribute__ ((__aligned__(16)));
#define N 16
achar x[N];
int main1 ()
{
union {
achar a[N];
achar b[N];
} s;
int i;
for (i = 0; i < N; i++)
{
s.b[i] = 3*i;
}
for (i = 0; i < N; i++)
{
s.a[i] = s.b[i] + 1;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (s.a[i] != s.b[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */

View File

@ -0,0 +1,47 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
struct {
char ca[N];
char cb[N];
} s;
int i;
for (i = 0; i < N; i++)
{
s.cb[i] = 3*i;
}
for (i = 0; i < N; i++)
{
s.ca[i] = s.cb[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (s.ca[i] != s.cb[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,61 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
typedef char achar __attribute__ ((__aligned__(16)));
#define N 16
achar x[N];
int main1 (achar *y)
{
struct {
achar *p;
achar *q;
} s;
achar cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int i;
s.p = y;
for (i = 0; i < N; i++)
{
s.p[i] = cb[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (s.p[i] != cb[i])
abort ();
}
s.q = cb;
for (i = 0; i < N; i++)
{
s.p[i] = s.q[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (s.p[i] != s.q[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 (x);
}
/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,41 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
double cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
double ca[N];
int main1 ()
{
int i;
for (i = 0; i < N; i++)
{
ca[i] = cb[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ca[i] != cb[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail powerpc*-*-* } } } */

View File

@ -0,0 +1,42 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 20
int
main1 ()
{
int i;
float a[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
for (i = 0; i < N; i++)
{
a[i] = b[i] * c[i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (a[i] != b[i] * c[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,55 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
{
int i;
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
}
return 0;
}
int main (void)
{
int i;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
bar (a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"} } */

View File

@ -0,0 +1,56 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (afloat * pa, afloat * pb, afloat * pc)
{
int i;
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,58 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (afloat * __restrict__ pa)
{
int i;
afloat pb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat pc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
}
return 0;
}
int main (void)
{
int i;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a);
bar (a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"} } */

View File

@ -0,0 +1,59 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (afloat * pa)
{
int i;
afloat pb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat pc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */

View File

@ -0,0 +1,55 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
void bar (float *pa, float *pb, float *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (float * __restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
{
int i;
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
float a[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,55 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
void bar (const float *pa, const float *pb, const float *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (float *pa, float *pb, float *pc)
{
int i;
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
float a[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,56 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort();
}
return;
}
int
main1 (int n , afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
{
int i;
for (i = 0; i < n; i++)
{
pa[i] = pb[i] * pc[i];
}
return 0;
}
int main (void)
{
int i;
int n=N;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n,a,b,c);
bar (a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,57 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (int n , afloat * pa, afloat * pb, afloat * pc)
{
int i;
for (i = 0; i < n; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
int n=N;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n,a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,56 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (float *pa, float *pb, float *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (afloat * __restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
{
int i;
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
float a[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,56 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (const float *pa, const float *pb, const float *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (afloat *pa, float *pb, float *pc)
{
int i;
for (i = 0; i < N; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
float a[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,58 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
int i, j;
float a[N];
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
i = 0;
j = 0;
while (i < 5*N)
{
a[j] = c[j];
i += 5;
j++;
}
/* check results: */
for (i = 0; i <N; i++)
{
if (a[i] != c[i])
abort ();
}
for (i = N; i > 0; i--)
{
a[N-i] = d[N-i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (a[i] != d[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,54 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
void bar (float *pa, float *pb, float *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (int n, float * __restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
{
int i;
for (i = 0; i < n; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
float a[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (N,a,b,c);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,54 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
void bar (const float *pa, const float *pb, const float *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (int n, float *pa, float *pb, float *pc)
{
int i;
for (i = 0; i < n; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
float a[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (N,a,b,c);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,56 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (float *pa, float *pb, float *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (int n, afloat * __restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
{
int i;
for (i = 0; i < n; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
check_vect ();
main1 (N,a,&b[1],c);
main1 (N,a,&b[1],&c[1]);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,56 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (const float *pa, const float *pb, const float *pc)
{
int i;
/* check results: */
for (i = 0; i < N; i++)
{
if (pa[i] != (pb[i] * pc[i]))
abort ();
}
return;
}
int
main1 (int n, afloat *pa, float *pb, float *pc)
{
int i;
for (i = 0; i < n; i++)
{
pa[i] = pb[i] * pc[i];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
afloat a[N];
afloat b[N+1] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
afloat c[N+1] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
check_vect ();
main1 (N,a,&b[1],c);
main1 (N,a,&b[1],&c[1]);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,55 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i+1] != (pb[i+1] * pc[i+1]))
abort ();
}
return;
}
int
main1 (afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
{
int i;
for (i = 0; i < N/2; i++)
{
pa[i+1] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,55 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i+1] != (pb[i+1] * pc[i+1]))
abort ();
}
return;
}
int
main1 (afloat * pa, afloat * pb, afloat * pc)
{
int i;
for (i = 0; i < N/2; i++)
{
pa[i+1] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,55 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i] != (pb[i+1] * pc[i+1]))
abort ();
}
return;
}
int
main1 (afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
{
int i;
for (i = 0; i < N/2; i++)
{
pa[i] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,55 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i] != (pb[i+1] * pc[i+1]))
abort ();
}
return;
}
int
main1 (afloat * pa, afloat * pb, afloat * pc)
{
int i;
for (i = 0; i < N/2; i++)
{
pa[i] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (a,b,c);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,56 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i+1] != (pb[i+1] * pc[i+1]))
abort ();
}
return;
}
int
main1 (int n , afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
{
int i;
for (i = 0; i < n/2; i++)
{
pa[i+1] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
int n=N;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n,a,b,c);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,56 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i+1] != (pb[i+1] * pc[i+1]))
abort ();
}
return;
}
int
main1 (int n , afloat * pa, afloat * pb, afloat * pc)
{
int i;
for (i = 0; i < n/2; i++)
{
pa[i+1] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
int n=N;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n,a,b,c);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,61 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
float results1[N] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,0.00};
float results2[N] = {0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
int main1 ()
{
int i;
float a[N] = {0};
float e[N] = {0};
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
for (i = 0; i < N/2; i++)
{
a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
e[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
}
/* check results: */
for (i=0; i<N; i++)
{
if (a[i] != results1[i] || e[i] != results2[i])
abort();
}
for (i = 1; i <=N-4; i++)
{
a[i+3] = b[i-1];
}
/* check results: */
for (i = 1; i <=N-4; i++)
{
if (a[i+3] != b[i-1])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,56 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i] != (pb[i+1] * pc[i+1]))
abort ();
}
return;
}
int
main1 (int n , afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
{
int i;
for (i = 0; i < n/2; i++)
{
pa[i] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
int n=N;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n,a,b,c);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,56 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 256
typedef float afloat __attribute__ ((__aligned__(16)));
void bar (afloat *pa, afloat *pb, afloat *pc)
{
int i;
/* check results: */
for (i = 0; i < N/2; i++)
{
if (pa[i] != (pb[i+1] * pc[i+1]))
abort ();
}
return;
}
int
main1 (int n , afloat * pa, afloat * pb, afloat * pc)
{
int i;
for (i = 0; i < n/2; i++)
{
pa[i] = pb[i+1] * pc[i+1];
}
bar (pa,pb,pc);
return 0;
}
int main (void)
{
int i;
int n=N;
afloat a[N];
afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
main1 (n,a,b,c);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,52 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 128
int main1 ()
{
int i;
short sa[N];
short sb[N];
for (i = 0; i < N; i++)
{
sb[i] = 5;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (sb[i] != 5)
abort ();
}
for (i = 0; i < N; i++)
{
sa[i] = sb[i] + 100;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (sa[i] != 105)
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,40 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
float b[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
float a[N];
int main1 (int n)
{
int i;
/* Vectorized: unknown loop bound). */
for (i = 0; i < n; i++){
a[i] = b[i];
}
/* check results: */
for (i = 0; i < n; i++)
{
if (a[i] != b[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 (N);
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,40 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
int i;
short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ia[N];
/* Not vetorizable yet (type cast). */
for (i = 0; i < N; i++)
{
ia[i] = (int) sb[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != (int) sb[i])
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */

View File

@ -0,0 +1,218 @@
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int iadd_results[N] = {0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90};
float fadd_results[N] = {0.0,6.0,12.0,18.0,24.0,30.0,36.0,42.0,48.0,54.0,60.0,66.0,72.0,78.0,84.0,90.0};
float fmul_results[N] = {0.0,3.0,12.0,27.0,48.0,75.0,108.0,147.0,192.0,243.0,300.0,363.0,432.0,507.0,588.0,675.0};
float fresults1[N] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,48.00,54.00,60.00,66.00,72.00,78.00,84.00,90.00};
float fresults2[N] = {0.00,6.00,12.00,18.00,24.00,30.00,36.00,42.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
/****************************************************/
void icheck_results (int *a, int *results)
{
int i;
for (i = 0; i < N; i++)
{
if (a[i] != results[i])
abort ();
}
}
void fcheck_results (float *a, float *results)
{
int i;
for (i = 0; i < N; i++)
{
if (a[i] != results[i])
abort ();
}
}
void
fbar_mul (float *a)
{
fcheck_results (a, fmul_results);
}
void
fbar_add (float *a)
{
fcheck_results (a, fadd_results);
}
void
ibar_add (int *a)
{
icheck_results (a, iadd_results);
}
void
fbar1 (float *a)
{
fcheck_results (a, fresults1);
}
void
fbar2 (float *a)
{
fcheck_results (a, fresults2);
}
/* All of the loops below are currently vectorizable. */
int
main1 ()
{
int i,j;
float a[N];
float e[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ia[N];
char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char ca[N];
short sa[N];
/* Test 1: copy chars. */
for (i = 0; i < N; i++)
{
ca[i] = cb[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ca[i] != cb[i])
abort ();
}
/* Test 2: fp mult. */
for (i = 0; i < N; i++)
{
a[i] = b[i] * c[i];
}
fbar_mul (a);
/* Test 3: mixed types (int, fp), same nunits in vector. */
for (i = 0; i < N; i++)
{
a[i] = b[i] + c[i] + d[i];
e[i] = b[i] + c[i] + d[i];
ia[i] = ib[i] + ic[i];
}
ibar_add (ia);
fbar_add (a);
fbar_add (e);
/* Test 4: access with offset. */
for (i = 0; i < N/2; i++)
{
a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
e[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
}
fbar1 (a);
fbar2 (e);
/* Test 5: access with offset */
for (i = 1; i <=N-4; i++)
{
a[i+3] = b[i-1];
}
/* check results: */
for (i = 1; i <=N-4; i++)
{
if (a[i+3] != b[i-1])
abort ();
}
/* Test 6 - loop induction with stride != 1. */
i = 0;
j = 0;
while (i < 5*N)
{
a[j] = c[j];
i += 5;
j++;
}
/* check results: */
for (i = 0; i <N; i++)
{
if (a[i] != c[i])
abort ();
}
/* Test 7 - reverse access. */
for (i = N; i > 0; i--)
{
a[N-i] = d[N-i];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (a[i] != d[i])
abort ();
}
/* Tests 8,9,10 - constants. */
for (i = 0; i < N; i++)
{
a[i] = 5.0;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (a[i] != 5.0)
abort ();
}
for (i = 0; i < N; i++)
{
sa[i] = 5;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (sa[i] != 5)
abort ();
}
for (i = 0; i < N; i++)
{
ia[i] = ib[i] + 5;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != ib[i] + 5)
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* xfail: local arrays can't be aligned on a boundary greater than STACK_BOUNDARY */
/* { dg-final { scan-tree-dump-times "vectorized 10 loops" 1 "vect" {xfail i?86-*-* x86_64-*-*} } } */

View File

@ -0,0 +1,193 @@
/* { dg-do compile { target powerpc*-*-* i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -msse2" { target i?86-*-* x86_64-*-* } } */
#define N 16
extern void abort (void);
int iadd_results[N] = {0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90};
float fadd_results[N] = {0.0,6.0,12.0,18.0,24.0,30.0,36.0,42.0,48.0,54.0,60.0,66.0,72.0,78.0,84.0,90.0};
float fmul_results[N] = {0.0,3.0,12.0,27.0,48.0,75.0,108.0,147.0,192.0,243.0,300.0,363.0,432.0,507.0,588.0,675.0};
float fresults1[N] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,48.00,54.00,60.00,66.00,72.00,78.00,84.00,90.00};
float fresults2[N] = {0.00,6.00,12.00,18.00,24.00,30.00,36.00,42.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
/****************************************************/
void icheck_results (int *a, int *results)
{
int i;
for (i = 0; i < N; i++)
{
if (a[i] != results[i])
abort ();
}
}
void fcheck_results (float *a, float *results)
{
int i;
for (i = 0; i < N; i++)
{
if (a[i] != results[i])
abort ();
}
}
void
fbar_mul (float *a)
{
fcheck_results (a, fmul_results);
}
void
fbar_add (float *a)
{
fcheck_results (a, fadd_results);
}
void
ibar_add (int *a)
{
icheck_results (a, iadd_results);
}
void
fbar1 (float *a)
{
fcheck_results (a, fresults1);
}
void
fbar2 (float *a)
{
fcheck_results (a, fresults2);
}
/* None of the loops below is currently vectorizable. The vectorizer will
be enhanced to vectorize most of these loops. */
int
foo (int n)
{
int i,j;
float a[N];
float e[N];
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
short sc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short sa[N];
int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ia[N];
int diff = 0;
char cb[N];
char cc[N];
char image[N][N];
char block[N][N];
/* Test 1 - unknown loop bound. */
for (i = 0; i < n; i++)
{
a[i] = b[i];
}
fbar (a);
/* Test 2 - type cast. */
for (i = 0; i < N; i++)
{
ia[i] = (int) sb[i];
}
fbar (a);
/* Test 3 - strided access pattern. */
for (i = 0; i < N/2; i++)
{
a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
}
fbar (a);
/* Test 4 - no target support for integer mult. */
for (i = 0; i < N; i++)
{
ia[i] = ib[i] * ic[i];
}
ibar (ia);
/* Test 5 - two types with different nunits in vector. */
for (i = 0; i < N; i++)
{
ia[i] = ib[i] + ic[i];
sa[i] = sb[i] + sc[i];
}
ibar (ia);
sbar (sa);
/* Test 6 - too conservative dependence test. */
for (i = 0; i < N; i++){
a[i] = b[i] + c[i];
a[i+1] = b[i] + c[i];
}
fbar (a);
/* Test 7 - condition in loop. */
for (i = 0; i < N; i++){
a[i] = (b[i] > 0 ? b[i] : 0);
}
fbar (a);
/* Test 8 - cross-iteration cycle. */
diff = 0;
for (i = 0; i < N; i++) {
diff += (cb[i] - cc[i]);
}
ibar (&diff);
/* Test 9 - outer-loop not attempted; inner-loop has cross
iteration cycle and multi-dimensional arrays. */
diff = 0;
for (i = 0; i < N; i++) {
for (i = 0; i < N; i++) {
diff += (image[i][j] - block[i][j]);
}
}
ibar (&diff);
/* Test 10 - induction. */
for ( i = 0; i < N; i++) {
a[i] = i;
}
fbar (a);
/* Test 11 - reverse access and forward access. */
for (i = N; i > 0; i--)
{
a[N-i] = b[i-1];
}
/* check results: */
for (i = 0; i <N; i++)
{
if (a[i] != b[N-1-i])
abort ();
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized " 3 "vect"} } */
/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 3 "vect"} } */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */

View File

@ -0,0 +1,35 @@
# Copyright (C) 1997 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# GCC testsuite that uses the `dg.exp' driver.
# Load support procs.
load_lib gcc-dg.exp
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
set DEFAULT_CFLAGS " -ansi -pedantic-errors"
}
# Initialize `dg'.
dg-init
# Main loop.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" $DEFAULT_CFLAGS
# All done.
dg-finish

View File

@ -83,6 +83,7 @@ DEFTIMEVAR (TV_TREE_CD_DCE , "tree aggressive DCE")
DEFTIMEVAR (TV_TREE_DSE , "tree DSE")
DEFTIMEVAR (TV_TREE_LOOP , "tree loop optimization")
DEFTIMEVAR (TV_LIM , "loop invariant motion")
DEFTIMEVAR (TV_TREE_VECTORIZATION , "tree loop vectorization")
DEFTIMEVAR (TV_TREE_CH , "tree copy headers")
DEFTIMEVAR (TV_TREE_SSA_TO_NORMAL , "tree SSA to normal")
DEFTIMEVAR (TV_TREE_NRV , "tree NRV optimization")

View File

@ -99,6 +99,110 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
static unsigned int data_ref_id = 0;
/* This is the simplest data dependence test: determines whether the
data references A and B access the same array/region. If can't determine -
return false; Otherwise, return true, and DIFFER_P will record
the result. This utility will not be necessary when alias_sets_conflict_p
will be less conservative. */
bool
array_base_name_differ_p (struct data_reference *a,
struct data_reference *b,
bool *differ_p)
{
tree base_a = DR_BASE_NAME (a);
tree base_b = DR_BASE_NAME (b);
tree ta = TREE_TYPE (base_a);
tree tb = TREE_TYPE (base_b);
/** Determine if same base **/
/* array accesses: a[i],b[i] or pointer accesses: *a,*b. bases are a,b. */
if (base_a == base_b)
{
*differ_p = false;
return true;
}
/* pointer based accesses - (*p)[i],(*q)[j]. bases are (*p),(*q) */
if (TREE_CODE (base_a) == INDIRECT_REF && TREE_CODE (base_b) == INDIRECT_REF
&& TREE_OPERAND (base_a, 0) == TREE_OPERAND (base_b, 0))
{
*differ_p = false;
return true;
}
/* record/union based accesses - s.a[i], t.b[j]. bases are s.a,t.b. */
if (TREE_CODE (base_a) == COMPONENT_REF && TREE_CODE (base_b) == COMPONENT_REF
&& TREE_OPERAND (base_a, 0) == TREE_OPERAND (base_b, 0)
&& TREE_OPERAND (base_a, 1) == TREE_OPERAND (base_b, 1))
{
*differ_p = false;
return true;
}
/** Determine if different bases **/
/* at this point we know that base_a != base_b. However, pointer accesses
of the form x=(*p) and y=(*q), which bases are p and q, may still by pointing
to the same base. In SSAed GIMPLE p and q will be SSA_NAMES in this case.
Therefore, here we check if it's really two diferent declarations. */
if (TREE_CODE (base_a) == VAR_DECL && TREE_CODE (base_b) == VAR_DECL)
{
*differ_p = true;
return true;
}
/* compare two record/union bases s.a and t.b:
s != t or (a != b and s and t are not unions) */
if (TREE_CODE (base_a) == COMPONENT_REF && TREE_CODE (base_b) == COMPONENT_REF
&& ((TREE_CODE (TREE_OPERAND (base_a, 0)) == VAR_DECL
&& TREE_CODE (TREE_OPERAND (base_b, 0)) == VAR_DECL
&& TREE_OPERAND (base_a, 0) != TREE_OPERAND (base_b, 0))
|| (TREE_CODE (TREE_TYPE (TREE_OPERAND (base_a, 0))) == RECORD_TYPE
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (base_b, 0))) == RECORD_TYPE
&& TREE_OPERAND (base_a, 1) != TREE_OPERAND (base_b, 1))))
{
*differ_p = true;
return true;
}
/* compare a record/union access and an array access. */
if ((TREE_CODE (base_a) == VAR_DECL
&& (TREE_CODE (base_b) == COMPONENT_REF
&& TREE_CODE (TREE_OPERAND (base_b, 0)) == VAR_DECL))
|| (TREE_CODE (base_b) == VAR_DECL
&& (TREE_CODE (base_a) == COMPONENT_REF
&& TREE_CODE (TREE_OPERAND (base_a, 0)) == VAR_DECL)))
{
*differ_p = true;
return true;
}
if (!alias_sets_conflict_p (get_alias_set (base_a), get_alias_set (base_b)))
{
*differ_p = true;
return true;
}
/* An insn writing through a restricted pointer is "independent" of any
insn reading or writing through a different pointer, in the same
block/scope.
*/
if ((TREE_CODE (ta) == POINTER_TYPE && TYPE_RESTRICT (ta)
&& !DR_IS_READ(a))
|| (TREE_CODE (tb) == POINTER_TYPE && TYPE_RESTRICT (tb)
&& !DR_IS_READ(b)))
{
*differ_p = true;
return true;
}
*differ_p = false; /* Don't know, but be conservative. */
return false;
}
/* Returns true iff A divides B. */
@ -466,7 +570,8 @@ struct data_reference *
init_data_ref (tree stmt,
tree ref,
tree base,
tree access_fn)
tree access_fn,
bool is_read)
{
struct data_reference *res;
@ -486,6 +591,7 @@ init_data_ref (tree stmt,
VARRAY_TREE_INIT (DR_ACCESS_FNS (res), 5, "access_fns");
DR_BASE_NAME (res) = base;
VARRAY_PUSH_TREE (DR_ACCESS_FNS (res), access_fn);
DR_IS_READ (res) = is_read;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, ")\n");
@ -532,6 +638,7 @@ initialize_data_dependence_relation (struct data_reference *a,
struct data_reference *b)
{
struct data_dependence_relation *res;
bool differ_p;
res = ggc_alloc (sizeof (struct data_dependence_relation));
DDR_A (res) = a;
@ -545,7 +652,7 @@ initialize_data_dependence_relation (struct data_reference *a,
/* When the dimensions of A and B differ, we directly initialize
the relation to "there is no dependence": chrec_known. */
else if (DR_NUM_DIMENSIONS (a) != DR_NUM_DIMENSIONS (b)
|| array_base_name_differ_p (a, b))
|| (array_base_name_differ_p (a, b, &differ_p) && differ_p))
DDR_ARE_DEPENDENT (res) = chrec_known;
else
@ -1842,9 +1949,10 @@ analyze_all_data_dependences (struct loops *loops)
{
struct data_reference *a = DDR_A (ddr);
struct data_reference *b = DDR_B (ddr);
bool differ_p;
if (DR_NUM_DIMENSIONS (a) != DR_NUM_DIMENSIONS (b)
|| array_base_name_differ_p (a, b))
|| (array_base_name_differ_p (a, b, &differ_p) && differ_p))
nb_basename_differ++;
else
nb_bot_relations++;

View File

@ -151,7 +151,7 @@ extern void analyze_all_data_dependences (struct loops *);
extern void compute_data_dependences_for_loop (unsigned, struct loop *,
varray_type *, varray_type *,
varray_type *, varray_type *);
extern struct data_reference * init_data_ref (tree, tree, tree, tree);
extern struct data_reference * init_data_ref (tree, tree, tree, tree, bool);
extern struct data_reference *analyze_array (tree, tree, bool);
extern void dump_data_reference (FILE *, struct data_reference *);
@ -161,28 +161,9 @@ extern void dump_data_dependence_relation (FILE *,
extern void dump_data_dependence_relations (FILE *, varray_type);
extern void dump_data_dependence_direction (FILE *,
enum data_dependence_direction);
extern bool array_base_name_differ_p (struct data_reference *,
struct data_reference *, bool *p);
/* Inline functions. */
/* This is the simplest data dependence test: determines whether the
data references A and B access the same array. */
static inline bool
array_base_name_differ_p (struct data_reference *a,
struct data_reference *b)
{
if (DR_BASE_NAME (a) == DR_BASE_NAME (b))
return false;
if (TREE_CODE (DR_BASE_NAME (a)) == INDIRECT_REF
&& TREE_CODE (DR_BASE_NAME (b)) == INDIRECT_REF
&& TREE_OPERAND (DR_BASE_NAME (a), 0)
== TREE_OPERAND (DR_BASE_NAME (b), 0))
return false;
return true;
}
#endif /* GCC_TREE_DATA_REF_H */

View File

@ -628,6 +628,12 @@ struct tree_niter_desc
the loop), then the information would be lost. */
};
/* In tree-vectorizer.c */
void vectorize_loops (struct loops *);
/* In tree-ssa-phiopt.c */
bool empty_block_p (basic_block);
/* In tree-ssa-loop*.c */
void tree_ssa_lim (struct loops *);

View File

@ -367,6 +367,7 @@ init_tree_optimization_passes (void)
p = &pass_loop.sub;
NEXT_PASS (pass_loop_init);
NEXT_PASS (pass_lim);
NEXT_PASS (pass_vectorize);
NEXT_PASS (pass_loop_done);
*p = NULL;

View File

@ -109,6 +109,7 @@ extern struct tree_opt_pass pass_tail_calls;
extern struct tree_opt_pass pass_loop;
extern struct tree_opt_pass pass_loop_init;
extern struct tree_opt_pass pass_lim;
extern struct tree_opt_pass pass_vectorize;
extern struct tree_opt_pass pass_loop_done;
extern struct tree_opt_pass pass_ch;
extern struct tree_opt_pass pass_ccp;

View File

@ -37,6 +37,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "cfgloop.h"
#include "flags.h"
#include "tree-inline.h"
#include "tree-scalar-evolution.h"
/* The loop tree currently optimized. */
@ -98,6 +99,9 @@ static void
tree_ssa_loop_init (void)
{
current_loops = tree_loop_optimizer_init (dump_file);
if (!current_loops)
return;
scev_initialize (current_loops);
}
struct tree_opt_pass pass_loop_init =
@ -149,6 +153,40 @@ struct tree_opt_pass pass_lim =
TODO_dump_func /* todo_flags_finish */
};
/* Loop autovectorization. */
static void
tree_vectorize (void)
{
if (!current_loops)
return;
bitmap_clear (vars_to_rename);
vectorize_loops (current_loops);
}
static bool
gate_tree_vectorize (void)
{
return flag_tree_vectorize != 0;
}
struct tree_opt_pass pass_vectorize =
{
"vect", /* name */
gate_tree_vectorize, /* gate */
tree_vectorize, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_TREE_VECTORIZATION, /* tv_id */
PROP_cfg | PROP_ssa, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_func /* todo_flags_finish */
};
/* Loop optimizer finalization. */
static void
@ -157,6 +195,8 @@ tree_ssa_loop_done (void)
if (!current_loops)
return;
scev_finalize ();
#ifdef ENABLE_CHECKING
verify_loop_closed_ssa ();
#endif

View File

@ -45,7 +45,6 @@ static void replace_phi_with_stmt (block_stmt_iterator, basic_block,
static bool candidate_bb_for_phi_optimization (basic_block,
basic_block *,
basic_block *);
static bool empty_block_p (basic_block);
/* This pass eliminates PHI nodes which can be trivially implemented as
an assignment from a conditional expression. ie if we have something
@ -147,7 +146,7 @@ tree_ssa_phiopt (void)
/* Return TRUE if block BB has no executable statements, otherwise return
FALSE. */
static bool
bool
empty_block_p (basic_block bb)
{
block_stmt_iterator bsi;

3544
gcc/tree-vectorizer.c Normal file

File diff suppressed because it is too large Load Diff

181
gcc/tree-vectorizer.h Normal file
View File

@ -0,0 +1,181 @@
/* Loop Vectorization
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Contributed by Dorit Naishlos <dorit@il.ibm.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef GCC_TREE_VECTORIZER_H
#define GCC_TREE_VECTORIZER_H
/* Used for naming of new temporaries. */
enum vect_var_kind {
vect_simple_var,
vect_pointer_var
};
/* Defines type of operation: unary or binary. */
enum operation_type {
unary_op = 1,
binary_op
};
/*-----------------------------------------------------------------*/
/* Info on vectorized defs. */
/*-----------------------------------------------------------------*/
enum stmt_vec_info_type {
undef_vec_info_type = 0,
load_vec_info_type,
store_vec_info_type,
op_vec_info_type,
assignment_vec_info_type
};
typedef struct _stmt_vec_info {
enum stmt_vec_info_type type;
/* The stmt to which this info struct refers to. */
tree stmt;
/* The loop with resprct to which STMT is vectorized. */
struct loop *loop;
/* Not all stmts in the loop need to be vectorized. e.g, the incrementation
of the loop induction variable and computation of array indexes. relevant
indicates whether the stmt needs to be vectorized. */
bool relevant;
/* The vector type to be used. */
tree vectype;
/* The vectorized version of the stmt. */
tree vectorized_stmt;
/** The following is relevant only for stmts that contain a non-scalar
data-ref (array/pointer/struct access). A GIMPLE stmt is expected to have
at most one such data-ref. **/
/* Information about the data-ref (access function, etc). */
struct data_reference *data_ref_info;
/* Aliasing information. */
tree memtag;
} *stmt_vec_info;
/* Access Functions. */
#define STMT_VINFO_TYPE(S) (S)->type
#define STMT_VINFO_STMT(S) (S)->stmt
#define STMT_VINFO_LOOP(S) (S)->loop
#define STMT_VINFO_RELEVANT_P(S) (S)->relevant
#define STMT_VINFO_VECTYPE(S) (S)->vectype
#define STMT_VINFO_VEC_STMT(S) (S)->vectorized_stmt
#define STMT_VINFO_DATA_REF(S) (S)->data_ref_info
#define STMT_VINFO_MEMTAG(S) (S)->memtag
static inline void set_stmt_info (stmt_ann_t ann, stmt_vec_info stmt_info);
static inline stmt_vec_info vinfo_for_stmt (tree stmt);
static inline void
set_stmt_info (stmt_ann_t ann, stmt_vec_info stmt_info)
{
if (ann)
ann->common.aux = (char *) stmt_info;
}
static inline stmt_vec_info
vinfo_for_stmt (tree stmt)
{
stmt_ann_t ann = stmt_ann (stmt);
return ann ? (stmt_vec_info) ann->common.aux : NULL;
}
/*-----------------------------------------------------------------*/
/* Info on data references alignment. */
/*-----------------------------------------------------------------*/
#define DR_MISALIGNMENT(DR) (DR)->aux
static inline bool
aligned_access_p (struct data_reference *data_ref_info)
{
return (DR_MISALIGNMENT (data_ref_info) == 0);
}
static inline bool
unknown_alignment_for_access_p (struct data_reference *data_ref_info)
{
return (DR_MISALIGNMENT (data_ref_info) == -1);
}
/*-----------------------------------------------------------------*/
/* Info on vectorized loops. */
/*-----------------------------------------------------------------*/
typedef struct _loop_vec_info {
/* The loop to which this info struct refers to. */
struct loop *loop;
/* The loop basic blocks. */
basic_block *bbs;
/* The loop exit_condition. */
tree exit_cond;
/* Number of iterations. -1 if unknown. */
HOST_WIDE_INT num_iters;
/* Is the loop vectorizable? */
bool vectorizable;
/* Unrolling factor */
int vectorization_factor;
/* All data references in the loop that are being written to. */
varray_type data_ref_writes;
/* All data references in the loop that are being read from. */
varray_type data_ref_reads;
} *loop_vec_info;
/* Access Functions. */
#define LOOP_VINFO_LOOP(L) (L)->loop
#define LOOP_VINFO_BBS(L) (L)->bbs
#define LOOP_VINFO_EXIT_COND(L) (L)->exit_cond
#define LOOP_VINFO_NITERS(L) (L)->num_iters
#define LOOP_VINFO_VECTORIZABLE_P(L) (L)->vectorizable
#define LOOP_VINFO_VECT_FACTOR(L) (L)->vectorization_factor
#define LOOP_VINFO_DATAREF_WRITES(L) (L)->data_ref_writes
#define LOOP_VINFO_DATAREF_READS(L) (L)->data_ref_reads
#define LOOP_VINFO_NITERS_KNOWN_P(L) ((L)->num_iters > 0)
/*-----------------------------------------------------------------*/
/* Function prototypes. */
/*-----------------------------------------------------------------*/
/* Main driver. */
extern void vectorize_loops (struct loops *);
/* creation and deletion of loop and stmt info structs. */
extern loop_vec_info new_loop_vec_info (struct loop *loop);
extern void destroy_loop_vec_info (loop_vec_info);
extern stmt_vec_info new_stmt_vec_info (tree stmt, struct loop *loop);
#endif /* GCC_TREE_VECTORIZER_H */