Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-peel-3-src.c

raw
1 #include <stdarg.h>
2 #include "tree-vect.h"
3
4 #if VECTOR_BITS > 128
5 #define NINTS (VECTOR_BITS / 32)
6 #define EXTRA (NINTS * 2)
7 #else
8 #define NINTS 4
9 #define EXTRA 10
10 #endif
11
12 #define N 128
13
14 #define RES_A (N * N / 4)
15 #define RES_B (N * (N + 1) / 2 + (NINTS + 3) * (N + 1))
16 #define RES_C (N * (N + 1) / 2 + (N + 1))
17 #define RES (RES_A + RES_B + RES_C)
18
19 int ib[N + EXTRA];
20 int ia[N + EXTRA];
21 int ic[N + EXTRA];
22
23 __attribute__ ((noinline))
24 int main1 ()
25 {
26 int i, suma = 0, sumb = 0, sumc = 0;
27
28 /* ib and ic have same misalignment, we peel to align them. */
29 for (i = 0; i <= N; i++)
30 {
31 suma += ia[i];
32 sumb += ib[i + NINTS + 1];
33 sumc += ic[i + 1];
34 }
35
36 /* check results: */
37 if (suma + sumb + sumc != RES)
38 abort ();
39
40 return 0;
41 }
42
43 int main (void)
44 {
45 int i;
46
47 check_vect ();
48
49 for (i = 0; i < N + EXTRA; i++)
50 {
51 asm volatile ("" : "+r" (i));
52 ib[i] = i;
53 ic[i] = i+2;
54 ia[i] = i/2;
55 }
56
57 return main1 ();
58 }