Merged with mainline at revision 128810.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-multitypes-8.c
blob6a71298a59f674b5f509a7b844ef1007025a0250
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 64
8 unsigned char uX[N] __attribute__ ((__aligned__(16)));
9 unsigned char uresultX[N];
10 unsigned int uY[N] __attribute__ ((__aligned__(16)));
11 unsigned short uresultY[N];
13 /* Unsigned type demotion (si->hi) */
15 __attribute__ ((noinline)) int
16 foo1(int len) {
17 int i;
19 for (i=0; i<len; i++) {
20 uresultX[i] = uX[i];
21 uresultY[i] = (unsigned short)uY[i];
25 int main (void)
27 int i;
29 check_vect ();
31 for (i=0; i<N; i++) {
32 uX[i] = 16-i;
33 uY[i] = 16-i;
36 foo1 (N);
38 for (i=0; i<N; i++) {
39 if (uresultX[i] != uX[i])
40 abort ();
41 if (uresultY[i] != (unsigned short)uY[i])
42 abort ();
45 return 0;
48 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_pack_trunc } } } */
49 /* { dg-final { cleanup-tree-dump "vect" } } */