Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-80-big-array.c

raw
1 /* { dg-require-effective-target vect_float } */
2 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
3
4 #include <stdarg.h>
5 #include "tree-vect.h"
6
7 #define N 128
8
9 float fa[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
10 float fb[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
11 float fc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
12
13 /* Check handling of accesses for which the "initial condition" -
14 the expression that represents the first location accessed - is
15 more involved than just an ssa_name. */
16
17 __attribute__ ((noinline)) int
18 main1 (float * __restrict__ pa, float * __restrict__ pb, float *__restrict__ pc)
19 {
20 int i;
21 float *q = pb + 4;
22 for (i = 0; i < N; i++)
23 {
24 fb[i] = i;
25 fc[i] = 0.5+i;
26 asm volatile ("" ::: "memory");
27 }
28 for (; i < N+4; i++)
29 {
30 fb[i] = i;
31 asm volatile ("" ::: "memory");
32 }
33
34 for (i = 0; i < N; i++)
35 {
36 pa[i] = q[i] * pc[i];
37 }
38
39 #pragma GCC novector
40 for (i = 0; i < N; i++)
41 {
42 if (pa[i] != q[i] * pc[i])
43 abort ();
44 }
45
46 return 0;
47 }
48
49
50 int main (void)
51 {
52 check_vect ();
53
54 main1 (fa, fb, fc);
55
56 return 0;
57 }
58
59 /* For targets that don't support misaligned loads we version for the
60 all three accesses (peeling to align the store will not force the
61 two loads to be aligned). */
62
63 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
64 /* Uncomment when this testcase gets vectorized again:
65 dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } }
66 dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } }
67 dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 3 "vect" { target vect_no_align } }
68 */
69 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */