summaryrefslogtreecommitdiff
path: root/lib/builtins
diff options
context:
space:
mode:
Diffstat (limited to 'lib/builtins')
-rw-r--r--lib/builtins/atomic.c14
-rw-r--r--lib/builtins/emutls.c17
-rw-r--r--lib/builtins/fp_add_impl.inc2
-rw-r--r--lib/builtins/fp_extend.h6
-rw-r--r--lib/builtins/fp_extend_impl.inc2
-rw-r--r--lib/builtins/fp_fixint_impl.inc2
-rw-r--r--lib/builtins/fp_fixuint_impl.inc2
-rw-r--r--lib/builtins/fp_lib.h22
-rw-r--r--lib/builtins/fp_mul_impl.inc2
-rw-r--r--lib/builtins/fp_trunc.h4
-rw-r--r--lib/builtins/fp_trunc_impl.inc2
-rw-r--r--lib/builtins/int_types.h4
-rw-r--r--lib/builtins/ppc/DD.h31
13 files changed, 53 insertions, 57 deletions
diff --git a/lib/builtins/atomic.c b/lib/builtins/atomic.c
index 35c8837dc..f1ddc3e0c 100644
--- a/lib/builtins/atomic.c
+++ b/lib/builtins/atomic.c
@@ -56,13 +56,13 @@ static const long SPINLOCK_MASK = SPINLOCK_COUNT - 1;
#include <machine/atomic.h>
#include <sys/umtx.h>
typedef struct _usem Lock;
-inline static void unlock(Lock *l) {
+__inline static void unlock(Lock *l) {
__c11_atomic_store((_Atomic(uint32_t)*)&l->_count, 1, __ATOMIC_RELEASE);
__c11_atomic_thread_fence(__ATOMIC_SEQ_CST);
if (l->_has_waiters)
_umtx_op(l, UMTX_OP_SEM_WAKE, 1, 0, 0);
}
-inline static void lock(Lock *l) {
+__inline static void lock(Lock *l) {
uint32_t old = 1;
while (!__c11_atomic_compare_exchange_weak((_Atomic(uint32_t)*)&l->_count, &old,
0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) {
@@ -76,12 +76,12 @@ static Lock locks[SPINLOCK_COUNT] = { [0 ... SPINLOCK_COUNT-1] = {0,1,0} };
#elif defined(__APPLE__)
#include <libkern/OSAtomic.h>
typedef OSSpinLock Lock;
-inline static void unlock(Lock *l) {
+__inline static void unlock(Lock *l) {
OSSpinLockUnlock(l);
}
/// Locks a lock. In the current implementation, this is potentially
/// unbounded in the contended case.
-inline static void lock(Lock *l) {
+__inline static void lock(Lock *l) {
OSSpinLockLock(l);
}
static Lock locks[SPINLOCK_COUNT]; // initialized to OS_SPINLOCK_INIT which is 0
@@ -89,12 +89,12 @@ static Lock locks[SPINLOCK_COUNT]; // initialized to OS_SPINLOCK_INIT which is 0
#else
typedef _Atomic(uintptr_t) Lock;
/// Unlock a lock. This is a release operation.
-inline static void unlock(Lock *l) {
+__inline static void unlock(Lock *l) {
__c11_atomic_store(l, 0, __ATOMIC_RELEASE);
}
/// Locks a lock. In the current implementation, this is potentially
/// unbounded in the contended case.
-inline static void lock(Lock *l) {
+__inline static void lock(Lock *l) {
uintptr_t old = 0;
while (!__c11_atomic_compare_exchange_weak(l, &old, 1, __ATOMIC_ACQUIRE,
__ATOMIC_RELAXED))
@@ -106,7 +106,7 @@ static Lock locks[SPINLOCK_COUNT];
/// Returns a lock to use for a given pointer.
-static inline Lock *lock_for_pointer(void *ptr) {
+static __inline Lock *lock_for_pointer(void *ptr) {
intptr_t hash = (intptr_t)ptr;
// Disregard the lowest 4 bits. We want all values that may be part of the
// same memory operation to hash to the same value and therefore use the same
diff --git a/lib/builtins/emutls.c b/lib/builtins/emutls.c
index 86f31ce01..09e79568b 100644
--- a/lib/builtins/emutls.c
+++ b/lib/builtins/emutls.c
@@ -37,7 +37,7 @@ typedef struct __emutls_control {
void* value; /* null or non-zero initial value for the object */
} __emutls_control;
-static inline void* emutls_memalign_alloc(size_t align, size_t size) {
+static __inline void *emutls_memalign_alloc(size_t align, size_t size) {
void *base;
#if EMUTLS_USE_POSIX_MEMALIGN
if (posix_memalign(&base, align, size) != 0)
@@ -55,7 +55,7 @@ static inline void* emutls_memalign_alloc(size_t align, size_t size) {
return base;
}
-static inline void emutls_memalign_free(void* base) {
+static __inline void emutls_memalign_free(void *base) {
#if EMUTLS_USE_POSIX_MEMALIGN
free(base);
#else
@@ -65,7 +65,7 @@ static inline void emutls_memalign_free(void* base) {
}
/* Emulated TLS objects are always allocated at run-time. */
-static inline void* emutls_allocate_object(__emutls_control* control) {
+static __inline void *emutls_allocate_object(__emutls_control *control) {
/* Use standard C types, check with gcc's emutls.o. */
typedef unsigned int gcc_word __attribute__((mode(word)));
typedef unsigned int gcc_pointer __attribute__((mode(pointer)));
@@ -116,7 +116,7 @@ static void emutls_init(void) {
}
/* Returns control->object.index; set index if not allocated yet. */
-static inline uintptr_t emutls_get_index(__emutls_control* control) {
+static __inline uintptr_t emutls_get_index(__emutls_control *control) {
uintptr_t index = __atomic_load_n(&control->object.index, __ATOMIC_ACQUIRE);
if (!index) {
static pthread_once_t once = PTHREAD_ONCE_INIT;
@@ -133,8 +133,8 @@ static inline uintptr_t emutls_get_index(__emutls_control* control) {
}
/* Updates newly allocated thread local emutls_address_array. */
-static inline void emutls_check_array_set_size(emutls_address_array* array,
- uintptr_t size) {
+static __inline void emutls_check_array_set_size(emutls_address_array *array,
+ uintptr_t size) {
if (array == NULL)
abort();
array->size = size;
@@ -144,7 +144,7 @@ static inline void emutls_check_array_set_size(emutls_address_array* array,
/* Returns the new 'data' array size, number of elements,
* which must be no smaller than the given index.
*/
-static inline uintptr_t emutls_new_data_array_size(uintptr_t index) {
+static __inline uintptr_t emutls_new_data_array_size(uintptr_t index) {
/* Need to allocate emutls_address_array with one extra slot
* to store the data array size.
* Round up the emutls_address_array size to multiple of 16.
@@ -155,7 +155,8 @@ static inline uintptr_t emutls_new_data_array_size(uintptr_t index) {
/* Returns the thread local emutls_address_array.
* Extends its size if necessary to hold address at index.
*/
-static inline emutls_address_array* emutls_get_address_array(uintptr_t index) {
+static __inline emutls_address_array *
+emutls_get_address_array(uintptr_t index) {
emutls_address_array* array = pthread_getspecific(emutls_pthread_key);
if (array == NULL) {
uintptr_t new_size = emutls_new_data_array_size(index);
diff --git a/lib/builtins/fp_add_impl.inc b/lib/builtins/fp_add_impl.inc
index 574188972..b47be1b64 100644
--- a/lib/builtins/fp_add_impl.inc
+++ b/lib/builtins/fp_add_impl.inc
@@ -14,7 +14,7 @@
#include "fp_lib.h"
-static inline fp_t __addXf3__(fp_t a, fp_t b) {
+static __inline fp_t __addXf3__(fp_t a, fp_t b) {
rep_t aRep = toRep(a);
rep_t bRep = toRep(b);
const rep_t aAbs = aRep & absMask;
diff --git a/lib/builtins/fp_extend.h b/lib/builtins/fp_extend.h
index 5c2b92310..6d95a0680 100644
--- a/lib/builtins/fp_extend.h
+++ b/lib/builtins/fp_extend.h
@@ -28,7 +28,7 @@ typedef double src_t;
typedef uint64_t src_rep_t;
#define SRC_REP_C UINT64_C
static const int srcSigBits = 52;
-static inline int src_rep_t_clz(src_rep_t a) {
+static __inline int src_rep_t_clz(src_rep_t a) {
#if defined __LP64__
return __builtin_clzl(a);
#else
@@ -75,12 +75,12 @@ static const int dstSigBits = 112;
// End of specialization parameters. Two helper routines for conversion to and
// from the representation of floating-point data as integer values follow.
-static inline src_rep_t srcToRep(src_t x) {
+static __inline src_rep_t srcToRep(src_t x) {
const union { src_t f; src_rep_t i; } rep = {.f = x};
return rep.i;
}
-static inline dst_t dstFromRep(dst_rep_t x) {
+static __inline dst_t dstFromRep(dst_rep_t x) {
const union { dst_t f; dst_rep_t i; } rep = {.i = x};
return rep.f;
}
diff --git a/lib/builtins/fp_extend_impl.inc b/lib/builtins/fp_extend_impl.inc
index edcfa8d23..b785cc768 100644
--- a/lib/builtins/fp_extend_impl.inc
+++ b/lib/builtins/fp_extend_impl.inc
@@ -38,7 +38,7 @@
#include "fp_extend.h"
-static inline dst_t __extendXfYf2__(src_t a) {
+static __inline dst_t __extendXfYf2__(src_t a) {
// Various constants whose values follow from the type parameters.
// Any reasonable optimizer will fold and propagate all of these.
const int srcBits = sizeof(src_t)*CHAR_BIT;
diff --git a/lib/builtins/fp_fixint_impl.inc b/lib/builtins/fp_fixint_impl.inc
index 035e87ca1..da70d4d39 100644
--- a/lib/builtins/fp_fixint_impl.inc
+++ b/lib/builtins/fp_fixint_impl.inc
@@ -14,7 +14,7 @@
#include "fp_lib.h"
-static inline fixint_t __fixint(fp_t a) {
+static __inline fixint_t __fixint(fp_t a) {
const fixint_t fixint_max = (fixint_t)((~(fixuint_t)0) / 2);
const fixint_t fixint_min = -fixint_max - 1;
// Break a into sign, exponent, significand
diff --git a/lib/builtins/fp_fixuint_impl.inc b/lib/builtins/fp_fixuint_impl.inc
index 5fefab0e2..b223c6384 100644
--- a/lib/builtins/fp_fixuint_impl.inc
+++ b/lib/builtins/fp_fixuint_impl.inc
@@ -14,7 +14,7 @@
#include "fp_lib.h"
-static inline fixuint_t __fixuint(fp_t a) {
+static __inline fixuint_t __fixuint(fp_t a) {
// Break a into sign, exponent, significand
const rep_t aRep = toRep(a);
const rep_t aAbs = aRep & absMask;
diff --git a/lib/builtins/fp_lib.h b/lib/builtins/fp_lib.h
index faebb99ec..223fb980a 100644
--- a/lib/builtins/fp_lib.h
+++ b/lib/builtins/fp_lib.h
@@ -46,12 +46,12 @@ typedef float fp_t;
#define REP_C UINT32_C
#define significandBits 23
-static inline int rep_clz(rep_t a) {
+static __inline int rep_clz(rep_t a) {
return __builtin_clz(a);
}
// 32x32 --> 64 bit multiply
-static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
+static __inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
const uint64_t product = (uint64_t)a*b;
*hi = product >> 32;
*lo = product;
@@ -66,7 +66,7 @@ typedef double fp_t;
#define REP_C UINT64_C
#define significandBits 52
-static inline int rep_clz(rep_t a) {
+static __inline int rep_clz(rep_t a) {
#if defined __LP64__
return __builtin_clzl(a);
#else
@@ -83,7 +83,7 @@ static inline int rep_clz(rep_t a) {
// 64x64 -> 128 wide multiply for platforms that don't have such an operation;
// many 64-bit platforms have this operation, but they tend to have hardware
// floating-point, so we don't bother with a special case for them here.
-static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
+static __inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
// Each of the component 32x32 -> 64 products
const uint64_t plolo = loWord(a) * loWord(b);
const uint64_t plohi = loWord(a) * hiWord(b);
@@ -112,7 +112,7 @@ typedef long double fp_t;
// 128-bit integer, we let the constant be casted to 128-bit integer
#define significandBits 112
-static inline int rep_clz(rep_t a) {
+static __inline int rep_clz(rep_t a) {
const union
{
__uint128_t ll;
@@ -148,7 +148,7 @@ static inline int rep_clz(rep_t a) {
// 128x128 -> 256 wide multiply for platforms that don't have such an operation;
// many 64-bit platforms have this operation, but they tend to have hardware
// floating-point, so we don't bother with a special case for them here.
-static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
+static __inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
const uint64_t product11 = Word_1(a) * Word_1(b);
const uint64_t product12 = Word_1(a) * Word_2(b);
@@ -228,28 +228,28 @@ static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
#define quietBit (implicitBit >> 1)
#define qnanRep (exponentMask | quietBit)
-static inline rep_t toRep(fp_t x) {
+static __inline rep_t toRep(fp_t x) {
const union { fp_t f; rep_t i; } rep = {.f = x};
return rep.i;
}
-static inline fp_t fromRep(rep_t x) {
+static __inline fp_t fromRep(rep_t x) {
const union { fp_t f; rep_t i; } rep = {.i = x};
return rep.f;
}
-static inline int normalize(rep_t *significand) {
+static __inline int normalize(rep_t *significand) {
const int shift = rep_clz(*significand) - rep_clz(implicitBit);
*significand <<= shift;
return 1 - shift;
}
-static inline void wideLeftShift(rep_t *hi, rep_t *lo, int count) {
+static __inline void wideLeftShift(rep_t *hi, rep_t *lo, int count) {
*hi = *hi << count | *lo >> (typeWidth - count);
*lo = *lo << count;
}
-static inline void wideRightShiftWithSticky(rep_t *hi, rep_t *lo, unsigned int count) {
+static __inline void wideRightShiftWithSticky(rep_t *hi, rep_t *lo, unsigned int count) {
if (count < typeWidth) {
const bool sticky = *lo << (typeWidth - count);
*lo = *hi << (typeWidth - count) | *lo >> count | sticky;
diff --git a/lib/builtins/fp_mul_impl.inc b/lib/builtins/fp_mul_impl.inc
index ca8a0bb98..b34aa1b8f 100644
--- a/lib/builtins/fp_mul_impl.inc
+++ b/lib/builtins/fp_mul_impl.inc
@@ -14,7 +14,7 @@
#include "fp_lib.h"
-static inline fp_t __mulXf3__(fp_t a, fp_t b) {
+static __inline fp_t __mulXf3__(fp_t a, fp_t b) {
const unsigned int aExponent = toRep(a) >> significandBits & maxExponent;
const unsigned int bExponent = toRep(b) >> significandBits & maxExponent;
const rep_t productSign = (toRep(a) ^ toRep(b)) & signBit;
diff --git a/lib/builtins/fp_trunc.h b/lib/builtins/fp_trunc.h
index 373ba1b04..d5e79bb5b 100644
--- a/lib/builtins/fp_trunc.h
+++ b/lib/builtins/fp_trunc.h
@@ -63,12 +63,12 @@ static const int dstSigBits = 10;
// End of specialization parameters. Two helper routines for conversion to and
// from the representation of floating-point data as integer values follow.
-static inline src_rep_t srcToRep(src_t x) {
+static __inline src_rep_t srcToRep(src_t x) {
const union { src_t f; src_rep_t i; } rep = {.f = x};
return rep.i;
}
-static inline dst_t dstFromRep(dst_rep_t x) {
+static __inline dst_t dstFromRep(dst_rep_t x) {
const union { dst_t f; dst_rep_t i; } rep = {.i = x};
return rep.f;
}
diff --git a/lib/builtins/fp_trunc_impl.inc b/lib/builtins/fp_trunc_impl.inc
index 372e8d601..d88ae0609 100644
--- a/lib/builtins/fp_trunc_impl.inc
+++ b/lib/builtins/fp_trunc_impl.inc
@@ -39,7 +39,7 @@
#include "fp_trunc.h"
-static inline dst_t __truncXfYf2__(src_t a) {
+static __inline dst_t __truncXfYf2__(src_t a) {
// Various constants whose values follow from the type parameters.
// Any reasonable optimizer will fold and propagate all of these.
const int srcBits = sizeof(src_t)*CHAR_BIT;
diff --git a/lib/builtins/int_types.h b/lib/builtins/int_types.h
index f89c593f0..ba1f7522a 100644
--- a/lib/builtins/int_types.h
+++ b/lib/builtins/int_types.h
@@ -95,14 +95,14 @@ typedef union
}s;
} utwords;
-static inline ti_int make_ti(di_int h, di_int l) {
+static __inline ti_int make_ti(di_int h, di_int l) {
twords r;
r.s.high = h;
r.s.low = l;
return r.all;
}
-static inline tu_int make_tu(du_int h, du_int l) {
+static __inline tu_int make_tu(du_int h, du_int l) {
utwords r;
r.s.high = h;
r.s.low = l;
diff --git a/lib/builtins/ppc/DD.h b/lib/builtins/ppc/DD.h
index fc3e41cbe..b5d6a1248 100644
--- a/lib/builtins/ppc/DD.h
+++ b/lib/builtins/ppc/DD.h
@@ -19,28 +19,23 @@ typedef union {
#define LOWORDER(xy,xHi,xLo,yHi,yLo) \
(((((xHi)*(yHi) - (xy)) + (xHi)*(yLo)) + (xLo)*(yHi)) + (xLo)*(yLo))
-static inline double __attribute__((always_inline))
-local_fabs(double x)
-{
- doublebits result = { .d = x };
- result.x &= UINT64_C(0x7fffffffffffffff);
- return result.d;
+static __inline double __attribute__((always_inline)) local_fabs(double x) {
+ doublebits result = {.d = x};
+ result.x &= UINT64_C(0x7fffffffffffffff);
+ return result.d;
}
-static inline double __attribute__((always_inline))
-high26bits(double x)
-{
- doublebits result = { .d = x };
- result.x &= UINT64_C(0xfffffffff8000000);
- return result.d;
+static __inline double __attribute__((always_inline)) high26bits(double x) {
+ doublebits result = {.d = x};
+ result.x &= UINT64_C(0xfffffffff8000000);
+ return result.d;
}
-static inline int __attribute__((always_inline))
-different_sign(double x, double y)
-{
- doublebits xsignbit = { .d = x }, ysignbit = { .d = y };
- int result = (int)(xsignbit.x >> 63) ^ (int)(ysignbit.x >> 63);
- return result;
+static __inline int __attribute__((always_inline))
+different_sign(double x, double y) {
+ doublebits xsignbit = {.d = x}, ysignbit = {.d = y};
+ int result = (int)(xsignbit.x >> 63) ^ (int)(ysignbit.x >> 63);
+ return result;
}
#endif /* __DD_HEADER */