Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/vect/vect-multitypes-10.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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 short uY[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); | |
10 unsigned int uresult[N]; | |
11 signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); | |
12 signed short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); | |
13 int result[N]; | |
14 | |
15 /* Unsigned type promotion (hi->si) */ | |
16 __attribute__ ((noinline)) int | |
17 foo1(int len) { | |
18 int i; | |
19 | |
20 for (i=0; i<len; i++) { | |
21 uX[i] = 5; | |
22 uresult[i] = (unsigned int)uY[i]; | |
23 } | |
24 } | |
25 | |
26 /* Signed type promotion (hi->si) */ | |
27 __attribute__ ((noinline)) int | |
28 foo2(int len) { | |
29 int i; | |
30 | |
31 for (i=0; i<len; i++) { | |
32 uX[i] = 5; | |
33 result[i] = (int)Y[i]; | |
34 } | |
35 } | |
36 | |
37 int main (void) | |
38 { | |
39 int i; | |
40 | |
41 check_vect (); | |
42 | |
43 for (i=0; i<N; i++) { | |
44 X[i] = 16-i; | |
45 uX[i] = 16-i; | |
46 __asm__ volatile (""); | |
47 } | |
48 | |
49 foo1 (N); | |
50 | |
51 for (i=0; i<N; i++) { | |
52 if (uresult[i] != (unsigned short)uY[i]) | |
53 abort (); | |
54 } | |
55 | |
56 foo2 (N); | |
57 | |
58 for (i=0; i<N; i++) { | |
59 if (result[i] != (short)Y[i]) | |
60 abort (); | |
61 } | |
62 | |
63 return 0; | |
64 } | |
65 | |
66 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_unpack } } } */ | |
67 |