1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_float } */
3 /* { dg-add-options bind_pic_locally } */
10 int iadd_results
[N
] = {0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90};
11 float fadd_results
[N
] = {0.0,6.0,12.0,18.0,24.0,30.0,36.0,42.0,48.0,54.0,60.0,66.0,72.0,78.0,84.0,90.0};
12 float fmul_results
[N
] = {0.0,3.0,12.0,27.0,48.0,75.0,108.0,147.0,192.0,243.0,300.0,363.0,432.0,507.0,588.0,675.0};
13 float fresults1
[N
] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,48.00,54.00,60.00,66.00,72.00,78.00,84.00,90.00};
14 float fresults2
[N
] = {0.00,6.00,12.00,18.00,24.00,30.00,36.00,42.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
16 /****************************************************/
17 __attribute__ ((noinline
))
18 void icheck_results (int *a
, int *results
)
22 for (i
= 0; i
< N
; i
++)
24 if (a
[i
] != results
[i
])
29 __attribute__ ((noinline
))
30 void fcheck_results (float *a
, float *results
)
34 for (i
= 0; i
< N
; i
++)
36 if (a
[i
] != results
[i
])
41 __attribute__ ((noinline
)) void
44 fcheck_results (a
, fmul_results
);
47 __attribute__ ((noinline
)) void
50 fcheck_results (a
, fadd_results
);
53 __attribute__ ((noinline
)) void
56 icheck_results (a
, iadd_results
);
59 __attribute__ ((noinline
)) void
62 fcheck_results (a
, fresults1
);
65 __attribute__ ((noinline
)) void
68 fcheck_results (a
, fresults2
);
73 float b
[N
] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
74 float c
[N
] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
75 float d
[N
] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
76 int ic
[N
] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
77 int ib
[N
] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
79 char cb
[N
] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
83 /* All of the loops below are currently vectorizable. */
85 __attribute__ ((noinline
)) int
90 /* Test 1: copy chars. */
91 for (i
= 0; i
< N
; i
++)
97 for (i
= 0; i
< N
; i
++)
104 /* Test 2: fp mult. */
105 for (i
= 0; i
< N
; i
++)
112 /* Test 3: mixed types (int, fp), same nunits in vector. */
113 for (i
= 0; i
< N
; i
++)
115 a
[i
] = b
[i
] + c
[i
] + d
[i
];
116 e
[i
] = b
[i
] + c
[i
] + d
[i
];
117 ia
[i
] = ib
[i
] + ic
[i
];
124 /* Test 4: access with offset. */
125 for (i
= 0; i
< N
/2; i
++)
127 a
[i
] = b
[i
+N
/2] * c
[i
+N
/2] - b
[i
] * c
[i
];
128 e
[i
+N
/2] = b
[i
] * c
[i
+N
/2] + b
[i
+N
/2] * c
[i
];
134 /* Test 5: access with offset */
135 for (i
= 1; i
<=N
-4; i
++)
141 for (i
= 1; i
<=N
-4; i
++)
143 if (a
[i
+3] != b
[i
-1])
148 /* Test 6 - loop induction with stride != 1. */
159 for (i
= 0; i
<N
; i
++)
166 /* Test 7 - reverse access. */
167 for (i
= N
; i
> 0; i
--)
173 for (i
= 0; i
<N
; i
++)
180 /* Tests 8,9,10 - constants. */
181 for (i
= 0; i
< N
; i
++)
187 for (i
= 0; i
< N
; i
++)
193 for (i
= 0; i
< N
; i
++)
199 for (i
= 0; i
< N
; i
++)
205 for (i
= 0; i
< N
; i
++)
211 for (i
= 0; i
< N
; i
++)
213 if (ia
[i
] != ib
[i
] + 5)
227 /* { dg-final { scan-tree-dump-times "vectorized 10 loops" 1 "vect" } } */
228 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */
229 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */
230 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */