| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
|
| 3 |
#include <stdarg.h> |
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
#define N 64 |
| 7 |
|
| 8 |
#define DOT1 43680 |
| 9 |
#define DOT2 -20832 |
| 10 |
|
| 11 |
signed short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); |
| 12 |
signed short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); |
| 13 |
unsigned char CX[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); |
| 14 |
|
| 15 |
__attribute__ ((noinline)) void |
| 16 |
foo1(int len) { |
| 17 |
int i; |
| 18 |
int result1 = 0; |
| 19 |
short prod; |
| 20 |
|
| 21 |
for (i=0; i<len; i++) { |
| 22 |
result1 += (X[i] * Y[i]); |
| 23 |
CX[i] = 5; |
| 24 |
} |
| 25 |
|
| 26 |
if (result1 != DOT1) |
| 27 |
abort (); |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
int main (void) |
| 32 |
{ |
| 33 |
int i, dot1, dot2; |
| 34 |
|
| 35 |
check_vect (); |
| 36 |
|
| 37 |
for (i=0; i<N; i++) { |
| 38 |
X[i] = i; |
| 39 |
Y[i] = 64-i; |
| 40 |
CX[i] = i; |
| 41 |
__asm__ volatile (""); |
| 42 |
} |
| 43 |
|
| 44 |
foo1 (N); |
| 45 |
|
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_sdot_hi } } } */ |
| 50 |
|