| 1 |
|
| 2 |
#include "tree-vect.h" |
| 3 |
|
| 4 |
/* Extracted from MultiSource/Benchmarks/TSVC/tsc.inc |
| 5 |
From LLVM test-suite */ |
| 6 |
|
| 7 |
#define N 40 |
| 8 |
|
| 9 |
int dummy(double[N], double[N], double[N], double[N]); |
| 10 |
|
| 11 |
double array[256*256] __attribute__((aligned(32))); |
| 12 |
|
| 13 |
double x[N] __attribute__((aligned(32))); |
| 14 |
double temp; |
| 15 |
int temp_int; |
| 16 |
struct GlobalData |
| 17 |
{ |
| 18 |
__attribute__((aligned(32))) double a[N]; |
| 19 |
int pad1[3]; |
| 20 |
__attribute__((aligned(32))) double b[N]; |
| 21 |
int pad2[5]; |
| 22 |
__attribute__((aligned(32))) double c[N]; |
| 23 |
int pad3[7]; |
| 24 |
__attribute__((aligned(32))) double d[N]; |
| 25 |
int pad4[11]; |
| 26 |
} global_data; |
| 27 |
|
| 28 |
__attribute__((aligned(32))) double * const a = global_data.a; |
| 29 |
__attribute__((aligned(32))) double * const b = global_data.b; |
| 30 |
__attribute__((aligned(32))) double * const c = global_data.c; |
| 31 |
__attribute__((aligned(32))) double * const d = global_data.d; |
| 32 |
|
| 33 |
void init(void); |
| 34 |
void check(double *_a, double *_b); |
| 35 |
int s221(void) |
| 36 |
{ |
| 37 |
int i; |
| 38 |
|
| 39 |
init(); |
| 40 |
for (i = 1; i < N; i++) |
| 41 |
{ |
| 42 |
a[i] += c[i] * d[i]; |
| 43 |
b[i] = b[i - 1] + a[i] + d[i]; |
| 44 |
} |
| 45 |
check(a, b); |
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
int set1d(double arr[N], double value) |
| 50 |
{ |
| 51 |
int i; |
| 52 |
|
| 53 |
for (i = 0; i < N; i++) { |
| 54 |
arr[i] = value; |
| 55 |
} |
| 56 |
return 0; |
| 57 |
} |
| 58 |
|
| 59 |
void init(void) |
| 60 |
{ |
| 61 |
set1d(a, 1); |
| 62 |
set1d(b, 2); |
| 63 |
set1d(c, 3); |
| 64 |
set1d(d, 4); |
| 65 |
} |
| 66 |
|
| 67 |
void abort(void); |
| 68 |
|
| 69 |
void check(double *_a, double *_b) |
| 70 |
{ |
| 71 |
int i; |
| 72 |
|
| 73 |
double suma = 0; |
| 74 |
double sumb = 0; |
| 75 |
for (i = 0; i < N; i++){ |
| 76 |
suma += _a[i]; |
| 77 |
sumb += _b[i]; |
| 78 |
} |
| 79 |
if (suma != 508) |
| 80 |
abort(); |
| 81 |
if (sumb != 13340.00) |
| 82 |
abort(); |
| 83 |
} |
| 84 |
|
| 85 |
int main(int argc, char *argv[]) |
| 86 |
{ |
| 87 |
check_vect (); |
| 88 |
s221(); |
| 89 |
return 0; |
| 90 |
} |
| 91 |
|