aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-fast-math-vect-pr29925.c40
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31a.c51
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31b.c50
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31c.c50
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31d.c51
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-33.c43
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68a.c49
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68b.c49
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68c.c49
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68d.c50
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76a.c47
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c47
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76c.c47
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c38
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp69
15 files changed, 730 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-fast-math-vect-pr29925.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-fast-math-vect-pr29925.c
new file mode 100644
index 000000000..00e631b13
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-fast-math-vect-pr29925.c
@@ -0,0 +1,40 @@
+/* { dg-require-effective-target vect_float } */
+
+#include <stdlib.h>
+#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<len;i++)
+ {
+ float tmp = 0;
+ for (k=0;k<7;k++)
+ {
+ tmp += exc[i-pitch+k+maxj-6];
+ }
+ interp[i] = tmp;
+ }
+}
+
+int main()
+{
+ float *exc = calloc(126,sizeof(float));
+ float *interp = calloc(80,sizeof(float));
+ int pitch = -35;
+
+ check_vect ();
+
+ interp_pitch(exc, interp, pitch, 80);
+ free(exc);
+ free(interp);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorization not profitable" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31a.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31a.c
new file mode 100644
index 000000000..272b3f0d7
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31a.c
@@ -0,0 +1,51 @@
+/* { dg-require-effective-target vect_int } */
+
+#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 ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorization not profitable" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31b.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31b.c
new file mode 100644
index 000000000..b3224f943
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31b.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target vect_int } */
+
+#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;
+
+ /* 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 ();
+ }
+
+ 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-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31c.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31c.c
new file mode 100644
index 000000000..9dcd09aba
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31c.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target vect_int } */
+
+#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;
+
+ /* 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 ();
+ }
+
+ 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-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31d.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31d.c
new file mode 100644
index 000000000..736804fd0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-31d.c
@@ -0,0 +1,51 @@
+/* { dg-require-effective-target vect_int } */
+
+#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.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 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorization not profitable" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-33.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-33.c
new file mode 100644
index 000000000..11036b0bc
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-33.c
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+#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 ();
+}
+
+/* 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-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68a.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68a.c
new file mode 100644
index 000000000..d0d40ac33
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68a.c
@@ -0,0 +1,49 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#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 <N; i++)
+ {
+ if (tmp1.a.n[1][2][i] != 5)
+ 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-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68b.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68b.c
new file mode 100644
index 000000000..4e52af8b8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68b.c
@@ -0,0 +1,49 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#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-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68c.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68c.c
new file mode 100644
index 000000000..58c5e9fdb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68c.c
@@ -0,0 +1,49 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#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-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68d.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68d.c
new file mode 100644
index 000000000..9cec93633
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-68d.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#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 <N-3; i++)
+ {
+ if (tmp1.e.n[1][2][i] != 8)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorization not profitable" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76a.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76a.c
new file mode 100644
index 000000000..124493b03
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76a.c
@@ -0,0 +1,47 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#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-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c
new file mode 100644
index 000000000..4969a31e0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76b.c
@@ -0,0 +1,47 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#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-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76c.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76c.c
new file mode 100644
index 000000000..b42934c68
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-76c.c
@@ -0,0 +1,47 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#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-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c
new file mode 100644
index 000000000..af694a36d
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/costmodel-vect-iv-9.c
@@ -0,0 +1,38 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#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-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp
new file mode 100644
index 000000000..550ce84ec
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/costmodel/spu/spu-costmodel-vect.exp
@@ -0,0 +1,69 @@
+# Copyright (C) 1997-2014 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
+# <http://www.gnu.org/licenses/>.
+
+# 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=dynamic"
+
+# 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