Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-4.c

raw
1 /* { dg-do compile } */
2 /* { dg-additional-options "-march=rv32gcv -mabi=ilp32d -mrvv-vector-bits=zvl" } */
3
4 #include <stdint-gcc.h>
5
6 void __attribute__ ((noinline, noclone))
7 f (uint64_t *__restrict x, uint16_t *__restrict y, int n)
8 {
9 for (int i = 0, j = 0; i < n; i += 2, j += 4)
10 {
11 x[i + 0] += 1;
12 x[i + 1] += 2;
13 y[j + 0] += 1;
14 y[j + 1] += 2;
15 y[j + 2] += 3;
16 y[j + 3] += 4;
17 }
18 }
19
20 void __attribute__ ((optimize (0)))
21 f_init (uint64_t *__restrict x, uint64_t *__restrict x2, uint16_t *__restrict y,
22 uint16_t *__restrict y2, int n)
23 {
24 for (int i = 0, j = 0; i < n; i += 2, j += 4)
25 {
26 x[i + 0] = i * 897 + 189;
27 x[i + 1] = i * 79 + 55963;
28 y[j + 0] = j * 18 + 78642;
29 y[j + 1] = j * 9 + 8634;
30 y[j + 2] = j * 78 + 2588;
31 y[j + 3] = j * 38 + 8932;
32
33 x2[i + 0] = i * 897 + 189;
34 x2[i + 1] = i * 79 + 55963;
35 y2[j + 0] = j * 18 + 78642;
36 y2[j + 1] = j * 9 + 8634;
37 y2[j + 2] = j * 78 + 2588;
38 y2[j + 3] = j * 38 + 8932;
39 }
40 }
41
42 void __attribute__ ((optimize (0)))
43 f_golden (uint64_t *__restrict x, uint16_t *__restrict y, int n)
44 {
45 for (int i = 0, j = 0; i < n; i += 2, j += 4)
46 {
47 x[i + 0] += 1;
48 x[i + 1] += 2;
49 y[j + 0] += 1;
50 y[j + 1] += 2;
51 y[j + 2] += 3;
52 y[j + 3] += 4;
53 }
54 }
55
56 void __attribute__ ((optimize (0)))
57 f_check (uint64_t *__restrict x, uint64_t *__restrict x2,
58 uint16_t *__restrict y, uint16_t *__restrict y2, int n)
59 {
60 for (int i = 0, j = 0; i < n; i += 2, j += 4)
61 {
62 if (x[i + 0] != x2[i + 0])
63 __builtin_abort ();
64 if (x[i + 1] != x2[i + 1])
65 __builtin_abort ();
66 if (y[j + 0] != y2[j + 0])
67 __builtin_abort ();
68 if (y[j + 1] != y2[j + 1])
69 __builtin_abort ();
70 if (y[j + 2] != y2[j + 2])
71 __builtin_abort ();
72 if (y[j + 3] != y2[j + 3])
73 __builtin_abort ();
74 }
75 }