[Lldb-commits] [lld] [clang-tools-extra] [compiler-rt] [libcxxabi] [flang] [libunwind] [lldb] [libclc] [llvm] [clang] [libc] [libcxx] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-10 Thread Sean Perry via lldb-commits

https://github.com/perry-ca updated 
https://github.com/llvm/llvm-project/pull/77554

>From 7ba4d61bd2beda03ba0fcefc9ca5c1ff08ffd48e Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Tue, 9 Jan 2024 20:59:28 -0600
Subject: [PATCH 1/3] Generate __multc3 for z/OS

---
 compiler-rt/lib/builtins/divtc3.c| 3 ---
 compiler-rt/lib/builtins/fp_lib.h| 8 ++--
 compiler-rt/lib/builtins/int_types.h | 6 --
 compiler-rt/lib/builtins/multc3.c| 4 
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index e970cef574b21d..6ec9c5f17d4b68 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-#if defined(CRT_HAS_TF_MODE)
 
 // Returns: the quotient of (a + ib) / (c + id)
 
@@ -52,5 +51,3 @@ COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t 
__c, fp_t __d) {
   }
   return z;
 }
-
-#endif
diff --git a/compiler-rt/lib/builtins/fp_lib.h 
b/compiler-rt/lib/builtins/fp_lib.h
index af406e760497a4..a293788fc68f56 100644
--- a/compiler-rt/lib/builtins/fp_lib.h
+++ b/compiler-rt/lib/builtins/fp_lib.h
@@ -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)
 // 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_TF_MODE) && defined(CRT_HAS_IEEE_TF)
 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
diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index 7624c728061518..ebbc63af598b76 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -189,8 +189,10 @@ 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
 #define CRT_HAS_IEEE_TF
diff --git a/compiler-rt/lib/builtins/multc3.c 
b/compiler-rt/lib/builtins/multc3.c
index f20e53ccbf233b..21c522d0330b7f 100644
--- a/compiler-rt/lib/builtins/multc3.c
+++ b/compiler-rt/lib/builtins/multc3.c
@@ -15,8 +15,6 @@
 #include "int_lib.h"
 #include "int_math.h"
 
-#if defined(CRT_HAS_TF_MODE)
-
 // Returns: the product of a + ib and c + id
 
 COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, fp_t d) {
@@ -66,5 +64,3 @@ COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, 
fp_t d) {
   }
   return z;
 }
-
-#endif

>From 81b814ccc0b216eb9464c9fa5d4d28b0511c2338 Mon Sep 17 00:00:00 2001
From: Sean Perry <39927768+perry...@users.noreply.github.com>
Date: Tue, 9 Jan 2024 23:49:29 -0500
Subject: [PATCH 2/3] formatting update

---
 compiler-rt/lib/builtins/divtc3.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index 6ec9c5f17d4b68..7d3185c9d71fbb 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-
 // Returns: the quotient of (a + ib) / (c + id)
 
 COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t __c, fp_t __d) {

>From 2cb932ab37caf472aa296f5d7c811feada8464f0 Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Wed, 10 Jan 2024 16:03:48 -0600
Subject: [PATCH 3/3] only define CRT_HAS_F128 & CRT_HAS_IEEE_TF for IEEE

---
 compiler-rt/lib/builtins/int_types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index ebbc63af598b76..9ceced37a997f4 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -194,8 +194,10 @@ typedef long double tf_float;
 // Use long double instead of __float128 if it matches the IEEE 128-

[Lldb-commits] [clang-tools-extra] [compiler-rt] [flang] [libcxxabi] [llvm] [lldb] [libunwind] [libclc] [lld] [libc] [clang] [libcxx] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Sean Perry via lldb-commits

https://github.com/perry-ca updated 
https://github.com/llvm/llvm-project/pull/77554

>From 7ba4d61bd2beda03ba0fcefc9ca5c1ff08ffd48e Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Tue, 9 Jan 2024 20:59:28 -0600
Subject: [PATCH 1/4] Generate __multc3 for z/OS

---
 compiler-rt/lib/builtins/divtc3.c| 3 ---
 compiler-rt/lib/builtins/fp_lib.h| 8 ++--
 compiler-rt/lib/builtins/int_types.h | 6 --
 compiler-rt/lib/builtins/multc3.c| 4 
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index e970cef574b21d..6ec9c5f17d4b68 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-#if defined(CRT_HAS_TF_MODE)
 
 // Returns: the quotient of (a + ib) / (c + id)
 
@@ -52,5 +51,3 @@ COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t 
__c, fp_t __d) {
   }
   return z;
 }
-
-#endif
diff --git a/compiler-rt/lib/builtins/fp_lib.h 
b/compiler-rt/lib/builtins/fp_lib.h
index af406e760497a4..a293788fc68f56 100644
--- a/compiler-rt/lib/builtins/fp_lib.h
+++ b/compiler-rt/lib/builtins/fp_lib.h
@@ -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)
 // 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_TF_MODE) && defined(CRT_HAS_IEEE_TF)
 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
diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index 7624c728061518..ebbc63af598b76 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -189,8 +189,10 @@ 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
 #define CRT_HAS_IEEE_TF
diff --git a/compiler-rt/lib/builtins/multc3.c 
b/compiler-rt/lib/builtins/multc3.c
index f20e53ccbf233b..21c522d0330b7f 100644
--- a/compiler-rt/lib/builtins/multc3.c
+++ b/compiler-rt/lib/builtins/multc3.c
@@ -15,8 +15,6 @@
 #include "int_lib.h"
 #include "int_math.h"
 
-#if defined(CRT_HAS_TF_MODE)
-
 // Returns: the product of a + ib and c + id
 
 COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, fp_t d) {
@@ -66,5 +64,3 @@ COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, 
fp_t d) {
   }
   return z;
 }
-
-#endif

>From 81b814ccc0b216eb9464c9fa5d4d28b0511c2338 Mon Sep 17 00:00:00 2001
From: Sean Perry <39927768+perry...@users.noreply.github.com>
Date: Tue, 9 Jan 2024 23:49:29 -0500
Subject: [PATCH 2/4] formatting update

---
 compiler-rt/lib/builtins/divtc3.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index 6ec9c5f17d4b68..7d3185c9d71fbb 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-
 // Returns: the quotient of (a + ib) / (c + id)
 
 COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t __c, fp_t __d) {

>From 2cb932ab37caf472aa296f5d7c811feada8464f0 Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Wed, 10 Jan 2024 16:03:48 -0600
Subject: [PATCH 3/4] only define CRT_HAS_F128 & CRT_HAS_IEEE_TF for IEEE

---
 compiler-rt/lib/builtins/int_types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index ebbc63af598b76..9ceced37a997f4 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -194,8 +194,10 @@ typedef long double tf_float;
 // Use long double instead of __float128 if it matches the IEEE 128-

[Lldb-commits] [clang-tools-extra] [compiler-rt] [flang] [libcxxabi] [llvm] [lldb] [libunwind] [libclc] [lld] [libc] [clang] [libcxx] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Sean Perry via lldb-commits

https://github.com/perry-ca updated 
https://github.com/llvm/llvm-project/pull/77554

>From 7ba4d61bd2beda03ba0fcefc9ca5c1ff08ffd48e Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Tue, 9 Jan 2024 20:59:28 -0600
Subject: [PATCH 1/5] Generate __multc3 for z/OS

---
 compiler-rt/lib/builtins/divtc3.c| 3 ---
 compiler-rt/lib/builtins/fp_lib.h| 8 ++--
 compiler-rt/lib/builtins/int_types.h | 6 --
 compiler-rt/lib/builtins/multc3.c| 4 
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index e970cef574b21d..6ec9c5f17d4b68 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-#if defined(CRT_HAS_TF_MODE)
 
 // Returns: the quotient of (a + ib) / (c + id)
 
@@ -52,5 +51,3 @@ COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t 
__c, fp_t __d) {
   }
   return z;
 }
-
-#endif
diff --git a/compiler-rt/lib/builtins/fp_lib.h 
b/compiler-rt/lib/builtins/fp_lib.h
index af406e760497a4..a293788fc68f56 100644
--- a/compiler-rt/lib/builtins/fp_lib.h
+++ b/compiler-rt/lib/builtins/fp_lib.h
@@ -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)
 // 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_TF_MODE) && defined(CRT_HAS_IEEE_TF)
 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
diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index 7624c728061518..ebbc63af598b76 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -189,8 +189,10 @@ 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
 #define CRT_HAS_IEEE_TF
diff --git a/compiler-rt/lib/builtins/multc3.c 
b/compiler-rt/lib/builtins/multc3.c
index f20e53ccbf233b..21c522d0330b7f 100644
--- a/compiler-rt/lib/builtins/multc3.c
+++ b/compiler-rt/lib/builtins/multc3.c
@@ -15,8 +15,6 @@
 #include "int_lib.h"
 #include "int_math.h"
 
-#if defined(CRT_HAS_TF_MODE)
-
 // Returns: the product of a + ib and c + id
 
 COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, fp_t d) {
@@ -66,5 +64,3 @@ COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, 
fp_t d) {
   }
   return z;
 }
-
-#endif

>From 81b814ccc0b216eb9464c9fa5d4d28b0511c2338 Mon Sep 17 00:00:00 2001
From: Sean Perry <39927768+perry...@users.noreply.github.com>
Date: Tue, 9 Jan 2024 23:49:29 -0500
Subject: [PATCH 2/5] formatting update

---
 compiler-rt/lib/builtins/divtc3.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index 6ec9c5f17d4b68..7d3185c9d71fbb 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-
 // Returns: the quotient of (a + ib) / (c + id)
 
 COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t __c, fp_t __d) {

>From 2cb932ab37caf472aa296f5d7c811feada8464f0 Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Wed, 10 Jan 2024 16:03:48 -0600
Subject: [PATCH 3/5] only define CRT_HAS_F128 & CRT_HAS_IEEE_TF for IEEE

---
 compiler-rt/lib/builtins/int_types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index ebbc63af598b76..9ceced37a997f4 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -194,8 +194,10 @@ typedef long double tf_float;
 // Use long double instead of __float128 if it matches the IEEE 128-

[Lldb-commits] [flang] [libc] [libcxx] [llvm] [clang] [lldb] [lld] [clang-tools-extra] [libcxxabi] [libunwind] [libclc] [compiler-rt] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Sean Perry via lldb-commits

https://github.com/perry-ca updated 
https://github.com/llvm/llvm-project/pull/77554

>From 7ba4d61bd2beda03ba0fcefc9ca5c1ff08ffd48e Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Tue, 9 Jan 2024 20:59:28 -0600
Subject: [PATCH 1/6] Generate __multc3 for z/OS

---
 compiler-rt/lib/builtins/divtc3.c| 3 ---
 compiler-rt/lib/builtins/fp_lib.h| 8 ++--
 compiler-rt/lib/builtins/int_types.h | 6 --
 compiler-rt/lib/builtins/multc3.c| 4 
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index e970cef574b21d..6ec9c5f17d4b68 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-#if defined(CRT_HAS_TF_MODE)
 
 // Returns: the quotient of (a + ib) / (c + id)
 
@@ -52,5 +51,3 @@ COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t 
__c, fp_t __d) {
   }
   return z;
 }
-
-#endif
diff --git a/compiler-rt/lib/builtins/fp_lib.h 
b/compiler-rt/lib/builtins/fp_lib.h
index af406e760497a4..a293788fc68f56 100644
--- a/compiler-rt/lib/builtins/fp_lib.h
+++ b/compiler-rt/lib/builtins/fp_lib.h
@@ -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)
 // 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_TF_MODE) && defined(CRT_HAS_IEEE_TF)
 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
diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index 7624c728061518..ebbc63af598b76 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -189,8 +189,10 @@ 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
 #define CRT_HAS_IEEE_TF
diff --git a/compiler-rt/lib/builtins/multc3.c 
b/compiler-rt/lib/builtins/multc3.c
index f20e53ccbf233b..21c522d0330b7f 100644
--- a/compiler-rt/lib/builtins/multc3.c
+++ b/compiler-rt/lib/builtins/multc3.c
@@ -15,8 +15,6 @@
 #include "int_lib.h"
 #include "int_math.h"
 
-#if defined(CRT_HAS_TF_MODE)
-
 // Returns: the product of a + ib and c + id
 
 COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, fp_t d) {
@@ -66,5 +64,3 @@ COMPILER_RT_ABI Qcomplex __multc3(fp_t a, fp_t b, fp_t c, 
fp_t d) {
   }
   return z;
 }
-
-#endif

>From 81b814ccc0b216eb9464c9fa5d4d28b0511c2338 Mon Sep 17 00:00:00 2001
From: Sean Perry <39927768+perry...@users.noreply.github.com>
Date: Tue, 9 Jan 2024 23:49:29 -0500
Subject: [PATCH 2/6] formatting update

---
 compiler-rt/lib/builtins/divtc3.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/compiler-rt/lib/builtins/divtc3.c 
b/compiler-rt/lib/builtins/divtc3.c
index 6ec9c5f17d4b68..7d3185c9d71fbb 100644
--- a/compiler-rt/lib/builtins/divtc3.c
+++ b/compiler-rt/lib/builtins/divtc3.c
@@ -13,7 +13,6 @@
 #define QUAD_PRECISION
 #include "fp_lib.h"
 
-
 // Returns: the quotient of (a + ib) / (c + id)
 
 COMPILER_RT_ABI Qcomplex __divtc3(fp_t __a, fp_t __b, fp_t __c, fp_t __d) {

>From 2cb932ab37caf472aa296f5d7c811feada8464f0 Mon Sep 17 00:00:00 2001
From: Sean Perry 
Date: Wed, 10 Jan 2024 16:03:48 -0600
Subject: [PATCH 3/6] only define CRT_HAS_F128 & CRT_HAS_IEEE_TF for IEEE

---
 compiler-rt/lib/builtins/int_types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compiler-rt/lib/builtins/int_types.h 
b/compiler-rt/lib/builtins/int_types.h
index ebbc63af598b76..9ceced37a997f4 100644
--- a/compiler-rt/lib/builtins/int_types.h
+++ b/compiler-rt/lib/builtins/int_types.h
@@ -194,8 +194,10 @@ typedef long double tf_float;
 // Use long double instead of __float128 if it matches the IEEE 128-

[Lldb-commits] [compiler-rt] [libcxxabi] [lld] [lldb] [clang] [llvm] [libc] [libclc] [libunwind] [libcxx] [clang-tools-extra] [flang] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-11 Thread Sean Perry via lldb-commits

perry-ca wrote:

Thanks. I don't have write access yet.  Would you be able to merge this.

https://github.com/llvm/llvm-project/pull/77554
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [libcxxabi] [clang-tools-extra] [flang] [lldb] [libcxx] [clang] [libclc] [libunwind] [libc] [llvm] [compiler-rt] [lld] [builtins] Generate __multc3 for z/OS (PR #77554)

2024-01-12 Thread Sean Perry via lldb-commits


@@ -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)

perry-ca wrote:

I've put up #77981 for review.

https://github.com/llvm/llvm-project/pull/77554
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Propagate IsText parameter to openFileForRead function (PR #110661)

2024-10-02 Thread Sean Perry via lldb-commits

perry-ca wrote:

> > sorry this is same as #107906 (with a bigger impact radius, as you're also 
> > changing getBufferForFile) and doesn't address any of the issues mention 
> > about explaining the semantics of `IsText` or justification for changing 
> > the core VFS interfaces, for an operation that's can solely be performed on 
> > physical fileystem.
> > @perry-ca raised some concerns in #109664 about this functionality 
> > requiring some context awareness, I don't think any of those is addressed 
> > by this patch either. Pretty much all of the callers apart from ASTReader 
> > is just using `IsText = true`.
> 
> To give some context, the problem we are trying to solve initially is that 
> file opened by `#embed` should not be utf-8 converted.

Correct.  The overall/original problem is that we have many places where text 
files were being read as binary files.  Adding the IsText parameter to the 
openFileForRead() function just like we have in the getFileOrStdin() group of 
functions solves that problem.  It tells the compiler to read files that should 
be text as text and binary as binary.

https://github.com/llvm/llvm-project/pull/110661
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Propagate IsText parameter to openFileForRead function (PR #110661)

2024-10-01 Thread Sean Perry via lldb-commits

perry-ca wrote:

> @perry-ca raised some concerns in #109664 about this functionality requiring 
> some context awareness, I don't think any of those is addressed by this patch 
> either. Pretty much all of the callers apart from ASTReader is just using 
> `IsText = true`.

It just happens that 90% of the time you are dealing with text files.  As you 
noted, in the context of the ASTReader, the file being read is expected to be a 
binary file.  In that case the parameter is false.

These change mirror interface to `getFileOrSTDIN()` which has a IsText 
parameter.  This does touch a number of places but I feel the changes are in 
line with the rest of the file I/O functions in llvm.


https://github.com/llvm/llvm-project/pull/110661
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits