From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../spu/costmodel-fast-math-vect-pr29925.c | 40 +++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-31a.c | 51 ++++++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-31b.c | 50 ++++++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-31c.c | 50 ++++++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-31d.c | 51 ++++++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-33.c | 43 ++++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-68a.c | 49 +++++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-68b.c | 49 +++++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-68c.c | 49 +++++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-68d.c | 50 ++++++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-76a.c | 47 +++++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c | 47 +++++++++++++++ .../gcc.dg/vect/costmodel/spu/costmodel-vect-76c.c | 47 +++++++++++++++ .../vect/costmodel/spu/costmodel-vect-iv-9.c | 38 ++++++++++++ .../vect/costmodel/spu/spu-costmodel-vect.exp | 69 ++++++++++++++++++++++ 15 files changed, 730 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-fast-math-vect-pr29925.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31a.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31b.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31c.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31d.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-33.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68a.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68b.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68c.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68d.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76a.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76c.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c create mode 100644 gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp (limited to 'gcc/testsuite/gcc.dg/vect/costmodel/spu') diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-fast-math-vect-pr29925.c b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-fast-math-vect-pr29925.c new file mode 100644 index 000000000..00e631b13 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-fast-math-vect-pr29925.c @@ -0,0 +1,40 @@ +/* { dg-require-effective-target vect_float } */ + +#include +#include "../../tree-vect.h" + +__attribute__ ((noinline)) void +interp_pitch(float *exc, float *interp, int pitch, int len) +{ + int i,k; + int maxj; + + maxj=3; + for (i=0;i +#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 +#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; + + /* aligned */ + for (i = 0; i < N/2; i++) + { + tmp.c[i] = 6; + } + + /* check results: */ + for (i = 0; i +#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; + + /* aligned */ + for (i = 0; i < N/2; i++) + { + tmp.d.k[i] = 7; + } + + /* check results: */ + for (i = 0; i +#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.e.k[i] = 8; + } + + /* check results: */ + for (i = 0; i +#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 (); +} + +/* Peeling to align the store is used. Overhead of peeling is too high. */ +/* { dg-final { scan-tree-dump-times "vectorization not profitable" 1 "vect" { target vector_alignment_reachable } } } */ + +/* Versioning to align the store is used. Overhead of versioning is not too high. */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target {! vector_alignment_reachable} } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68a.c b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68a.c new file mode 100644 index 000000000..d0d40ac33 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68a.c @@ -0,0 +1,49 @@ +/* { dg-require-effective-target vect_int } */ + +#include +#include "../../tree-vect.h" + +#define N 32 + +struct s{ + int m; + int n[N][N][N]; +}; + +struct test1{ + struct s a; /* array a.n is unaligned */ + int b; + int c; + struct s e; /* array e.n is aligned */ +}; + +int main1 () +{ + int i,j; + struct test1 tmp1; + + /* 1. unaligned */ + for (i = 0; i < N; i++) + { + tmp1.a.n[1][2][i] = 5; + } + + /* check results: */ + for (i = 0; i +#include "../../tree-vect.h" + +#define N 32 + +struct s{ + int m; + int n[N][N][N]; +}; + +struct test1{ + struct s a; /* array a.n is unaligned */ + int b; + int c; + struct s e; /* array e.n is aligned */ +}; + +int main1 () +{ + int i,j; + struct test1 tmp1; + + /* 2. aligned */ + for (i = 3; i < N-1; i++) + { + tmp1.a.n[1][2][i] = 6; + } + + /* check results: */ + for (i = 3; i < N-1; i++) + { + if (tmp1.a.n[1][2][i] != 6) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68c.c b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68c.c new file mode 100644 index 000000000..58c5e9fdb --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68c.c @@ -0,0 +1,49 @@ +/* { dg-require-effective-target vect_int } */ + +#include +#include "../../tree-vect.h" + +#define N 32 + +struct s{ + int m; + int n[N][N][N]; +}; + +struct test1{ + struct s a; /* array a.n is unaligned */ + int b; + int c; + struct s e; /* array e.n is aligned */ +}; + +int main1 () +{ + int i,j; + struct test1 tmp1; + + /* 3. aligned */ + for (i = 0; i < N; i++) + { + tmp1.e.n[1][2][i] = 7; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (tmp1.e.n[1][2][i] != 7) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68d.c b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68d.c new file mode 100644 index 000000000..9cec93633 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68d.c @@ -0,0 +1,50 @@ +/* { dg-require-effective-target vect_int } */ + +#include +#include "../../tree-vect.h" + +#define N 20 + +struct s{ + int m; + int n[N][N][N]; +}; + +struct test1{ + struct s a; /* array a.n is unaligned */ + int b; + int c; + struct s e; /* array e.n is aligned */ +}; + +int main1 () +{ + int i,j; + struct test1 tmp1; + + /* 4. unaligned */ + for (i = 3; i < N-3; i++) + { + tmp1.e.n[1][2][i] = 8; + } + + /* check results: */ + for (i = 3; i +#include "../../tree-vect.h" + +#define N 16 +#define OFF 4 + +/* Check handling of accesses for which the "initial condition" - + the expression that represents the first location accessed - is + more involved than just an ssa_name. */ + +int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; + +int main1 (int *pib) +{ + int i; + int ia[N+OFF]; + int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; + + for (i = OFF; i < N; i++) + { + ia[i] = pib[i - OFF]; + } + + + /* check results: */ + for (i = OFF; i < N; i++) + { + if (ia[i] != pib[i - OFF]) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (&ib[OFF]); + return 0; +} + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c new file mode 100644 index 000000000..4969a31e0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c @@ -0,0 +1,47 @@ +/* { dg-require-effective-target vect_int } */ + +#include +#include "../../tree-vect.h" + +#define N 16 +#define OFF 4 + +/* Check handling of accesses for which the "initial condition" - + the expression that represents the first location accessed - is + more involved than just an ssa_name. */ + +int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 0, 1, 3, 5, 7, 11, 13, 17}; +int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 0, 1, 3, 5, 7, 11, 13, 17}; + +int main1 (int *pib) +{ + int i; + int ia[N+OFF]; + + for (i = OFF; i < N; i++) + { + pib[i - OFF] = ic[i]; + } + + + /* check results: */ + for (i = OFF; i < N; i++) + { + if (pib[i - OFF] != ic[i]) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (&ib[OFF]); + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorization not profitable" 0 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76c.c b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76c.c new file mode 100644 index 000000000..b42934c68 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76c.c @@ -0,0 +1,47 @@ +/* { dg-require-effective-target vect_int } */ + +#include +#include "../../tree-vect.h" + +#define N 32 +#define OFF 4 + +/* Check handling of accesses for which the "initial condition" - + the expression that represents the first location accessed - is + more involved than just an ssa_name. */ + +int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; +int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; + +int main1 (int *pib) +{ + int i; + int ia[N+OFF]; + + for (i = OFF; i < N; i++) + { + ia[i] = ic[i - OFF]; + } + + + /* check results: */ + for (i = OFF; i < N; i++) + { + if (ia[i] != ic[i - OFF]) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (&ib[OFF]); + return 0; +} + + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c new file mode 100644 index 000000000..af694a36d --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c @@ -0,0 +1,38 @@ +/* { dg-require-effective-target vect_int } */ + +#include +#include "../../tree-vect.h" + +#define N 26 +int a[N]; + +__attribute__ ((noinline)) int main1 (int X) +{ + int s = X; + int i; + + /* vectorization of reduction with induction. */ + for (i = 0; i < N; i++) + s += (i + a[i]); + + return s; +} + +int main (void) +{ + int s, i; + check_vect (); + + for (i = 0; i < N; i++) + a[i] = 2*i; + + s = main1 (3); + if (s != 978) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_int_mult } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target {! vect_int_mult } } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp b/gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp new file mode 100644 index 000000000..cde70c54a --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp @@ -0,0 +1,69 @@ +# Copyright (C) 1997, 2004, 2005, 2006, 2007 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 3 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 GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# Exit immediately if this isn't a powerpc target. +if { ![istarget spu*-*-*] } then { + return +} + + +# Set up flags used for tests that don't specify options. +set DEFAULT_VECTCFLAGS "" + +# These flags are used for all targets. +lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fvect-cost-model" + +# If the target system supports vector instructions, the default action +# for a test is 'run', otherwise it's 'compile'. Save current default. +# Executing vector instructions on a system without hardware vector support +# is also disabled by a call to check_vect, but disabling execution here is +# more efficient. +global dg-do-what-default +set save-dg-do-what-default ${dg-do-what-default} + +set dg-do-what-default run + +# Initialize `dg'. +dg-init + +lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details" + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/costmodel-pr*.\[cS\]]] \ + "" $DEFAULT_VECTCFLAGS +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/costmodel-vect-*.\[cS\]]] \ + "" $DEFAULT_VECTCFLAGS + +#### Tests with special options +global SAVED_DEFAULT_VECTCFLAGS +set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS + +# -ffast-math tests +set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS +lappend DEFAULT_VECTCFLAGS "-ffast-math" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/costmodel-fast-math-vect*.\[cS\]]] \ + "" $DEFAULT_VECTCFLAGS + +# Clean up. +set dg-do-what-default ${save-dg-do-what-default} + +# All done. +dg-finish -- cgit v1.2.3