111
|
1 /* { dg-require-effective-target vect_float } */
|
|
2 /* { dg-additional-options "--param vect-max-peeling-for-alignment=0" } */
|
|
3
|
|
4 #include <stdarg.h>
|
|
5 #include "tree-vect.h"
|
|
6
|
131
|
7 #define N1 3001
|
111
|
8
|
131
|
9 #if VECTOR_BITS > 256
|
|
10 #define N2 (VECTOR_BITS / 32 + 2)
|
|
11 #else
|
|
12 #define N2 10
|
|
13 #endif
|
111
|
14
|
|
15 __attribute__ ((noinline)) int
|
|
16 main1 (float *pa)
|
|
17 {
|
|
18 int i;
|
|
19
|
131
|
20 for (i = 0; i < N1; i++)
|
111
|
21 {
|
|
22 pa[i] = 2.0;
|
|
23 }
|
|
24
|
|
25 /* check results: */
|
131
|
26 for (i = 0; i < N1; i++)
|
111
|
27 {
|
|
28 if (pa[i] != 2.0)
|
|
29 abort ();
|
|
30 }
|
|
31
|
131
|
32 for (i = 1; i <= N2; i++)
|
111
|
33 {
|
|
34 pa[i] = 3.0;
|
|
35 }
|
|
36
|
|
37 /* check results: */
|
131
|
38 for (i = 1; i <= N2; i++)
|
111
|
39 {
|
|
40 if (pa[i] != 3.0)
|
|
41 abort ();
|
|
42 }
|
|
43
|
|
44 return 0;
|
|
45 }
|
|
46
|
|
47 int main (void)
|
|
48 {
|
|
49 int i;
|
131
|
50 float a[N1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
|
|
51 float b[N1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
|
111
|
52
|
|
53 check_vect ();
|
|
54
|
|
55 /* from bzip2: */
|
131
|
56 for (i = 0; i < N1; i++)
|
|
57 b[i] = i;
|
111
|
58 a[0] = 0;
|
|
59 for (i = 1; i <= 256; i++) a[i] = b[i-1];
|
|
60
|
|
61 /* check results: */
|
|
62 for (i = 1; i <= 256; i++)
|
|
63 {
|
|
64 if (a[i] != i-1)
|
|
65 abort ();
|
|
66 }
|
|
67 if (a[0] != 0)
|
|
68 abort ();
|
|
69
|
|
70 main1 (a);
|
|
71
|
|
72 return 0;
|
|
73 }
|
|
74
|
|
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. */
|
|
78
|
|
79 /* main && main1 together: */
|
|
80 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" { target powerpc*-*-* i?86-*-* x86_64-*-* } } } */
|
|
81
|
|
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 } } } } } */
|
|
85
|
|
86 /* in main: */
|
|
87 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_no_align && { ! vect_hw_misalign } } } } } */
|
|
88
|