aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/arch/aarch64
diff options
context:
space:
mode:
authorJere Leppänen <jere.leppanen@nokia.com>2022-03-03 15:57:04 +0200
committerPetri Savolainen <petri.savolainen@nokia.com>2022-03-08 15:27:32 +0200
commit18bf13419812ebcc510a1c51fca1ba9e1c2c7df9 (patch)
tree9c53035ee46207d54f069f06f7606512b418e597 /platform/linux-generic/arch/aarch64
parent5f787b6ff6f0214890df73c4f07741bb34108fa9 (diff)
linux-gen: use _odp_u128_t instead of __int128
Replace usage of __int128 and __int128_t with _odp_u128_t. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'platform/linux-generic/arch/aarch64')
-rw-r--r--platform/linux-generic/arch/aarch64/odp_atomic.h82
-rw-r--r--platform/linux-generic/arch/aarch64/odp_llsc.h8
2 files changed, 43 insertions, 47 deletions
diff --git a/platform/linux-generic/arch/aarch64/odp_atomic.h b/platform/linux-generic/arch/aarch64/odp_atomic.h
index 199a54eca..d3b8ea4dc 100644
--- a/platform/linux-generic/arch/aarch64/odp_atomic.h
+++ b/platform/linux-generic/arch/aarch64/odp_atomic.h
@@ -37,22 +37,18 @@ do { \
#define LL_MO(mo) (HAS_ACQ((mo)) ? __ATOMIC_ACQUIRE : __ATOMIC_RELAXED)
#define SC_MO(mo) (HAS_RLS((mo)) ? __ATOMIC_RELEASE : __ATOMIC_RELAXED)
-/* Prevent warnings about ISO C not supporting __int128 */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wpedantic"
-
#ifndef __ARM_FEATURE_QRDMX /* Feature only available in v8.1a and beyond */
static inline bool
-__lockfree_compare_exchange_16(register __int128 *var, __int128 *exp,
- register __int128 neu, bool weak, int mo_success,
+__lockfree_compare_exchange_16(register _odp_u128_t *var, _odp_u128_t *exp,
+ register _odp_u128_t neu, bool weak, int mo_success,
int mo_failure)
{
(void)weak; /* Always do strong CAS or we can't perform atomic read */
/* Ignore memory ordering for failure, memory order for
* success must be stronger or equal. */
(void)mo_failure;
- register __int128 old;
- register __int128 expected;
+ register _odp_u128_t old;
+ register _odp_u128_t expected;
int ll_mo = LL_MO(mo_success);
int sc_mo = SC_MO(mo_success);
@@ -67,10 +63,10 @@ __lockfree_compare_exchange_16(register __int128 *var, __int128 *exp,
return old == expected;
}
-static inline __int128 __lockfree_exchange_16(__int128 *var, __int128 neu,
- int mo)
+static inline _odp_u128_t __lockfree_exchange_16(_odp_u128_t *var,
+ _odp_u128_t neu, int mo)
{
- register __int128 old;
+ register _odp_u128_t old;
int ll_mo = LL_MO(mo);
int sc_mo = SC_MO(mo);
@@ -82,10 +78,10 @@ static inline __int128 __lockfree_exchange_16(__int128 *var, __int128 neu,
return old;
}
-static inline __int128 __lockfree_fetch_and_16(__int128 *var, __int128 mask,
- int mo)
+static inline _odp_u128_t __lockfree_fetch_and_16(_odp_u128_t *var,
+ _odp_u128_t mask, int mo)
{
- register __int128 old;
+ register _odp_u128_t old;
int ll_mo = LL_MO(mo);
int sc_mo = SC_MO(mo);
@@ -97,10 +93,10 @@ static inline __int128 __lockfree_fetch_and_16(__int128 *var, __int128 mask,
return old;
}
-static inline __int128 __lockfree_fetch_or_16(__int128 *var, __int128 mask,
- int mo)
+static inline _odp_u128_t __lockfree_fetch_or_16(_odp_u128_t *var,
+ _odp_u128_t mask, int mo)
{
- register __int128 old;
+ register _odp_u128_t old;
int ll_mo = LL_MO(mo);
int sc_mo = SC_MO(mo);
@@ -114,8 +110,8 @@ static inline __int128 __lockfree_fetch_or_16(__int128 *var, __int128 mask,
#else
-static inline __int128_t cas_u128(__int128_t *ptr, __int128_t old_val,
- __int128_t new_val, int mo)
+static inline _odp_u128_t cas_u128(_odp_u128_t *ptr, _odp_u128_t old_val,
+ _odp_u128_t new_val, int mo)
{
/* CASP instructions require that the first register number is paired */
register uint64_t old0 __asm__ ("x0");
@@ -152,18 +148,18 @@ static inline __int128_t cas_u128(__int128_t *ptr, __int128_t old_val,
abort();
}
- return ((__int128)old0) | (((__int128)old1) << 64);
+ return ((_odp_u128_t)old0) | (((_odp_u128_t)old1) << 64);
}
static inline bool
-__lockfree_compare_exchange_16(register __int128 *var, __int128 *exp,
- register __int128 neu, bool weak, int mo_success,
+__lockfree_compare_exchange_16(register _odp_u128_t *var, _odp_u128_t *exp,
+ register _odp_u128_t neu, bool weak, int mo_success,
int mo_failure)
{
(void)weak;
(void)mo_failure;
- __int128 old;
- __int128 expected;
+ _odp_u128_t old;
+ _odp_u128_t expected;
expected = *exp;
old = cas_u128(var, expected, neu, mo_success);
@@ -171,11 +167,11 @@ __lockfree_compare_exchange_16(register __int128 *var, __int128 *exp,
return old == expected;
}
-static inline __int128 __lockfree_exchange_16(__int128 *var, __int128 neu,
- int mo)
+static inline _odp_u128_t __lockfree_exchange_16(_odp_u128_t *var,
+ _odp_u128_t neu, int mo)
{
- __int128 old;
- __int128 expected;
+ _odp_u128_t old;
+ _odp_u128_t expected;
do {
expected = *var;
@@ -184,11 +180,11 @@ static inline __int128 __lockfree_exchange_16(__int128 *var, __int128 neu,
return old;
}
-static inline __int128 __lockfree_fetch_and_16(__int128 *var, __int128 mask,
- int mo)
+static inline _odp_u128_t __lockfree_fetch_and_16(_odp_u128_t *var,
+ _odp_u128_t mask, int mo)
{
- __int128 old;
- __int128 expected;
+ _odp_u128_t old;
+ _odp_u128_t expected;
do {
expected = *var;
@@ -197,11 +193,11 @@ static inline __int128 __lockfree_fetch_and_16(__int128 *var, __int128 mask,
return old;
}
-static inline __int128 __lockfree_fetch_or_16(__int128 *var, __int128 mask,
- int mo)
+static inline _odp_u128_t __lockfree_fetch_or_16(_odp_u128_t *var,
+ _odp_u128_t mask, int mo)
{
- __int128 old;
- __int128 expected;
+ _odp_u128_t old;
+ _odp_u128_t expected;
do {
expected = *var;
@@ -212,9 +208,9 @@ static inline __int128 __lockfree_fetch_or_16(__int128 *var, __int128 mask,
#endif /* __ARM_FEATURE_QRDMX */
-static inline __int128 __lockfree_load_16(__int128 *var, int mo)
+static inline _odp_u128_t __lockfree_load_16(_odp_u128_t *var, int mo)
{
- __int128 old = *var; /* Possibly torn read */
+ _odp_u128_t old = *var; /* Possibly torn read */
/* Do CAS to ensure atomicity
* Either CAS succeeds (writing back the same value)
@@ -226,15 +222,15 @@ static inline __int128 __lockfree_load_16(__int128 *var, int mo)
static inline _odp_u128_t lockfree_load_u128(_odp_u128_t *atomic)
{
- return __lockfree_load_16((__int128 *)atomic, __ATOMIC_RELAXED);
+ return __lockfree_load_16((_odp_u128_t *)atomic, __ATOMIC_RELAXED);
}
static inline int lockfree_cas_acq_rel_u128(_odp_u128_t *atomic,
_odp_u128_t old_val,
_odp_u128_t new_val)
{
- return __lockfree_compare_exchange_16((__int128 *)atomic,
- (__int128 *)&old_val,
+ return __lockfree_compare_exchange_16((_odp_u128_t *)atomic,
+ (_odp_u128_t *)&old_val,
new_val,
0,
__ATOMIC_ACQ_REL,
@@ -291,11 +287,9 @@ static inline bitset_t bitset_mask(uint32_t bit)
if (bit < 64)
return 1ULL << bit;
else
- return (unsigned __int128)(1ULL << (bit - 64)) << 64;
+ return (_odp_u128_t)(1ULL << (bit - 64)) << 64;
}
-#pragma GCC diagnostic pop
-
#else
#error Unsupported size of bit sets (ATOM_BITSET_SIZE)
#endif
diff --git a/platform/linux-generic/arch/aarch64/odp_llsc.h b/platform/linux-generic/arch/aarch64/odp_llsc.h
index 2561451ca..1c2610511 100644
--- a/platform/linux-generic/arch/aarch64/odp_llsc.h
+++ b/platform/linux-generic/arch/aarch64/odp_llsc.h
@@ -13,6 +13,8 @@
#error This file should not be included directly, please include odp_cpu.h
#endif
+#include <odp_types_internal.h>
+
static inline uint16_t ll8(uint8_t *var, int mm)
{
uint16_t old;
@@ -115,11 +117,11 @@ static inline uint32_t sc(uint64_t *var, uint64_t neu, int mm)
#define sc64(a, b, c) sc((a), (b), (c))
union i128 {
- __extension__ __int128 i128;
+ _odp_u128_t i128;
int64_t i64[2];
};
-__extension__ static inline __int128 lld(__int128 *var, int mm)
+static inline _odp_u128_t lld(_odp_u128_t *var, int mm)
{
union i128 old;
@@ -139,7 +141,7 @@ __extension__ static inline __int128 lld(__int128 *var, int mm)
}
/* Return 0 on success, 1 on failure */
-__extension__ static inline uint32_t scd(__int128 *var, __int128 neu, int mm)
+static inline uint32_t scd(_odp_u128_t *var, _odp_u128_t neu, int mm)
{
uint32_t ret;