Merge "chore(compiler-rt): update compiler-rt source files" into integration

This commit is contained in:
Manish Pandey 2024-05-10 11:26:59 +02:00 committed by TrustedFirmware Code Review
commit 73360b4308
3 changed files with 17 additions and 14 deletions

View file

@ -260,9 +260,10 @@
.globl name SEPARATOR \ .globl name SEPARATOR \
SYMBOL_IS_FUNC(name) SEPARATOR \ SYMBOL_IS_FUNC(name) SEPARATOR \
DECLARE_SYMBOL_VISIBILITY_UNMANGLED(name) SEPARATOR \ DECLARE_SYMBOL_VISIBILITY_UNMANGLED(name) SEPARATOR \
CFI_START SEPARATOR \
DECLARE_FUNC_ENCODING \ DECLARE_FUNC_ENCODING \
name: SEPARATOR BTI_C name: \
SEPARATOR CFI_START \
SEPARATOR BTI_C
#define DEFINE_COMPILERRT_FUNCTION_ALIAS(name, target) \ #define DEFINE_COMPILERRT_FUNCTION_ALIAS(name, target) \
.globl SYMBOL_NAME(name) SEPARATOR \ .globl SYMBOL_NAME(name) SEPARATOR \

View file

@ -119,14 +119,14 @@ COMPILER_RT_ABI tu_int __udivmodti4(tu_int a, tu_int b, tu_int *rem);
#if defined(_MSC_VER) && !defined(__clang__) #if defined(_MSC_VER) && !defined(__clang__)
#include <intrin.h> #include <intrin.h>
int __inline __builtin_ctz(uint32_t value) { static int __inline __builtin_ctz(uint32_t value) {
unsigned long trailing_zero = 0; unsigned long trailing_zero = 0;
if (_BitScanForward(&trailing_zero, value)) if (_BitScanForward(&trailing_zero, value))
return trailing_zero; return trailing_zero;
return 32; return 32;
} }
int __inline __builtin_clz(uint32_t value) { static int __inline __builtin_clz(uint32_t value) {
unsigned long leading_zero = 0; unsigned long leading_zero = 0;
if (_BitScanReverse(&leading_zero, value)) if (_BitScanReverse(&leading_zero, value))
return 31 - leading_zero; return 31 - leading_zero;
@ -134,14 +134,14 @@ int __inline __builtin_clz(uint32_t value) {
} }
#if defined(_M_ARM) || defined(_M_X64) #if defined(_M_ARM) || defined(_M_X64)
int __inline __builtin_clzll(uint64_t value) { static int __inline __builtin_clzll(uint64_t value) {
unsigned long leading_zero = 0; unsigned long leading_zero = 0;
if (_BitScanReverse64(&leading_zero, value)) if (_BitScanReverse64(&leading_zero, value))
return 63 - leading_zero; return 63 - leading_zero;
return 64; return 64;
} }
#else #else
int __inline __builtin_clzll(uint64_t value) { static int __inline __builtin_clzll(uint64_t value) {
if (value == 0) if (value == 0)
return 64; return 64;
uint32_t msh = (uint32_t)(value >> 32); uint32_t msh = (uint32_t)(value >> 32);
@ -154,7 +154,7 @@ int __inline __builtin_clzll(uint64_t value) {
#define __builtin_clzl __builtin_clzll #define __builtin_clzl __builtin_clzll
bool __inline __builtin_sadd_overflow(int x, int y, int *result) { static bool __inline __builtin_sadd_overflow(int x, int y, int *result) {
if ((x < 0) != (y < 0)) { if ((x < 0) != (y < 0)) {
*result = x + y; *result = x + y;
return false; return false;

View file

@ -107,8 +107,8 @@ typedef union {
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; twords r;
r.s.high = h; r.s.high = (du_int)h;
r.s.low = l; r.s.low = (du_int)l;
return r.all; return r.all;
} }
@ -139,7 +139,6 @@ typedef union {
udwords u; udwords u;
double f; double f;
} double_bits; } double_bits;
#endif
typedef struct { typedef struct {
#if _YUGA_LITTLE_ENDIAN #if _YUGA_LITTLE_ENDIAN
@ -190,12 +189,16 @@ typedef long double tf_float;
#define CRT_LDBL_IEEE_F128 #define CRT_LDBL_IEEE_F128
#endif #endif
#define TF_C(x) x##L #define TF_C(x) x##L
#elif __LDBL_MANT_DIG__ == 113 #elif __LDBL_MANT_DIG__ == 113 || \
// Use long double instead of __float128 if it matches the IEEE 128-bit format. (__FLT_RADIX__ == 16 && __LDBL_MANT_DIG__ == 28)
// Use long double instead of __float128 if it matches the IEEE 128-bit format
// or the IBM hexadecimal format.
#define CRT_LDBL_128BIT #define CRT_LDBL_128BIT
#define CRT_HAS_F128 #define CRT_HAS_F128
#if __LDBL_MANT_DIG__ == 113
#define CRT_HAS_IEEE_TF #define CRT_HAS_IEEE_TF
#define CRT_LDBL_IEEE_F128 #define CRT_LDBL_IEEE_F128
#endif
typedef long double tf_float; typedef long double tf_float;
#define TF_C(x) x##L #define TF_C(x) x##L
#elif defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) #elif defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
@ -220,7 +223,6 @@ typedef union {
#define CRT_HAS_TF_MODE #define CRT_HAS_TF_MODE
#endif #endif
#if CRT_HAS_FLOATING_POINT
#if __STDC_VERSION__ >= 199901L #if __STDC_VERSION__ >= 199901L
typedef float _Complex Fcomplex; typedef float _Complex Fcomplex;
typedef double _Complex Dcomplex; typedef double _Complex Dcomplex;
@ -270,5 +272,5 @@ typedef struct {
#define COMPLEXTF_IMAGINARY(x) (x).imaginary #define COMPLEXTF_IMAGINARY(x) (x).imaginary
#endif #endif
#endif #endif // CRT_HAS_FLOATING_POINT
#endif // INT_TYPES_H #endif // INT_TYPES_H