starsid updated this revision to Diff 393335. starsid added a comment. rebase and resurrect
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D53608/new/ https://reviews.llvm.org/D53608 Files: compiler-rt/lib/builtins/extendhftf2.c compiler-rt/lib/builtins/fp_lib.h compiler-rt/lib/builtins/powitf2.c compiler-rt/lib/builtins/trunctfdf2.c compiler-rt/lib/builtins/trunctfhf2.c compiler-rt/lib/builtins/trunctfsf2.c Index: compiler-rt/lib/builtins/trunctfsf2.c =================================================================== --- compiler-rt/lib/builtins/trunctfsf2.c +++ compiler-rt/lib/builtins/trunctfsf2.c @@ -14,6 +14,6 @@ #define DST_SINGLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI float __trunctfsf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI float __trunctfsf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfhf2.c =================================================================== --- compiler-rt/lib/builtins/trunctfhf2.c +++ compiler-rt/lib/builtins/trunctfhf2.c @@ -16,8 +16,6 @@ #define DST_HALF #include "fp_trunc_impl.inc" -COMPILER_RT_ABI _Float16 __trunctfhf2(long double a) { - return __truncXfYf2__(a); -} +COMPILER_RT_ABI _Float16 __trunctfhf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfdf2.c =================================================================== --- compiler-rt/lib/builtins/trunctfdf2.c +++ compiler-rt/lib/builtins/trunctfdf2.c @@ -14,6 +14,6 @@ #define DST_DOUBLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI double __trunctfdf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI double __trunctfdf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/powitf2.c =================================================================== --- compiler-rt/lib/builtins/powitf2.c +++ compiler-rt/lib/builtins/powitf2.c @@ -17,9 +17,9 @@ // Returns: a ^ b -COMPILER_RT_ABI long double __powitf2(long double a, int b) { +COMPILER_RT_ABI fp_t __powitf2(fp_t a, int b) { const int recip = b < 0; - long double r = 1; + fp_t r = 1; while (1) { if (b & 1) r *= a; Index: compiler-rt/lib/builtins/fp_lib.h =================================================================== --- compiler-rt/lib/builtins/fp_lib.h +++ compiler-rt/lib/builtins/fp_lib.h @@ -105,12 +105,17 @@ COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b); #elif defined QUAD_PRECISION -#if __LDBL_MANT_DIG__ == 113 && defined(__SIZEOF_INT128__) +#if (__LDBL_MANT_DIG__ == 113 || defined(__x86_64__)) && \ + defined(__SIZEOF_INT128__) #define CRT_LDBL_128BIT typedef uint64_t half_rep_t; typedef __uint128_t rep_t; typedef __int128_t srep_t; +#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) +typedef __float128 fp_t; +#else typedef long double fp_t; +#endif #define HALF_REP_C UINT64_C #define REP_C (__uint128_t) // Note: Since there is no explicit way to tell compiler the constant is a Index: compiler-rt/lib/builtins/extendhftf2.c =================================================================== --- compiler-rt/lib/builtins/extendhftf2.c +++ compiler-rt/lib/builtins/extendhftf2.c @@ -16,8 +16,6 @@ #define DST_QUAD #include "fp_extend_impl.inc" -COMPILER_RT_ABI long double __extendhftf2(_Float16 a) { - return __extendXfYf2__(a); -} +COMPILER_RT_ABI fp_t __extendhftf2(_Float16 a) { return __extendXfYf2__(a); } #endif
Index: compiler-rt/lib/builtins/trunctfsf2.c =================================================================== --- compiler-rt/lib/builtins/trunctfsf2.c +++ compiler-rt/lib/builtins/trunctfsf2.c @@ -14,6 +14,6 @@ #define DST_SINGLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI float __trunctfsf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI float __trunctfsf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfhf2.c =================================================================== --- compiler-rt/lib/builtins/trunctfhf2.c +++ compiler-rt/lib/builtins/trunctfhf2.c @@ -16,8 +16,6 @@ #define DST_HALF #include "fp_trunc_impl.inc" -COMPILER_RT_ABI _Float16 __trunctfhf2(long double a) { - return __truncXfYf2__(a); -} +COMPILER_RT_ABI _Float16 __trunctfhf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/trunctfdf2.c =================================================================== --- compiler-rt/lib/builtins/trunctfdf2.c +++ compiler-rt/lib/builtins/trunctfdf2.c @@ -14,6 +14,6 @@ #define DST_DOUBLE #include "fp_trunc_impl.inc" -COMPILER_RT_ABI double __trunctfdf2(long double a) { return __truncXfYf2__(a); } +COMPILER_RT_ABI double __trunctfdf2(fp_t a) { return __truncXfYf2__(a); } #endif Index: compiler-rt/lib/builtins/powitf2.c =================================================================== --- compiler-rt/lib/builtins/powitf2.c +++ compiler-rt/lib/builtins/powitf2.c @@ -17,9 +17,9 @@ // Returns: a ^ b -COMPILER_RT_ABI long double __powitf2(long double a, int b) { +COMPILER_RT_ABI fp_t __powitf2(fp_t a, int b) { const int recip = b < 0; - long double r = 1; + fp_t r = 1; while (1) { if (b & 1) r *= a; Index: compiler-rt/lib/builtins/fp_lib.h =================================================================== --- compiler-rt/lib/builtins/fp_lib.h +++ compiler-rt/lib/builtins/fp_lib.h @@ -105,12 +105,17 @@ COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b); #elif defined QUAD_PRECISION -#if __LDBL_MANT_DIG__ == 113 && defined(__SIZEOF_INT128__) +#if (__LDBL_MANT_DIG__ == 113 || defined(__x86_64__)) && \ + defined(__SIZEOF_INT128__) #define CRT_LDBL_128BIT typedef uint64_t half_rep_t; typedef __uint128_t rep_t; typedef __int128_t srep_t; +#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) +typedef __float128 fp_t; +#else typedef long double fp_t; +#endif #define HALF_REP_C UINT64_C #define REP_C (__uint128_t) // Note: Since there is no explicit way to tell compiler the constant is a Index: compiler-rt/lib/builtins/extendhftf2.c =================================================================== --- compiler-rt/lib/builtins/extendhftf2.c +++ compiler-rt/lib/builtins/extendhftf2.c @@ -16,8 +16,6 @@ #define DST_QUAD #include "fp_extend_impl.inc" -COMPILER_RT_ABI long double __extendhftf2(_Float16 a) { - return __extendXfYf2__(a); -} +COMPILER_RT_ABI fp_t __extendhftf2(_Float16 a) { return __extendXfYf2__(a); } #endif
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits