1 /* { dg-require-effective-target mmap } */
7 #define MMAP_SIZE 0x20000
8 #define ADDRESS1 0x1122000000
9 #define ADDRESS2 (ADDRESS1 + MMAP_SIZE * 16)
10 #define TYPE unsigned int
13 #define MAP_ANONYMOUS MAP_ANON
17 #define RHS1(B) RHS0(B) + b[(B) + 1]
18 #define RHS2(B) RHS1(B) + b[(B) + 2]
19 #define RHS3(B) RHS2(B) + b[(B) + 3]
20 #define RHS4(B) RHS3(B) + b[(B) + 4]
21 #define RHS5(B) RHS4(B) + b[(B) + 5]
22 #define RHS6(B) RHS5(B) + b[(B) + 6]
23 #define RHS7(B) RHS6(B) + b[(B) + 7]
26 #define LHS1(B) LHS0(B) = a[(B) + 1]
27 #define LHS2(B) LHS1(B) = a[(B) + 2]
28 #define LHS3(B) LHS2(B) = a[(B) + 3]
29 #define LHS4(B) LHS3(B) = a[(B) + 4]
30 #define LHS5(B) LHS4(B) = a[(B) + 5]
31 #define LHS6(B) LHS5(B) = a[(B) + 6]
32 #define LHS7(B) LHS6(B) = a[(B) + 7]
34 #define DEF_GROUP_SIZE(MULT, GAP, NO_GAP) \
35 void __attribute__((noinline, noclone)) \
36 gap_load_##MULT (TYPE *__restrict a, TYPE *__restrict b) \
38 for (int i = 0; i < COUNT; i++) \
39 a[i] = RHS##GAP (i * MULT); \
41 void __attribute__((noinline, noclone)) \
42 no_gap_load_##MULT (TYPE *__restrict a, TYPE *__restrict b) \
44 for (int i = 0; i < COUNT; i++) \
45 a[i] = RHS##NO_GAP (i * MULT); \
47 void __attribute__((noinline, noclone)) \
48 gap_store_##MULT (TYPE *__restrict a, TYPE *__restrict b) \
50 for (int i = 0; i < COUNT; i++) \
51 LHS##GAP (i * MULT) = b[i]; \
53 void __attribute__((noinline, noclone)) \
54 no_gap_store_##MULT (TYPE *__restrict a, TYPE *__restrict b) \
56 for (int i = 0; i < COUNT; i++) \
57 LHS##NO_GAP (i * MULT) = b[i]; \
60 #define USE_GROUP_SIZE(MULT) \
61 gap_load_##MULT (end_x - COUNT, end_y - COUNT * MULT + 1); \
62 no_gap_load_##MULT (end_x - COUNT, end_y - COUNT * MULT); \
63 gap_store_##MULT (end_x - COUNT * MULT + 1, end_y - COUNT); \
64 no_gap_store_##MULT (end_x - COUNT * MULT, end_y - COUNT)
66 DEF_GROUP_SIZE (2, 0, 1)
67 DEF_GROUP_SIZE (3, 1, 2)
68 DEF_GROUP_SIZE (4, 2, 3)
69 DEF_GROUP_SIZE (5, 3, 4)
70 DEF_GROUP_SIZE (6, 4, 5)
71 DEF_GROUP_SIZE (7, 5, 6)
72 DEF_GROUP_SIZE (8, 6, 7)
80 x
= mmap ((void *) ADDRESS1
, MMAP_SIZE
, PROT_READ
| PROT_WRITE
,
81 MAP_PRIVATE
| MAP_ANONYMOUS
, -1, 0);
88 y
= mmap ((void *) ADDRESS2
, MMAP_SIZE
, PROT_READ
| PROT_WRITE
,
89 MAP_PRIVATE
| MAP_ANONYMOUS
, -1, 0);
96 end_x
= (TYPE
*) ((char *) x
+ MMAP_SIZE
);
97 end_y
= (TYPE
*) ((char *) y
+ MMAP_SIZE
);