[AArch64] Fix SVE testsuite failures for ILP32 (PR 83846)
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / test_frame_common.h
blobc63fbcedd79144765e3fcd69160c73f240fda3df
1 extern void abort ();
3 #define CVT(v) ((unsigned char)(v))
5 static void __attribute__((noinline, noclone))
6 check_args_8 (int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7,
7 int a8)
9 if (a0 != 0
10 || a1 != 1
11 || a2 != 2
12 || a3 != 3
13 || a4 != 4
14 || a5 != 5
15 || a6 != 6
16 || a7 != 7
17 || a8 != 8)
18 abort ();
21 static void __attribute__((noinline, noclone))
22 check_args_24 (int a0, int a1, int a2, int a3, int a4, int a5, int a6, int a7,
23 int a8, int a9, int a10)
25 if (a0 != 0
26 || a1 != 1
27 || a2 != 2
28 || a3 != 3
29 || a4 != 4
30 || a5 != 5
31 || a6 != 6
32 || a7 != 7
33 || a8 != 8
34 || a9 != 9
35 || a10 != 10)
36 abort ();
39 void __attribute__ ((noinline, noclone))
40 initialize_array (unsigned char *a, int len)
42 int i;
44 for (i = 0; i < (len / 2); i++)
46 a[i] = i;
47 a[len - i - 1] = i;
50 return;
53 #define t_frame_pattern(name, local_size, callee_saved)\
54 int \
55 name (void)\
57 unsigned char a[local_size];\
58 initialize_array (a, local_size); \
59 __asm__ ("":::callee_saved); \
60 if (a[0] != a[local_size - 1] \
61 || a[0] != 0) \
62 return 0; \
63 if (a[local_size / 2 - 1] != a[local_size / 2] \
64 || a[local_size / 2 - 1] != CVT (local_size / 2 - 1)) \
65 return 0; \
66 return 1; \
69 #define t_frame_pattern_outgoing(name, local_size, callee_saved, out_going_num, ...)\
70 int \
71 name (void)\
73 unsigned char a[local_size];\
74 initialize_array (a, local_size); \
75 __asm__ ("":::callee_saved); \
76 if (a[0] != a[local_size - 1] \
77 || a[0] != 0) \
78 return 0; \
79 if (a[local_size / 2 - 1] != a[local_size / 2] \
80 || a[local_size / 2 - 1] != CVT (local_size / 2 - 1)) \
81 return 0; \
82 check_args_ ## out_going_num (a[0], a[1], a[2], a[3], a[4], a[5], a[6],\
83 a[7], __VA_ARGS__); \
84 return 1; \
87 #define t_frame_run(name) \
88 int \
89 main (int argc, char **argv) \
91 if (!name ())\
92 abort ();\
93 return 0;\