| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
|
| 3 |
#include <stdarg.h> |
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
#define N 128 |
| 7 |
|
| 8 |
__attribute__ ((noinline)) int main1 (short X) |
| 9 |
{ |
| 10 |
unsigned char a[N]; |
| 11 |
unsigned short b[N]; |
| 12 |
unsigned int c[N]; |
| 13 |
short myX = X; |
| 14 |
int i; |
| 15 |
|
| 16 |
/* vectorization of induction with type conversions. */ |
| 17 |
for (i = 0; i < N; i++) |
| 18 |
{ |
| 19 |
a[i] = (unsigned char)X; |
| 20 |
b[i] = X; |
| 21 |
c[i] = (unsigned int)X; |
| 22 |
X++; |
| 23 |
} |
| 24 |
|
| 25 |
/* check results: */ |
| 26 |
#pragma GCC novector |
| 27 |
for (i = 0; i < N; i++) |
| 28 |
{ |
| 29 |
if (a[i] != (unsigned char)myX || b[i] != myX || c[i] != (unsigned int)myX++) |
| 30 |
abort (); |
| 31 |
} |
| 32 |
|
| 33 |
return 0; |
| 34 |
} |
| 35 |
|
| 36 |
int main (void) |
| 37 |
{ |
| 38 |
check_vect (); |
| 39 |
|
| 40 |
return main1 (3); |
| 41 |
} |
| 42 |
|
| 43 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_pack_trunc && vect_unpack } } } } */ |