-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[builtins] Generate __multc3 for z/OS #77554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7ba4d61
81b814c
2cb932a
f94e376
bb5c0c3
4a24da7
28e0981
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,6 +188,8 @@ static __inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) { | |
#undef Word_HiMask | ||
#undef Word_LoMask | ||
#undef Word_FullMask | ||
#else | ||
typedef long double fp_t; | ||
#endif // defined(CRT_HAS_TF_MODE) | ||
#else | ||
#error SINGLE_PRECISION, DOUBLE_PRECISION or QUAD_PRECISION must be defined. | ||
|
@@ -374,10 +376,10 @@ static __inline fp_t __compiler_rt_fmax(fp_t x, fp_t y) { | |
#endif | ||
} | ||
|
||
#elif defined(QUAD_PRECISION) && defined(CRT_HAS_TF_MODE) | ||
#elif defined(QUAD_PRECISION) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've put up #77981 for review. |
||
// The generic implementation only works for ieee754 floating point. For other | ||
// floating point types, continue to rely on the libm implementation for now. | ||
#if defined(CRT_HAS_IEEE_TF) | ||
#if defined(CRT_HAS_IEEE_TF) && defined(CRT_HAS_128BIT) | ||
static __inline tf_float __compiler_rt_logbtf(tf_float x) { | ||
return __compiler_rt_logbX(x); | ||
} | ||
|
@@ -405,6 +407,8 @@ static __inline tf_float __compiler_rt_fmaxtf(tf_float x, tf_float y) { | |
#define __compiler_rt_logbl crt_logbl | ||
#define __compiler_rt_scalbnl crt_scalbnl | ||
#define __compiler_rt_fmaxl crt_fmaxl | ||
#define crt_fabstf crt_fabsl | ||
#define crt_copysigntf crt_copysignl | ||
#else | ||
#error Unsupported TF mode type | ||
#endif | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,12 +189,16 @@ typedef long double tf_float; | |
#define CRT_LDBL_IEEE_F128 | ||
#endif | ||
#define TF_C(x) x##L | ||
#elif __LDBL_MANT_DIG__ == 113 | ||
// Use long double instead of __float128 if it matches the IEEE 128-bit format. | ||
#elif __LDBL_MANT_DIG__ == 113 || \ | ||
(__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_HAS_F128 | ||
#if __LDBL_MANT_DIG__ == 113 | ||
#define CRT_HAS_IEEE_TF | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These last two macros should only be defined for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The CRT_HAS_F128 needs to be defined for hex float too. The Qcomplex and COMPLEXTF_REAL/COMPLEXTF_IMAGINARY ids are only defined if CRT_HAS_F128 is defined and multc3.c/divtc3.c depend on those. I agree with CRT_HAS_IEEE_TF. This should also only be defined if CRT_HAS_TF_MODE is defined. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I double checked and Qcomplex is defined via CRT_LDBL_128BIT. I can limit CRT_HAS_F128 to IEEE too. |
||
#define CRT_LDBL_IEEE_F128 | ||
#endif | ||
typedef long double tf_float; | ||
#define TF_C(x) x##L | ||
#elif defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
#include "int_lib.h" | ||
#include "int_math.h" | ||
|
||
#if defined(CRT_HAS_TF_MODE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this diff still needed? The macro should be defined with the change to int_types.h. Or is the problem here that int128 is not supported? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. int128 isn't supported on z/OS yet. This change enables quad precision without needing to have TF mode enabled. We need this diff otherwise we don't get __multc3 defined. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if we support architectures without a "tf" floating point type. To be safe I believe we still need a guard here since this file is compiled unconditionally. We just have to replace it with "CRT_HAS_F128". A nice future cleanup would be to change CRT_HAS_TF_MODE to actually mean tf_float exists and explicitly guard for INT128 where needed. But that is a larger cleanup that probably shouldn't be part of this PR. |
||
#if defined(CRT_HAS_F128) | ||
|
||
// Returns: the product of a + ib and c + id | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest replacing this with CRT_HAS_F128 as noted below (unless you're will to audit all current uses of CRT_HAS_TF_MODE since that currently is a proxy for TF_MODE&&INT128 rather than just TF_MODE).