Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/atomic-inst-ops.inc

raw
1 /* Support code for atomic instruction tests. */
2
3 /* Define types names without spaces. */
4 typedef unsigned char uchar;
5 typedef unsigned short ushort;
6 typedef unsigned int uint;
7 typedef long long longlong;
8 typedef unsigned long long ulonglong;
9 typedef __int128_t int128;
10 typedef __uint128_t uint128;
11
12 #define FNNAME(NAME,TY) NAME
13
14 /* Expand one-model functions. */
15 #define TEST_M1(NAME, FN, TY, MODEL, DUMMY) \
16 FN (test_##NAME##_##TY, TY, MODEL)
17
18 /* Expand two-model functions. */
19 #define TEST_M2(NAME, FN, TY, MODEL1, MODEL2) \
20 FN (test_##NAME##_##TY, TY, MODEL1, MODEL2)
21
22 /* Typest to test. */
23 #define TEST_TY(NAME, FN, N, MODEL1, MODEL2) \
24 TEST_M##N (NAME, FN, char, MODEL1, MODEL2) \
25 TEST_M##N (NAME, FN, uchar, MODEL1, MODEL2) \
26 TEST_M##N (NAME, FN, short, MODEL1, MODEL2) \
27 TEST_M##N (NAME, FN, ushort, MODEL1, MODEL2) \
28 TEST_M##N (NAME, FN, int, MODEL1, MODEL2) \
29 TEST_M##N (NAME, FN, uint, MODEL1, MODEL2) \
30 TEST_M##N (NAME, FN, longlong, MODEL1, MODEL2) \
31 TEST_M##N (NAME, FN, ulonglong, MODEL1, MODEL2) \
32 TEST_M##N (NAME, FN, int128, MODEL1, MODEL2) \
33 TEST_M##N (NAME, FN, uint128, MODEL1, MODEL2)
34
35 /* Models to test. */
36 #define TEST_MODEL(NAME, FN, N) \
37 TEST_TY (NAME##_relaxed, FN, N, __ATOMIC_RELAXED, DUMMY) \
38 TEST_TY (NAME##_consume, FN, N, __ATOMIC_CONSUME, DUMMY) \
39 TEST_TY (NAME##_acquire, FN, N, __ATOMIC_ACQUIRE, DUMMY) \
40 TEST_TY (NAME##_release, FN, N, __ATOMIC_RELEASE, DUMMY) \
41 TEST_TY (NAME##_acq_rel, FN, N, __ATOMIC_ACQ_REL, DUMMY) \
42 TEST_TY (NAME##_seq_cst, FN, N, __ATOMIC_SEQ_CST, DUMMY) \
43
44 /* Cross-product of models to test. */
45 #define TEST_MODEL_M1(NAME, FN, N, M) \
46 TEST_TY (NAME##_relaxed, FN, N, M, __ATOMIC_RELAXED) \
47 TEST_TY (NAME##_consume, FN, N, M, __ATOMIC_CONSUME) \
48 TEST_TY (NAME##_acquire, FN, N, M, __ATOMIC_ACQUIRE) \
49 TEST_TY (NAME##_release, FN, N, M, __ATOMIC_RELEASE) \
50 TEST_TY (NAME##_acq_rel, FN, N, M, __ATOMIC_ACQ_REL) \
51 TEST_TY (NAME##_seq_cst, FN, N, M, __ATOMIC_SEQ_CST) \
52
53 #define TEST_MODEL_M2(NAME, FN) \
54 TEST_MODEL_M1 (NAME##_relaxed, FN, 2, __ATOMIC_RELAXED) \
55 TEST_MODEL_M1 (NAME##_consume, FN, 2, __ATOMIC_CONSUME) \
56 TEST_MODEL_M1 (NAME##_acquire, FN, 2, __ATOMIC_ACQUIRE) \
57 TEST_MODEL_M1 (NAME##_release, FN, 2, __ATOMIC_RELEASE) \
58 TEST_MODEL_M1 (NAME##_acq_rel, FN, 2, __ATOMIC_ACQ_REL) \
59 TEST_MODEL_M1 (NAME##_seq_cst, FN, 2, __ATOMIC_SEQ_CST) \
60
61 /* Expand functions for a cross-product of memory models and types. */
62 #define TEST_TWO(NAME, FN) TEST_MODEL_M2 (NAME, FN)
63
64 /* Expand functions for a set of memory models and types. */
65 #define TEST_ONE(NAME, FN) TEST_MODEL (NAME, FN, 1)
66