Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-multitypes-8.c

raw
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 64
7
8 unsigned char uX[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
9 unsigned char uresultX[N];
10 unsigned int uY[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
11 unsigned short uresultY[N];
12
13 /* Unsigned type demotion (si->hi) */
14
15 __attribute__ ((noinline)) int
16 foo1(int len) {
17 int i;
18
19 for (i=0; i<len; i++) {
20 uresultX[i] = uX[i];
21 uresultY[i] = (unsigned short)uY[i];
22 }
23 }
24
25 int main (void)
26 {
27 int i;
28
29 check_vect ();
30
31 for (i=0; i<N; i++) {
32 uX[i] = 16-i;
33 uY[i] = 16-i;
34 __asm__ volatile ("");
35 }
36
37 foo1 (N);
38
39 #pragma GCC novector
40 for (i=0; i<N; i++) {
41 if (uresultX[i] != uX[i])
42 abort ();
43 if (uresultY[i] != (unsigned short)uY[i])
44 abort ();
45 }
46
47 return 0;
48 }
49
50 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_pack_trunc } } } */
51