| 1 |
/* Disabling epilogues until we find a better way to deal with scans. */ |
| 2 |
/* { dg-additional-options "--param vect-epilogues-nomask=0" } */ |
| 3 |
/* { dg-require-effective-target vect_int } */ |
| 4 |
|
| 5 |
#include <stdarg.h> |
| 6 |
#include "tree-vect.h" |
| 7 |
|
| 8 |
#define N 64 |
| 9 |
|
| 10 |
#define DOT2 43680 |
| 11 |
|
| 12 |
unsigned short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); |
| 13 |
unsigned short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); |
| 14 |
|
| 15 |
/* ushort->int->uint dot product: the multiplication promotes the ushorts |
| 16 |
to int, and then the product is converted to uint for the addition. */ |
| 17 |
__attribute__ ((noinline)) unsigned int |
| 18 |
foo2(int len) { |
| 19 |
int i; |
| 20 |
unsigned int result = 0; |
| 21 |
|
| 22 |
for (i=0; i<len; i++) { |
| 23 |
result += (X[i] * Y[i]); |
| 24 |
} |
| 25 |
return result; |
| 26 |
} |
| 27 |
|
| 28 |
|
| 29 |
int main (void) |
| 30 |
{ |
| 31 |
unsigned int dot2; |
| 32 |
int i; |
| 33 |
|
| 34 |
check_vect (); |
| 35 |
|
| 36 |
for (i=0; i<N; i++) { |
| 37 |
X[i] = i; |
| 38 |
Y[i] = 64-i; |
| 39 |
__asm__ volatile (""); |
| 40 |
} |
| 41 |
|
| 42 |
dot2 = foo2 (N); |
| 43 |
if (dot2 != DOT2) |
| 44 |
abort (); |
| 45 |
|
| 46 |
return 0; |
| 47 |
} |
| 48 |
|
| 49 |
/* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected(?:(?!Analysis failed).)*Analysis succeeded" 1 "vect" { target { vect_pack_trunc || vect_udot_hi } } } } */ |
| 50 |
|
| 51 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_pack_trunc || vect_udot_hi } } } } */ |