2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-107.c
blobaaab9c00345bf7f0b25fbcda25a141988bda9eac
1 /* { dg-require-effective-target vect_float } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 16
8 float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
9 float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
10 float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
12 __attribute__ ((noinline)) int
13 main1 (void)
15 int i;
16 float a[N];
18 /* Strided access. Vectorizable on platforms that support load of strided
19 accesses (extract of even/odd vector elements). */
20 for (i = 0; i < N/2; i++)
22 a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
23 d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
26 /* Check results. */
27 for (i = 0; i < N/2; i++)
29 if (a[i] != b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i]
30 || d[i] != b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i])
31 abort();
34 return 0;
37 int main (void)
39 check_vect ();
40 return main1 ();
43 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided2 } } } */
44 /* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail vect_strided2 } } } */