Update functions in clang supplied headers to use the compiler reserved

namespace for arguments.

llvm-svn: 260647
This commit is contained in:
Eric Christopher 2016-02-12 02:22:53 +00:00
parent 16f7bcb661
commit 39a84d0b9b
7 changed files with 280 additions and 262 deletions

View File

@ -34,146 +34,160 @@
#define __DEVICE__ static __device__ __inline__ __attribute__((always_inline))
namespace std {
__DEVICE__ long long abs(long long n) { return ::llabs(n); }
__DEVICE__ long abs(long n) { return ::labs(n); }
__DEVICE__ long long abs(long long __n) { return ::llabs(__n); }
__DEVICE__ long abs(long __n) { return ::labs(__n); }
using ::abs;
__DEVICE__ float abs(float x) { return ::fabsf(x); }
__DEVICE__ double abs(double x) { return ::fabs(x); }
__DEVICE__ float acos(float x) { return ::acosf(x); }
__DEVICE__ float abs(float __x) { return ::fabsf(__x); }
__DEVICE__ double abs(double __x) { return ::fabs(__x); }
__DEVICE__ float acos(float __x) { return ::acosf(__x); }
using ::acos;
using ::acosh;
__DEVICE__ float asin(float x) { return ::asinf(x); }
__DEVICE__ float asin(float __x) { return ::asinf(__x); }
using ::asin;
using ::asinh;
__DEVICE__ float atan(float x) { return ::atanf(x); }
__DEVICE__ float atan(float __x) { return ::atanf(__x); }
using ::atan;
__DEVICE__ float atan2(float x, float y) { return ::atan2f(x, y); }
__DEVICE__ float atan2(float __x, float __y) { return ::atan2f(__x, __y); }
using ::atan2;
using ::atanh;
using ::cbrt;
__DEVICE__ float ceil(float x) { return ::ceilf(x); }
__DEVICE__ float ceil(float __x) { return ::ceilf(__x); }
using ::ceil;
using ::copysign;
__DEVICE__ float cos(float x) { return ::cosf(x); }
__DEVICE__ float cos(float __x) { return ::cosf(__x); }
using ::cos;
__DEVICE__ float cosh(float x) { return ::coshf(x); }
__DEVICE__ float cosh(float __x) { return ::coshf(__x); }
using ::cosh;
using ::erf;
using ::erfc;
__DEVICE__ float exp(float x) { return ::expf(x); }
__DEVICE__ float exp(float __x) { return ::expf(__x); }
using ::exp;
using ::exp2;
using ::expm1;
__DEVICE__ float fabs(float x) { return ::fabsf(x); }
__DEVICE__ float fabs(float __x) { return ::fabsf(__x); }
using ::fabs;
using ::fdim;
__DEVICE__ float floor(float x) { return ::floorf(x); }
__DEVICE__ float floor(float __x) { return ::floorf(__x); }
using ::floor;
using ::fma;
using ::fmax;
using ::fmin;
__DEVICE__ float fmod(float x, float y) { return ::fmodf(x, y); }
__DEVICE__ float fmod(float __x, float __y) { return ::fmodf(__x, __y); }
using ::fmod;
__DEVICE__ int fpclassify(float x) {
__DEVICE__ int fpclassify(float __x) {
return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
FP_ZERO, x);
FP_ZERO, __x);
}
__DEVICE__ int fpclassify(double x) {
__DEVICE__ int fpclassify(double __x) {
return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
FP_ZERO, x);
FP_ZERO, __x);
}
__DEVICE__ float frexp(float __arg, int *__exp) {
return ::frexpf(__arg, __exp);
}
__DEVICE__ float frexp(float arg, int *exp) { return ::frexpf(arg, exp); }
using ::frexp;
using ::hypot;
using ::ilogb;
__DEVICE__ bool isfinite(float x) { return ::__finitef(x); }
__DEVICE__ bool isfinite(double x) { return ::__finite(x); }
__DEVICE__ bool isgreater(float x, float y) {
return __builtin_isgreater(x, y);
__DEVICE__ bool isfinite(float __x) { return ::__finitef(__x); }
__DEVICE__ bool isfinite(double __x) { return ::__finite(__x); }
__DEVICE__ bool isgreater(float __x, float __y) {
return __builtin_isgreater(__x, __y);
}
__DEVICE__ bool isgreater(double x, double y) {
return __builtin_isgreater(x, y);
__DEVICE__ bool isgreater(double __x, double __y) {
return __builtin_isgreater(__x, __y);
}
__DEVICE__ bool isgreaterequal(float x, float y) {
return __builtin_isgreaterequal(x, y);
__DEVICE__ bool isgreaterequal(float __x, float __y) {
return __builtin_isgreaterequal(__x, __y);
}
__DEVICE__ bool isgreaterequal(double x, double y) {
return __builtin_isgreaterequal(x, y);
__DEVICE__ bool isgreaterequal(double __x, double __y) {
return __builtin_isgreaterequal(__x, __y);
}
__DEVICE__ bool isinf(float x) { return ::__isinff(x); }
__DEVICE__ bool isinf(double x) { return ::__isinf(x); }
__DEVICE__ bool isless(float x, float y) { return __builtin_isless(x, y); }
__DEVICE__ bool isless(double x, double y) { return __builtin_isless(x, y); }
__DEVICE__ bool islessequal(float x, float y) {
return __builtin_islessequal(x, y);
__DEVICE__ bool isinf(float __x) { return ::__isinff(__x); }
__DEVICE__ bool isinf(double __x) { return ::__isinf(__x); }
__DEVICE__ bool isless(float __x, float __y) {
return __builtin_isless(__x, __y);
}
__DEVICE__ bool islessequal(double x, double y) {
return __builtin_islessequal(x, y);
__DEVICE__ bool isless(double __x, double __y) {
return __builtin_isless(__x, __y);
}
__DEVICE__ bool islessgreater(float x, float y) {
return __builtin_islessgreater(x, y);
__DEVICE__ bool islessequal(float __x, float __y) {
return __builtin_islessequal(__x, __y);
}
__DEVICE__ bool islessgreater(double x, double y) {
return __builtin_islessgreater(x, y);
__DEVICE__ bool islessequal(double __x, double __y) {
return __builtin_islessequal(__x, __y);
}
__DEVICE__ bool isnan(float x) { return ::__isnanf(x); }
__DEVICE__ bool isnan(double x) { return ::__isnan(x); }
__DEVICE__ bool isnormal(float x) { return __builtin_isnormal(x); }
__DEVICE__ bool isnormal(double x) { return __builtin_isnormal(x); }
__DEVICE__ bool isunordered(float x, float y) {
return __builtin_isunordered(x, y);
__DEVICE__ bool islessgreater(float __x, float __y) {
return __builtin_islessgreater(__x, __y);
}
__DEVICE__ bool isunordered(double x, double y) {
return __builtin_isunordered(x, y);
__DEVICE__ bool islessgreater(double __x, double __y) {
return __builtin_islessgreater(__x, __y);
}
__DEVICE__ bool isnan(float __x) { return ::__isnanf(__x); }
__DEVICE__ bool isnan(double __x) { return ::__isnan(__x); }
__DEVICE__ bool isnormal(float __x) { return __builtin_isnormal(__x); }
__DEVICE__ bool isnormal(double __x) { return __builtin_isnormal(__x); }
__DEVICE__ bool isunordered(float __x, float __y) {
return __builtin_isunordered(__x, __y);
}
__DEVICE__ bool isunordered(double __x, double __y) {
return __builtin_isunordered(__x, __y);
}
using ::labs;
__DEVICE__ float ldexp(float arg, int exp) { return ::ldexpf(arg, exp); }
__DEVICE__ float ldexp(float __arg, int __exp) {
return ::ldexpf(__arg, __exp);
}
using ::ldexp;
using ::lgamma;
using ::llabs;
using ::llrint;
__DEVICE__ float log(float x) { return ::logf(x); }
__DEVICE__ float log(float __x) { return ::logf(__x); }
using ::log;
__DEVICE__ float log10(float x) { return ::log10f(x); }
__DEVICE__ float log10(float __x) { return ::log10f(__x); }
using ::log10;
using ::log1p;
using ::log2;
using ::logb;
using ::lrint;
using ::lround;
__DEVICE__ float modf(float x, float *iptr) { return ::modff(x, iptr); }
__DEVICE__ float modf(float __x, float *__iptr) { return ::modff(__x, __iptr); }
using ::modf;
using ::nan;
using ::nanf;
using ::nearbyint;
using ::nextafter;
__DEVICE__ float nexttoward(float from, float to) {
__DEVICE__ float nexttoward(float __from, float __to) {
return __builtin_nexttowardf(from, to);
}
__DEVICE__ double nexttoward(double from, double to) {
return __builtin_nexttoward(from, to);
__DEVICE__ double nexttoward(double __from, double __to) {
return __builtin_nexttoward(__from, __to);
}
using ::pow;
__DEVICE__ float pow(float base, float exp) { return ::powf(base, exp); }
__DEVICE__ float pow(float base, int iexp) { return ::powif(base, iexp); }
__DEVICE__ double pow(double base, int iexp) { return ::powi(base, iexp); }
__DEVICE__ float pow(float __base, float __exp) {
return ::powf(__base, __exp);
}
__DEVICE__ float pow(float __base, int __iexp) {
return ::powif(__base, __iexp);
}
__DEVICE__ double pow(double __base, int __iexp) {
return ::powi(__base, __iexp);
}
using ::remainder;
using ::remquo;
using ::rint;
using ::round;
using ::scalbln;
using ::scalbn;
__DEVICE__ bool signbit(float x) { return ::__signbitf(x); }
__DEVICE__ bool signbit(double x) { return ::__signbit(x); }
__DEVICE__ float sin(float x) { return ::sinf(x); }
__DEVICE__ bool signbit(float __x) { return ::__signbitf(__x); }
__DEVICE__ bool signbit(double __x) { return ::__signbit(__x); }
__DEVICE__ float sin(float __x) { return ::sinf(__x); }
using ::sin;
__DEVICE__ float sinh(float x) { return ::sinhf(x); }
__DEVICE__ float sinh(float __x) { return ::sinhf(__x); }
using ::sinh;
__DEVICE__ float sqrt(float x) { return ::sqrtf(x); }
__DEVICE__ float sqrt(float __x) { return ::sqrtf(__x); }
using ::sqrt;
__DEVICE__ float tan(float x) { return ::tanf(x); }
__DEVICE__ float tan(float __x) { return ::tanf(__x); }
using ::tan;
__DEVICE__ float tanh(float x) { return ::tanhf(x); }
__DEVICE__ float tanh(float __x) { return ::tanhf(__x); }
using ::tanh;
using ::tgamma;
using ::trunc;

View File

@ -44,9 +44,9 @@
// Include some standard headers to avoid CUDA headers including them
// while some required macros (like __THROW) are in a weird state.
#include <stdlib.h>
#include <cmath>
#include <cstdlib>
#include <stdlib.h>
// Preserve common macros that will be changed below by us or by CUDA
// headers.
@ -86,9 +86,9 @@
#define __CUDABE__
// Disables definitions of device-side runtime support stubs in
// cuda_device_runtime_api.h
#include "driver_types.h"
#include "host_config.h"
#include "host_defines.h"
#include "driver_types.h"
#undef __CUDABE__
#define __CUDACC__
@ -99,11 +99,11 @@
// CUDA headers use __nvvm_memcpy and __nvvm_memset which Clang does
// not have at the moment. Emulate them with a builtin memcpy/memset.
#define __nvvm_memcpy(s,d,n,a) __builtin_memcpy(s,d,n)
#define __nvvm_memset(d,c,n,a) __builtin_memset(d,c,n)
#define __nvvm_memcpy(s, d, n, a) __builtin_memcpy(s, d, n)
#define __nvvm_memset(d, c, n, a) __builtin_memset(d, c, n)
#include "crt/host_runtime.h"
#include "crt/device_runtime.h"
#include "crt/host_runtime.h"
// device_runtime.h defines __cxa_* macros that will conflict with
// cxxabi.h.
// FIXME: redefine these as __device__ functions.
@ -151,21 +151,21 @@
// Alas, additional overloads for these functions are hard to get to.
// Considering that we only need these overloads for a few functions,
// we can provide them here.
static inline float rsqrt(float a) { return rsqrtf(a); }
static inline float rcbrt(float a) { return rcbrtf(a); }
static inline float sinpi(float a) { return sinpif(a); }
static inline float cospi(float a) { return cospif(a); }
static inline void sincospi(float a, float *b, float *c) {
return sincospif(a, b, c);
static inline float rsqrt(float __a) { return rsqrtf(__a); }
static inline float rcbrt(float __a) { return rcbrtf(__a); }
static inline float sinpi(float __a) { return sinpif(__a); }
static inline float cospi(float __a) { return cospif(__a); }
static inline void sincospi(float __a, float *__b, float *__c) {
return sincospif(__a, __b, __c);
}
static inline float erfcinv(float a) { return erfcinvf(a); }
static inline float normcdfinv(float a) { return normcdfinvf(a); }
static inline float normcdf(float a) { return normcdff(a); }
static inline float erfcx(float a) { return erfcxf(a); }
static inline float erfcinv(float __a) { return erfcinvf(__a); }
static inline float normcdfinv(float __a) { return normcdfinvf(__a); }
static inline float normcdf(float __a) { return normcdff(__a); }
static inline float erfcx(float __a) { return erfcxf(__a); }
// For some reason single-argument variant is not always declared by
// CUDA headers. Alas, device_functions.hpp included below needs it.
static inline __device__ void __brkpt(int c) { __brkpt(); }
static inline __device__ void __brkpt(int __c) { __brkpt(); }
// Now include *.hpp with definitions of various GPU functions. Alas,
// a lot of thins get declared/defined with __host__ attribute which
@ -177,11 +177,11 @@ static inline __device__ void __brkpt(int c) { __brkpt(); }
#undef __CUDABE__
#define __CUDACC__
#undef __DEVICE_FUNCTIONS_HPP__
#include "device_functions.hpp"
#include "device_atomic_functions.hpp"
#include "device_functions.hpp"
#include "sm_20_atomic_functions.hpp"
#include "sm_32_atomic_functions.hpp"
#include "sm_20_intrinsics.hpp"
#include "sm_32_atomic_functions.hpp"
// sm_30_intrinsics.h has declarations that use default argument, so
// we have to include it and it will in turn include .hpp
#include "sm_30_intrinsics.h"
@ -217,19 +217,19 @@ extern "C" {
// We need these declarations and wrappers for device-side
// malloc/free/printf calls to work without relying on
// -fcuda-disable-target-call-checks option.
__device__ int vprintf(const char*, const char*);
__device__ int vprintf(const char *, const char *);
__device__ void free(void *) __attribute((nothrow));
__device__ void *malloc(size_t) __attribute((nothrow)) __attribute__((malloc));
__device__ void __assertfail(const char *message, const char *file,
unsigned line, const char *function,
size_t charSize) __attribute__((noreturn));
__device__ void __assertfail(const char *__message, const char *__file,
unsigned __line, const char *__function,
size_t __charSize) __attribute__((noreturn));
// In order for standard assert() macro on linux to work we need to
// provide device-side __assert_fail()
__device__ static inline void __assert_fail(const char *message,
const char *file, unsigned line,
const char *function) {
__assertfail(message, file, line, function, sizeof(char));
__device__ static inline void __assert_fail(const char *__message,
const char *__file, unsigned __line,
const char *__function) {
__assertfail(__message, __file, __line, __function, sizeof(char));
}
// Clang will convert printf into vprintf, but we still need

View File

@ -72,9 +72,11 @@ static __inline__ void __attribute__((__always_inline__, __nodebug__)) __yield(v
/* 8.5 Swap */
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__swp(uint32_t x, volatile uint32_t *p) {
__swp(uint32_t __x, volatile uint32_t *__p) {
uint32_t v;
do v = __builtin_arm_ldrex(p); while (__builtin_arm_strex(x, p));
do
v = __builtin_arm_ldrex(__p);
while (__builtin_arm_strex(__x, __p));
return v;
}
@ -110,113 +112,115 @@ static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(voi
/* 9.2 Miscellaneous data-processing intrinsics */
/* ROR */
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__ror(uint32_t x, uint32_t y) {
y %= 32;
if (y == 0) return x;
return (x >> y) | (x << (32 - y));
__ror(uint32_t __x, uint32_t __y) {
__y %= 32;
if (__y == 0)
return __x;
return (__x >> __y) | (__x << (32 - __y));
}
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
__rorll(uint64_t x, uint32_t y) {
y %= 64;
if (y == 0) return x;
return (x >> y) | (x << (64 - y));
__rorll(uint64_t __x, uint32_t __y) {
__y %= 64;
if (__y == 0)
return __x;
return (__x >> __y) | (__x << (64 - __y));
}
static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
__rorl(unsigned long x, uint32_t y) {
__rorl(unsigned long __x, uint32_t __y) {
#if __SIZEOF_LONG__ == 4
return __ror(x, y);
return __ror(__x, __y);
#else
return __rorll(x, y);
return __rorll(__x, __y);
#endif
}
/* CLZ */
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__clz(uint32_t t) {
return __builtin_clz(t);
__clz(uint32_t __t) {
return __builtin_clz(__t);
}
static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
__clzl(unsigned long t) {
return __builtin_clzl(t);
__clzl(unsigned long __t) {
return __builtin_clzl(__t);
}
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
__clzll(uint64_t t) {
return __builtin_clzll(t);
__clzll(uint64_t __t) {
return __builtin_clzll(__t);
}
/* REV */
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__rev(uint32_t t) {
return __builtin_bswap32(t);
__rev(uint32_t __t) {
return __builtin_bswap32(__t);
}
static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
__revl(unsigned long t) {
__revl(unsigned long __t) {
#if __SIZEOF_LONG__ == 4
return __builtin_bswap32(t);
return __builtin_bswap32(__t);
#else
return __builtin_bswap64(t);
return __builtin_bswap64(__t);
#endif
}
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
__revll(uint64_t t) {
return __builtin_bswap64(t);
__revll(uint64_t __t) {
return __builtin_bswap64(__t);
}
/* REV16 */
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__rev16(uint32_t t) {
return __ror(__rev(t), 16);
__rev16(uint32_t __t) {
return __ror(__rev(__t), 16);
}
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
__rev16ll(uint64_t t) {
return (((uint64_t)__rev16(t >> 32)) << 32) | __rev16(t);
__rev16ll(uint64_t __t) {
return (((uint64_t)__rev16(__t >> 32)) << 32) | __rev16(__t);
}
static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
__rev16l(unsigned long t) {
__rev16l(unsigned long __t) {
#if __SIZEOF_LONG__ == 4
return __rev16(t);
return __rev16(__t);
#else
return __rev16ll(t);
return __rev16ll(__t);
#endif
}
/* REVSH */
static __inline__ int16_t __attribute__((__always_inline__, __nodebug__))
__revsh(int16_t t) {
return __builtin_bswap16(t);
__revsh(int16_t __t) {
return __builtin_bswap16(__t);
}
/* RBIT */
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__rbit(uint32_t t) {
return __builtin_arm_rbit(t);
__rbit(uint32_t __t) {
return __builtin_arm_rbit(__t);
}
static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
__rbitll(uint64_t t) {
__rbitll(uint64_t __t) {
#if __ARM_32BIT_STATE
return (((uint64_t) __builtin_arm_rbit(t)) << 32) |
__builtin_arm_rbit(t >> 32);
return (((uint64_t)__builtin_arm_rbit(__t)) << 32) |
__builtin_arm_rbit(__t >> 32);
#else
return __builtin_arm_rbit64(t);
return __builtin_arm_rbit64(__t);
#endif
}
static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
__rbitl(unsigned long t) {
__rbitl(unsigned long __t) {
#if __SIZEOF_LONG__ == 4
return __rbit(t);
return __rbit(__t);
#else
return __rbitll(t);
return __rbitll(__t);
#endif
}
@ -235,61 +239,61 @@ static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
/* 9.4.2 Saturating addition and subtraction intrinsics */
#if __ARM_32BIT_STATE
static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__qadd(int32_t t, int32_t v) {
return __builtin_arm_qadd(t, v);
__qadd(int32_t __t, int32_t __v) {
return __builtin_arm_qadd(__t, __v);
}
static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__qsub(int32_t t, int32_t v) {
return __builtin_arm_qsub(t, v);
__qsub(int32_t __t, int32_t __v) {
return __builtin_arm_qsub(__t, __v);
}
static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
__qdbl(int32_t t) {
return __builtin_arm_qadd(t, t);
__qdbl(int32_t __t) {
return __builtin_arm_qadd(__t, __t);
}
#endif
/* 9.7 CRC32 intrinsics */
#if __ARM_FEATURE_CRC32
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__crc32b(uint32_t a, uint8_t b) {
return __builtin_arm_crc32b(a, b);
__crc32b(uint32_t __a, uint8_t __b) {
return __builtin_arm_crc32b(__a, __b);
}
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__crc32h(uint32_t a, uint16_t b) {
return __builtin_arm_crc32h(a, b);
__crc32h(uint32_t __a, uint16_t __b) {
return __builtin_arm_crc32h(__a, __b);
}
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__crc32w(uint32_t a, uint32_t b) {
return __builtin_arm_crc32w(a, b);
__crc32w(uint32_t __a, uint32_t __b) {
return __builtin_arm_crc32w(__a, __b);
}
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__crc32d(uint32_t a, uint64_t b) {
return __builtin_arm_crc32d(a, b);
__crc32d(uint32_t __a, uint64_t __b) {
return __builtin_arm_crc32d(__a, __b);
}
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__crc32cb(uint32_t a, uint8_t b) {
return __builtin_arm_crc32cb(a, b);
__crc32cb(uint32_t __a, uint8_t __b) {
return __builtin_arm_crc32cb(__a, __b);
}
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__crc32ch(uint32_t a, uint16_t b) {
return __builtin_arm_crc32ch(a, b);
__crc32ch(uint32_t __a, uint16_t __b) {
return __builtin_arm_crc32ch(__a, __b);
}
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__crc32cw(uint32_t a, uint32_t b) {
return __builtin_arm_crc32cw(a, b);
__crc32cw(uint32_t __a, uint32_t __b) {
return __builtin_arm_crc32cw(__a, __b);
}
static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
__crc32cd(uint32_t a, uint64_t b) {
return __builtin_arm_crc32cd(a, b);
__crc32cd(uint32_t __a, uint64_t __b) {
return __builtin_arm_crc32cd(__a, __b);
}
#endif

View File

@ -164,24 +164,24 @@ struct __htm_tdb {
/* Helper intrinsics to retry tbegin in case of transient failure. */
static __inline int __attribute__((__always_inline__, __nodebug__))
__builtin_tbegin_retry_null (int retry)
__builtin_tbegin_retry_null (int __retry)
{
int cc, i = 0;
while ((cc = __builtin_tbegin(0)) == _HTM_TBEGIN_TRANSIENT
&& i++ < retry)
&& i++ < __retry)
__builtin_tx_assist(i);
return cc;
}
static __inline int __attribute__((__always_inline__, __nodebug__))
__builtin_tbegin_retry_tdb (void *tdb, int retry)
__builtin_tbegin_retry_tdb (void *__tdb, int __retry)
{
int cc, i = 0;
while ((cc = __builtin_tbegin(tdb)) == _HTM_TBEGIN_TRANSIENT
&& i++ < retry)
while ((cc = __builtin_tbegin(__tdb)) == _HTM_TBEGIN_TRANSIENT
&& i++ < __retry)
__builtin_tx_assist(i);
return cc;
@ -193,24 +193,24 @@ __builtin_tbegin_retry_tdb (void *tdb, int retry)
__builtin_tbegin_retry_tdb(tdb, retry))
static __inline int __attribute__((__always_inline__, __nodebug__))
__builtin_tbegin_retry_nofloat_null (int retry)
__builtin_tbegin_retry_nofloat_null (int __retry)
{
int cc, i = 0;
while ((cc = __builtin_tbegin_nofloat(0)) == _HTM_TBEGIN_TRANSIENT
&& i++ < retry)
&& i++ < __retry)
__builtin_tx_assist(i);
return cc;
}
static __inline int __attribute__((__always_inline__, __nodebug__))
__builtin_tbegin_retry_nofloat_tdb (void *tdb, int retry)
__builtin_tbegin_retry_nofloat_tdb (void *__tdb, int __retry)
{
int cc, i = 0;
while ((cc = __builtin_tbegin_nofloat(tdb)) == _HTM_TBEGIN_TRANSIENT
&& i++ < retry)
while ((cc = __builtin_tbegin_nofloat(__tdb)) == _HTM_TBEGIN_TRANSIENT
&& i++ < __retry)
__builtin_tx_assist(i);
return cc;

View File

@ -62,18 +62,18 @@ __TM_simple_begin (void)
extern __inline long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_begin (void* const TM_buff)
__TM_begin (void* const __TM_buff)
{
*_TEXASRL_PTR (TM_buff) = 0;
*_TEXASRL_PTR (__TM_buff) = 0;
if (__builtin_expect (__builtin_tbegin (0), 1))
return _HTM_TBEGIN_STARTED;
#ifdef __powerpc64__
*_TEXASR_PTR (TM_buff) = __builtin_get_texasr ();
*_TEXASR_PTR (__TM_buff) = __builtin_get_texasr ();
#else
*_TEXASRU_PTR (TM_buff) = __builtin_get_texasru ();
*_TEXASRL_PTR (TM_buff) = __builtin_get_texasr ();
*_TEXASRU_PTR (__TM_buff) = __builtin_get_texasru ();
*_TEXASRL_PTR (__TM_buff) = __builtin_get_texasr ();
#endif
*_TFIAR_PTR (TM_buff) = __builtin_get_tfiar ();
*_TFIAR_PTR (__TM_buff) = __builtin_get_tfiar ();
return 0;
}
@ -95,9 +95,9 @@ __TM_abort (void)
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_named_abort (unsigned char const code)
__TM_named_abort (unsigned char const __code)
{
__builtin_tabort (code);
__builtin_tabort (__code);
}
extern __inline void
@ -116,47 +116,47 @@ __TM_suspend (void)
extern __inline long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_user_abort (void* const TM_buff)
__TM_is_user_abort (void* const __TM_buff)
{
texasru_t texasru = *_TEXASRU_PTR (TM_buff);
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
return _TEXASRU_ABORT (texasru);
}
extern __inline long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_named_user_abort (void* const TM_buff, unsigned char *code)
__TM_is_named_user_abort (void* const __TM_buff, unsigned char *__code)
{
texasru_t texasru = *_TEXASRU_PTR (TM_buff);
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
*code = _TEXASRU_FAILURE_CODE (texasru);
*__code = _TEXASRU_FAILURE_CODE (texasru);
return _TEXASRU_ABORT (texasru);
}
extern __inline long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_illegal (void* const TM_buff)
__TM_is_illegal (void* const __TM_buff)
{
texasru_t texasru = *_TEXASRU_PTR (TM_buff);
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
return _TEXASRU_DISALLOWED (texasru);
}
extern __inline long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_footprint_exceeded (void* const TM_buff)
__TM_is_footprint_exceeded (void* const __TM_buff)
{
texasru_t texasru = *_TEXASRU_PTR (TM_buff);
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
return _TEXASRU_FOOTPRINT_OVERFLOW (texasru);
}
extern __inline long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_nesting_depth (void* const TM_buff)
__TM_nesting_depth (void* const __TM_buff)
{
texasrl_t texasrl;
if (_HTM_STATE (__builtin_ttest ()) == _HTM_NONTRANSACTIONAL)
{
texasrl = *_TEXASRL_PTR (TM_buff);
texasrl = *_TEXASRL_PTR (__TM_buff);
if (!_TEXASR_FAILURE_SUMMARY (texasrl))
texasrl = 0;
}
@ -168,15 +168,15 @@ __TM_nesting_depth (void* const TM_buff)
extern __inline long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_nested_too_deep(void* const TM_buff)
__TM_is_nested_too_deep(void* const __TM_buff)
{
texasru_t texasru = *_TEXASRU_PTR (TM_buff);
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
return _TEXASRU_NESTING_OVERFLOW (texasru);
}
extern __inline long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_conflict(void* const TM_buff)
__TM_is_conflict(void* const __TM_buff)
{
texasru_t texasru = *_TEXASRU_PTR (TM_buff);
/* Return TEXASR bits 11 (Self-Induced Conflict) through
@ -186,24 +186,24 @@ __TM_is_conflict(void* const TM_buff)
extern __inline long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_is_failure_persistent(void* const TM_buff)
__TM_is_failure_persistent(void* const __TM_buff)
{
texasru_t texasru = *_TEXASRU_PTR (TM_buff);
texasru_t texasru = *_TEXASRU_PTR (__TM_buff);
return _TEXASRU_FAILURE_PERSISTENT (texasru);
}
extern __inline long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_failure_address(void* const TM_buff)
__TM_failure_address(void* const __TM_buff)
{
return *_TFIAR_PTR (TM_buff);
return *_TFIAR_PTR (__TM_buff);
}
extern __inline long long
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
__TM_failure_code(void* const TM_buff)
__TM_failure_code(void* const __TM_buff)
{
return *_TEXASR_PTR (TM_buff);
return *_TEXASR_PTR (__TM_buff);
}
#ifdef __cplusplus
@ -227,9 +227,9 @@ __TM_simple_begin ()
}
static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_begin (void* const tdb)
__TM_begin (void* const __tdb)
{
return __builtin_tbegin_nofloat (tdb);
return __builtin_tbegin_nofloat (__tdb);
}
static __inline long __attribute__((__always_inline__, __nodebug__))
@ -245,22 +245,22 @@ __TM_abort ()
}
static __inline void __attribute__((__always_inline__, __nodebug__))
__TM_named_abort (unsigned char const code)
__TM_named_abort (unsigned char const __code)
{
return __builtin_tabort ((int)_HTM_FIRST_USER_ABORT_CODE + code);
return __builtin_tabort ((int)_HTM_FIRST_USER_ABORT_CODE + __code);
}
static __inline void __attribute__((__always_inline__, __nodebug__))
__TM_non_transactional_store (void* const addr, long long const value)
__TM_non_transactional_store (void* const __addr, long long const __value)
{
__builtin_non_tx_store ((uint64_t*)addr, (uint64_t)value);
__builtin_non_tx_store ((uint64_t*)__addr, (uint64_t)__value);
}
static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_nesting_depth (void* const tdb_ptr)
__TM_nesting_depth (void* const __tdb_ptr)
{
int depth = __builtin_tx_nesting_depth ();
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
if (depth != 0)
return depth;
@ -273,9 +273,9 @@ __TM_nesting_depth (void* const tdb_ptr)
/* Transaction failure diagnostics */
static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_user_abort (void* const tdb_ptr)
__TM_is_user_abort (void* const __tdb_ptr)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
if (tdb->format != 1)
return 0;
@ -284,25 +284,25 @@ __TM_is_user_abort (void* const tdb_ptr)
}
static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_named_user_abort (void* const tdb_ptr, unsigned char* code)
__TM_is_named_user_abort (void* const __tdb_ptr, unsigned char* __code)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
if (tdb->format != 1)
return 0;
if (tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE)
{
*code = tdb->abort_code - _HTM_FIRST_USER_ABORT_CODE;
*__code = tdb->abort_code - _HTM_FIRST_USER_ABORT_CODE;
return 1;
}
return 0;
}
static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_illegal (void* const tdb_ptr)
__TM_is_illegal (void* const __tdb_ptr)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
return (tdb->format == 1
&& (tdb->abort_code == 4 /* unfiltered program interruption */
@ -310,9 +310,9 @@ __TM_is_illegal (void* const tdb_ptr)
}
static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_footprint_exceeded (void* const tdb_ptr)
__TM_is_footprint_exceeded (void* const __tdb_ptr)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
return (tdb->format == 1
&& (tdb->abort_code == 7 /* fetch overflow */
@ -320,17 +320,17 @@ __TM_is_footprint_exceeded (void* const tdb_ptr)
}
static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_nested_too_deep (void* const tdb_ptr)
__TM_is_nested_too_deep (void* const __tdb_ptr)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
return tdb->format == 1 && tdb->abort_code == 13; /* depth exceeded */
}
static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_conflict (void* const tdb_ptr)
__TM_is_conflict (void* const __tdb_ptr)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
return (tdb->format == 1
&& (tdb->abort_code == 9 /* fetch conflict */
@ -338,22 +338,22 @@ __TM_is_conflict (void* const tdb_ptr)
}
static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_is_failure_persistent (long const result)
__TM_is_failure_persistent (long const __result)
{
return result == _HTM_TBEGIN_PERSISTENT;
return __result == _HTM_TBEGIN_PERSISTENT;
}
static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_failure_address (void* const tdb_ptr)
__TM_failure_address (void* const __tdb_ptr)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
return tdb->atia;
}
static __inline long __attribute__((__always_inline__, __nodebug__))
__TM_failure_code (void* const tdb_ptr)
__TM_failure_code (void* const __tdb_ptr)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
struct __htm_tdb *tdb = (struct __htm_tdb*)__tdb_ptr;
return tdb->abort_code;
}

View File

@ -38,9 +38,9 @@ _rdpkru_u32(void)
}
static __inline__ void __DEFAULT_FN_ATTRS
_wrpkru(unsigned int val)
_wrpkru(unsigned int __val)
{
return __builtin_ia32_wrpkru(val);
return __builtin_ia32_wrpkru(__val);
}
#undef __DEFAULT_FN_ATTRS

View File

@ -36,57 +36,57 @@
(unsigned int)(b)))
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blcfill_u32(unsigned int a)
__blcfill_u32(unsigned int __a)
{
return a & (a + 1);
return __a & (__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blci_u32(unsigned int a)
__blci_u32(unsigned int __a)
{
return a | ~(a + 1);
return __a | ~(__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blcic_u32(unsigned int a)
__blcic_u32(unsigned int __a)
{
return ~a & (a + 1);
return ~__a & (__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blcmsk_u32(unsigned int a)
__blcmsk_u32(unsigned int __a)
{
return a ^ (a + 1);
return __a ^ (__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blcs_u32(unsigned int a)
__blcs_u32(unsigned int __a)
{
return a | (a + 1);
return __a | (__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blsfill_u32(unsigned int a)
__blsfill_u32(unsigned int __a)
{
return a | (a - 1);
return __a | (__a - 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__blsic_u32(unsigned int a)
__blsic_u32(unsigned int __a)
{
return ~a | (a - 1);
return ~__a | (__a - 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__t1mskc_u32(unsigned int a)
__t1mskc_u32(unsigned int __a)
{
return ~a | (a + 1);
return ~__a | (__a + 1);
}
static __inline__ unsigned int __DEFAULT_FN_ATTRS
__tzmsk_u32(unsigned int a)
__tzmsk_u32(unsigned int __a)
{
return ~a & (a - 1);
return ~__a & (__a - 1);
}
#ifdef __x86_64__
@ -95,57 +95,57 @@ __tzmsk_u32(unsigned int a)
(unsigned long long)(b)))
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blcfill_u64(unsigned long long a)
__blcfill_u64(unsigned long long __a)
{
return a & (a + 1);
return __a & (__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blci_u64(unsigned long long a)
__blci_u64(unsigned long long __a)
{
return a | ~(a + 1);
return __a | ~(__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blcic_u64(unsigned long long a)
__blcic_u64(unsigned long long __a)
{
return ~a & (a + 1);
return ~__a & (__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blcmsk_u64(unsigned long long a)
__blcmsk_u64(unsigned long long __a)
{
return a ^ (a + 1);
return __a ^ (__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blcs_u64(unsigned long long a)
__blcs_u64(unsigned long long __a)
{
return a | (a + 1);
return __a | (__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blsfill_u64(unsigned long long a)
__blsfill_u64(unsigned long long __a)
{
return a | (a - 1);
return __a | (__a - 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__blsic_u64(unsigned long long a)
__blsic_u64(unsigned long long __a)
{
return ~a | (a - 1);
return ~__a | (__a - 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__t1mskc_u64(unsigned long long a)
__t1mskc_u64(unsigned long long __a)
{
return ~a | (a + 1);
return ~__a | (__a + 1);
}
static __inline__ unsigned long long __DEFAULT_FN_ATTRS
__tzmsk_u64(unsigned long long a)
__tzmsk_u64(unsigned long long __a)
{
return ~a & (a - 1);
return ~__a & (__a - 1);
}
#endif