2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-multitypes-13.c
bloba5012ab23179f618d5383fe88583988ab93e2574
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__(__BIGGEST_ALIGNMENT__)));
9 unsigned int uresult[N];
10 signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
11 int result[N];
13 /* Unsigned type promotion (qi->si) */
14 __attribute__ ((noinline)) int
15 foo1(int len) {
16 int i;
18 for (i=0; i<len; i++) {
19 uresult[i] = (unsigned int)uX[i];
23 /* Signed type promotion (qi->si) */
24 __attribute__ ((noinline)) int
25 foo2(int len) {
26 int i;
28 for (i=0; i<len; i++) {
29 result[i] = (int)X[i];
33 int main (void)
35 int i;
37 check_vect ();
39 for (i=0; i<N; i++) {
40 X[i] = 16-i;
41 uX[i] = 16-i;
44 foo1 (N);
46 for (i=0; i<N; i++) {
47 if (uresult[i] != (unsigned int)uX[i])
48 abort ();
51 foo2 (N);
53 for (i=0; i<N; i++) {
54 if (result[i] != (int)X[i])
55 abort ();
58 return 0;
61 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_unpack } } } */
62 /* { dg-final { cleanup-tree-dump "vect" } } */