PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-93.c
blob397c2ed05aaee71177d3efabcf60bcd6efd69571
1 /* { dg-require-effective-target vect_float } */
2 /* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N1 3001
9 #if VECTOR_BITS > 256
10 #define N2 (VECTOR_BITS / 32 + 2)
11 #else
12 #define N2 10
13 #endif
15 __attribute__ ((noinline)) int
16 main1 (float *pa)
18 int i;
20 for (i = 0; i < N1; i++)
22 pa[i] = 2.0;
25 /* check results: */
26 for (i = 0; i < N1; i++)
28 if (pa[i] != 2.0)
29 abort ();
32 for (i = 1; i <= N2; i++)
34 pa[i] = 3.0;
37 /* check results: */
38 for (i = 1; i <= N2; i++)
40 if (pa[i] != 3.0)
41 abort ();
44 return 0;
47 int main (void)
49 int i;
50 float a[N1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
51 float b[N1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
53 check_vect ();
55 /* from bzip2: */
56 for (i = 0; i < N1; i++)
57 b[i] = i;
58 a[0] = 0;
59 for (i = 1; i <= 256; i++) a[i] = b[i-1];
61 /* check results: */
62 for (i = 1; i <= 256; i++)
64 if (a[i] != i-1)
65 abort ();
67 if (a[0] != 0)
68 abort ();
70 main1 (a);
72 return 0;
75 /* 2 loops vectorized in main1, 2 loops vectorized in main:
76 the first loop in main requires vectorization of conversions,
77 the second loop in main requires vectorization of misaligned load. */
79 /* main && main1 together: */
80 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" { target powerpc*-*-* i?86-*-* x86_64-*-* } } } */
82 /* in main1: */
83 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target !powerpc*-*-* !i?86-*-* !x86_64-*-* } } } */
84 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
86 /* in main: */
87 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */