2014-09-05 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr63148.c
blob4967a0d73d4f7b6a1244fc194646b0357ed50afd
1 /* { dg-do run } */
3 #include "tree-vect.h"
5 /* Extracted from MultiSource/Benchmarks/TSVC/tsc.inc
6 From LLVM test-suite */
8 #define N 40
10 int dummy(double[N], double[N], double[N], double[N]);
12 double array[256*256] __attribute__((aligned(32)));
14 double x[N] __attribute__((aligned(32)));
15 double temp;
16 int temp_int;
17 struct GlobalData
19 __attribute__((aligned(32))) double a[N];
20 int pad1[3];
21 __attribute__((aligned(32))) double b[N];
22 int pad2[5];
23 __attribute__((aligned(32))) double c[N];
24 int pad3[7];
25 __attribute__((aligned(32))) double d[N];
26 int pad4[11];
27 } global_data;
29 __attribute__((aligned(32))) double * const a = global_data.a;
30 __attribute__((aligned(32))) double * const b = global_data.b;
31 __attribute__((aligned(32))) double * const c = global_data.c;
32 __attribute__((aligned(32))) double * const d = global_data.d;
34 void init(void);
35 void check(double *_a, double *_b);
36 int s221(void)
38 int i;
40 init();
41 for (i = 1; i < N; i++)
43 a[i] += c[i] * d[i];
44 b[i] = b[i - 1] + a[i] + d[i];
46 check(a, b);
47 return 0;
50 int set1d(double arr[N], double value)
52 int i;
54 for (i = 0; i < N; i++) {
55 arr[i] = value;
57 return 0;
60 void init(void)
62 set1d(a, 1);
63 set1d(b, 2);
64 set1d(c, 3);
65 set1d(d, 4);
68 void abort(void);
70 void check(double *_a, double *_b)
72 int i;
74 double suma = 0;
75 double sumb = 0;
76 for (i = 0; i < N; i++){
77 suma += _a[i];
78 sumb += _b[i];
80 if (suma != 508)
81 abort();
82 if (sumb != 13340.00)
83 abort();
86 int main(int argc, char *argv[])
88 check_vect ();
89 s221();
90 return 0;
93 /* { dg-final { cleanup-tree-dump "vect" } } */