Lines Matching +full:64 +full:- +full:bit

1 // SPDX-License-Identifier: GPL-2.0-or-later
20 #define TEST(bit, op, c_op, val) \ argument
22 atomic##bit##_set(&v, v0); \
24 atomic##bit##_##op(val, &v); \
26 WARN(atomic##bit##_read(&v) != r, "%Lx != %Lx\n", \
27 (unsigned long long)atomic##bit##_read(&v), \
33 * @test should be a macro accepting parameters (bit, op, ...)
36 #define FAMILY_TEST(test, bit, op, args...) \ argument
38 test(bit, op, ##args); \
39 test(bit, op##_acquire, ##args); \
40 test(bit, op##_release, ##args); \
41 test(bit, op##_relaxed, ##args); \
44 #define TEST_RETURN(bit, op, c_op, val) \ argument
46 atomic##bit##_set(&v, v0); \
49 BUG_ON(atomic##bit##_##op(val, &v) != r); \
50 BUG_ON(atomic##bit##_read(&v) != r); \
53 #define TEST_FETCH(bit, op, c_op, val) \ argument
55 atomic##bit##_set(&v, v0); \
58 BUG_ON(atomic##bit##_##op(val, &v) != v0); \
59 BUG_ON(atomic##bit##_read(&v) != r); \
62 #define RETURN_FAMILY_TEST(bit, op, c_op, val) \ argument
64 FAMILY_TEST(TEST_RETURN, bit, op, c_op, val); \
67 #define FETCH_FAMILY_TEST(bit, op, c_op, val) \ argument
69 FAMILY_TEST(TEST_FETCH, bit, op, c_op, val); \
72 #define TEST_ARGS(bit, op, init, ret, expect, args...) \ argument
74 atomic##bit##_set(&v, init); \
75 BUG_ON(atomic##bit##_##op(&v, ##args) != ret); \
76 BUG_ON(atomic##bit##_read(&v) != expect); \
79 #define XCHG_FAMILY_TEST(bit, init, new) \ argument
81 FAMILY_TEST(TEST_ARGS, bit, xchg, init, init, new, new); \
84 #define CMPXCHG_FAMILY_TEST(bit, init, new, wrong) \ argument
86 FAMILY_TEST(TEST_ARGS, bit, cmpxchg, \
88 FAMILY_TEST(TEST_ARGS, bit, cmpxchg, \
92 #define INC_RETURN_FAMILY_TEST(bit, i) \ argument
94 FAMILY_TEST(TEST_ARGS, bit, inc_return, \
98 #define DEC_RETURN_FAMILY_TEST(bit, i) \ argument
100 FAMILY_TEST(TEST_ARGS, bit, dec_return, \
101 i, (i) - one, (i) - one); \
115 TEST(, add, +=, -one); in test_atomic()
116 TEST(, sub, -=, onestwos); in test_atomic()
117 TEST(, sub, -=, -one); in test_atomic()
124 RETURN_FAMILY_TEST(, add_return, +=, -one); in test_atomic()
125 RETURN_FAMILY_TEST(, sub_return, -=, onestwos); in test_atomic()
126 RETURN_FAMILY_TEST(, sub_return, -=, -one); in test_atomic()
129 FETCH_FAMILY_TEST(, fetch_add, +=, -one); in test_atomic()
130 FETCH_FAMILY_TEST(, fetch_sub, -=, onestwos); in test_atomic()
131 FETCH_FAMILY_TEST(, fetch_sub, -=, -one); in test_atomic()
166 TEST(64, add, +=, onestwos); in test_atomic64()
167 TEST(64, add, +=, -one); in test_atomic64()
168 TEST(64, sub, -=, onestwos); in test_atomic64()
169 TEST(64, sub, -=, -one); in test_atomic64()
170 TEST(64, or, |=, v1); in test_atomic64()
171 TEST(64, and, &=, v1); in test_atomic64()
172 TEST(64, xor, ^=, v1); in test_atomic64()
173 TEST(64, andnot, &= ~, v1); in test_atomic64()
175 RETURN_FAMILY_TEST(64, add_return, +=, onestwos); in test_atomic64()
176 RETURN_FAMILY_TEST(64, add_return, +=, -one); in test_atomic64()
177 RETURN_FAMILY_TEST(64, sub_return, -=, onestwos); in test_atomic64()
178 RETURN_FAMILY_TEST(64, sub_return, -=, -one); in test_atomic64()
180 FETCH_FAMILY_TEST(64, fetch_add, +=, onestwos); in test_atomic64()
181 FETCH_FAMILY_TEST(64, fetch_add, +=, -one); in test_atomic64()
182 FETCH_FAMILY_TEST(64, fetch_sub, -=, onestwos); in test_atomic64()
183 FETCH_FAMILY_TEST(64, fetch_sub, -=, -one); in test_atomic64()
185 FETCH_FAMILY_TEST(64, fetch_or, |=, v1); in test_atomic64()
186 FETCH_FAMILY_TEST(64, fetch_and, &=, v1); in test_atomic64()
187 FETCH_FAMILY_TEST(64, fetch_andnot, &= ~, v1); in test_atomic64()
188 FETCH_FAMILY_TEST(64, fetch_xor, ^=, v1); in test_atomic64()
197 r -= one; in test_atomic64()
200 INC_RETURN_FAMILY_TEST(64, v0); in test_atomic64()
201 DEC_RETURN_FAMILY_TEST(64, v0); in test_atomic64()
203 XCHG_FAMILY_TEST(64, v0, v1); in test_atomic64()
204 CMPXCHG_FAMILY_TEST(64, v0, v1, v2); in test_atomic64()
216 BUG_ON(atomic64_dec_if_positive(&v) != (onestwos - 1)); in test_atomic64()
217 r -= one; in test_atomic64()
221 BUG_ON(atomic64_dec_if_positive(&v) != -one); in test_atomic64()
224 INIT(-one); in test_atomic64()
225 BUG_ON(atomic64_dec_if_positive(&v) != (-one - one)); in test_atomic64()
237 INIT(-one); in test_atomic64()
256 "x86-64", in test_atomics_init()