OSDN Git Service

PR tree-optimization/35982
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-93.c
1 /* { dg-require-effective-target vect_float } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 3001
7
8
9 __attribute__ ((noinline))
10 main1 (float *pa)
11 {
12   int i;
13
14   for (i = 0; i < 3001; i++)
15     {
16       pa[i] = 2.0;
17     }
18
19   /* check results:  */
20   for (i = 0; i < 3001; i++)
21     {
22       if (pa[i] != 2.0)
23         abort ();
24     }
25
26   for (i = 1; i <= 10; i++)
27     {
28       pa[i] = 3.0;
29     }
30
31   /* check results:  */
32   for (i = 1; i <= 10; i++)
33     {
34       if (pa[i] != 3.0)
35         abort ();
36     }
37   
38   return 0;
39 }
40
41 int main (void)
42 {
43   int i;
44   float a[N] __attribute__ ((__aligned__(16)));
45   float b[N] __attribute__ ((__aligned__(16)));
46
47   check_vect ();
48
49   /* from bzip2: */
50   for (i=0; i<N; i++) b[i] = i;
51   a[0] = 0;
52   for (i = 1; i <= 256; i++) a[i] = b[i-1];
53
54   /* check results:  */
55   for (i = 1; i <= 256; i++)
56     {
57       if (a[i] != i-1)
58         abort ();
59     }
60   if (a[0] != 0)
61     abort ();
62
63   main1 (a);
64
65   return 0;
66 }
67
68 /* 2 loops vectorized in main1, 2 loops vectorized in main:
69    the first loop in main requires vectorization of conversions,
70    the second loop in main requires vectorization of misaligned load.  */
71
72 /* main && main1 together: */
73 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" { target powerpc*-*-* i?86-*-* x86_64-*-* } } } */
74 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target { vect_no_align && {! vector_alignment_reachable} } } } } */
75 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" { xfail { vect_no_align || {! vector_alignment_reachable} } } } } */
76
77 /* in main1: */
78 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target !powerpc*-*-* !i?86-*-* !x86_64-*-* } } } */
79 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target vect_no_align } } } */
80
81 /* in main: */
82 /* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { target vect_no_align } } } */
83 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail vect_no_align } } } */
84
85 /* { dg-final { cleanup-tree-dump "vect" } } */