[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2023-03-06 Thread Aaron Siddhartha Mondal via Phabricator via cfe-commits
aaronmondal added subscribers: MaskRay, phosek, compnerd, aaronmondal.
aaronmondal added a comment.
Herald added a subscriber: Enna1.
Herald added a project: All.

Hmm I tried to fiddle around with this but I'm out of my depth here. Pulling in 
@MaskRay @compnerd @phosek in the hopes that one of you is able to provide some 
insight or pull in someone else who is able to help.

When building a static compiler-rt with thinlto every downstream target breaks 
because of the missing `__extendxftf2` and `__trunctfxf2`. AFAIU this blocks 
everyone from using thinlto with compiler-rt.

  ld.lld: error: undefined symbol: __extendxftf2
  >>> referenced by extendsftf2.c:18 
(./external/llvm-project-overlay~17-init-bcr.0~llvm_project_overlay~llvm-project/compiler-rt/lib/builtins/extendsftf2.c:18)
  >>>   lto.tmp:(__extendsftf2)
  >>> referenced by extenddftf2.c:18 
(./external/llvm-project-overlay~17-init-bcr.0~llvm_project_overlay~llvm-project/compiler-rt/lib/builtins/extenddftf2.c:18)
  >>>   lto.tmp:(__extenddftf2)
  >>> referenced by floattitf.c:75 
(./external/llvm-project-overlay~17-init-bcr.0~llvm_project_overlay~llvm-project/compiler-rt/lib/builtins/floattitf.c:75)
  >>>   lto.tmp:(__floattitf)
  >>> referenced 1 more times
  >>> did you mean: __extenddftf2
  >>> defined in: lto.tmp
  
  ld.lld: error: undefined symbol: __trunctfxf2
  >>> referenced by trunctfsf2.c:17 
(./external/llvm-project-overlay~17-init-bcr.0~llvm_project_overlay~llvm-project/compiler-rt/lib/builtins/trunctfsf2.c:17)
  >>>   lto.tmp:(__trunctfsf2)
  >>> referenced by trunctfdf2.c:17 
(./external/llvm-project-overlay~17-init-bcr.0~llvm_project_overlay~llvm-project/compiler-rt/lib/builtins/trunctfdf2.c:17)
  >>>   lto.tmp:(__trunctfdf2)
  
bazel-out/k8-fastbuild-ST-1b2103630309/bin/external/llvm-project-overlay~17-init-bcr.0~llvm_project_overlay~llvm-project/clang/clang-linker-wrapper:
 error: 'ld.lld' failed

I also vaguely remember this leading to issues with static CUDA linking, but I 
don't have stacktraces for that :/


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53608/new/

https://reviews.llvm.org/D53608

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2021-12-14 Thread Siddhartha Bagaria via Phabricator via cfe-commits
starsid planned changes to this revision.
starsid added a comment.

Thanks. I missed that in the comment thread. Will send back for review once 
ready.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53608/new/

https://reviews.llvm.org/D53608

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2021-12-14 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

From earlier review comment:

> Missing changes to run the unittests (test/builtins/Unit/) for the new 
> functions.

That's the most important part, so we have some confidence the code actually 
works.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53608/new/

https://reviews.llvm.org/D53608

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2021-12-09 Thread Siddhartha Bagaria via Phabricator via cfe-commits
starsid added a comment.

I have tried my best to follow the conversation here and complete this patch. 
Please let me know if it is missing something, or if I need to assign new 
reviewers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53608/new/

https://reviews.llvm.org/D53608

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2021-12-09 Thread Siddhartha Bagaria via Phabricator via cfe-commits
starsid updated this revision to Diff 393340.
starsid added a comment.

fix commit author name and email


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-

[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2021-12-09 Thread Siddhartha Bagaria via Phabricator via cfe-commits
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/built

[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2019-11-07 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

Yes, it makes sense to provide these routines, but someone has to write the 
code to make it work.  This patch is currently incomplete:

> Took another look and seems like long double is hardcoded in many of the 
> builtins. So I think the current patch needs to rename a lot of places using 
> long double to __float128 type.


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53608/new/

https://reviews.llvm.org/D53608



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2019-11-07 Thread Troy Johnson via Phabricator via cfe-commits
troyj added a comment.

Wound up here while trying to use compiler-rt for static linking with our 
downstream compiler.  It seems that compiler-rt's current approach of only 
providing these routines on certain platforms is problematic because libgcc 
always provides them, and thus compiler-rt is not a full replacement for libgcc 
in some cases.  I also encountered the same two missing entry points.

Would very much like to see an upstream change to match the libgcc entry 
points, no matter the platform.


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53608/new/

https://reviews.llvm.org/D53608



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2019-03-09 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta added a comment.

In D53608#1423692 , @LuoYuanke wrote:

> Hi
>  What's the status for __float128 support? Has it already been finished?


Sorry, haven't looked at time for a while. Consider this change abandoned for 
now :(


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53608/new/

https://reviews.llvm.org/D53608



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2019-03-09 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke added a comment.
Herald added a subscriber: jdoerfert.
Herald added projects: LLVM, Sanitizers.

Hi
What's the status for __float128 support? Has it already been finished?


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53608/new/

https://reviews.llvm.org/D53608



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2018-10-24 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

Yes, that looks right.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53608



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2018-10-24 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta added a comment.

Took another look and seems like long double is hardcoded in many of the 
builtins. So I think the current patch needs to rename a lot of places using 
long double to __float128 type.

Some examples where I think __float128 type (propagating the type in fp_lib.h) 
should be used instead of long double:

./extenddftf2.c:  COMPILER_RT_ABI long double __extenddftf2(double a) {
./trunctfsf2.c:  COMPILER_RT_ABI float __trunctfsf2(long double a) {
./extendsftf2.c:  COMPILER_RT_ABI long double __extendsftf2(float a) {

@efriedma what do you think?


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53608



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2018-10-23 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

`__extendxftf2` and `__trunctfxf2` are for conversions between x86 long double 
and `__float128`; you'll need to write implementations yourself.  (That should 
be a separate patch.)

> Thanks Eli. I also found out that GCC 4.9 does not seem to have these defined 
> even though it supports `__float128`.

gcc 5 has the define; that's good enough.

Missing changes to run the unittests (test/builtins/Unit/) for the new 
functions.  Unfortunately, it looks like that will be a large patch because 
they use "long double" and "__LDBL_MANT_DIG__" explicitly all over the place.




Comment at: lib/builtins/fp_lib.h:107
+// __LDBL_MANT_DIG__ is set to 64 for x86_64.
+#if __LDBL_MANT_DIG__ == 113 || defined(__x86_64__)
 #define CRT_LDBL_128BIT

Instead of checking for `__x86_64__`, this should probably also check for the 
FLOAT128 defines.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53608



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2018-10-23 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta added a comment.

I am also getting these tests failures because of missing __trunctfxf2 and 
__extendxftf2. These are provided by libgcc but compiler-rt does not seem to 
have an implementation for them.

  Builtins-x86_64-linux :: compiler_rt_logbl_test.c
  Builtins-x86_64-linux :: divtc3_test.c
  Builtins-x86_64-linux :: floattitf_test.c
  Builtins-x86_64-linux :: floatuntitf_test.c

compiler_rt_logbl_test.c:26: error: undefined reference to '__trunctfxf2'
compiler_rt_logbl_test.c:26: error: undefined reference to '__extendxftf2'


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53608



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2018-10-23 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta added inline comments.



Comment at: lib/builtins/fp_lib.h:111
 typedef __int128_t srep_t;
-typedef long double fp_t;
+typedef __float128 fp_t;
 #define REP_C (__uint128_t)

efriedma wrote:
> manojgupta wrote:
> > Changed long double to  __float128 on Eli's advice in PR39376.
> You need to guard this with an ifdef; clang doesn't supports __float128 on 
> every target, even if long double is an 128-bit IEEE float.
> 
> For reasons I don't really understand, there are apparently two different 
> macros for this; `#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)` 
> should do the right thing.
Thanks Eli. I also found out that GCC 4.9 does not seem to have these defined 
even though it supports __float128.
https://godbolt.org/z/ReVm8j



Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53608



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2018-10-23 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta updated this revision to Diff 170756.
manojgupta added a comment.

Added checked for defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53608

Files:
  lib/builtins/CMakeLists.txt
  lib/builtins/fp_lib.h


Index: lib/builtins/fp_lib.h
===
--- lib/builtins/fp_lib.h
+++ lib/builtins/fp_lib.h
@@ -103,11 +103,16 @@
 COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b);
 
 #elif defined QUAD_PRECISION
-#if __LDBL_MANT_DIG__ == 113
+// __LDBL_MANT_DIG__ is set to 64 for x86_64.
+#if __LDBL_MANT_DIG__ == 113 || defined(__x86_64__)
 #define CRT_LDBL_128BIT
 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 REP_C (__uint128_t)
 // Note: Since there is no explicit way to tell compiler the constant is a
 // 128-bit integer, we let the constant be casted to 128-bit integer
Index: lib/builtins/CMakeLists.txt
===
--- lib/builtins/CMakeLists.txt
+++ lib/builtins/CMakeLists.txt
@@ -232,6 +232,7 @@
 
 if (NOT MSVC)
   set(x86_64_SOURCES
+  ${GENERIC_TF_SOURCES}
   x86_64/floatdidf.c
   x86_64/floatdisf.c
   x86_64/floatdixf.c


Index: lib/builtins/fp_lib.h
===
--- lib/builtins/fp_lib.h
+++ lib/builtins/fp_lib.h
@@ -103,11 +103,16 @@
 COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b);
 
 #elif defined QUAD_PRECISION
-#if __LDBL_MANT_DIG__ == 113
+// __LDBL_MANT_DIG__ is set to 64 for x86_64.
+#if __LDBL_MANT_DIG__ == 113 || defined(__x86_64__)
 #define CRT_LDBL_128BIT
 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 REP_C (__uint128_t)
 // Note: Since there is no explicit way to tell compiler the constant is a
 // 128-bit integer, we let the constant be casted to 128-bit integer
Index: lib/builtins/CMakeLists.txt
===
--- lib/builtins/CMakeLists.txt
+++ lib/builtins/CMakeLists.txt
@@ -232,6 +232,7 @@
 
 if (NOT MSVC)
   set(x86_64_SOURCES
+  ${GENERIC_TF_SOURCES}
   x86_64/floatdidf.c
   x86_64/floatdisf.c
   x86_64/floatdixf.c
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2018-10-23 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: lib/builtins/fp_lib.h:111
 typedef __int128_t srep_t;
-typedef long double fp_t;
+typedef __float128 fp_t;
 #define REP_C (__uint128_t)

manojgupta wrote:
> Changed long double to  __float128 on Eli's advice in PR39376.
You need to guard this with an ifdef; clang doesn't supports __float128 on 
every target, even if long double is an 128-bit IEEE float.

For reasons I don't really understand, there are apparently two different 
macros for this; `#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)` 
should do the right thing.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53608



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2018-10-23 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta added inline comments.



Comment at: lib/builtins/fp_lib.h:107
+// __LDBL_MANT_DIG__ is set to 64 for x86_64.
+#if __LDBL_MANT_DIG__ == 113 || defined(__x86_64__)
 #define CRT_LDBL_128BIT

I really don't know  the accurate set of checks that should be used here, 
Please advise,



Comment at: lib/builtins/fp_lib.h:111
 typedef __int128_t srep_t;
-typedef long double fp_t;
+typedef __float128 fp_t;
 #define REP_C (__uint128_t)

Changed long double to  __float128 on Eli's advice in PR39376.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53608



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53608: [builtins] Build float128 soft float builtins for x86_64.

2018-10-23 Thread Manoj Gupta via Phabricator via cfe-commits
manojgupta created this revision.
manojgupta added reviewers: efriedma, joerg.
Herald added subscribers: Sanitizers, llvm-commits, delcypher, mgorny.

float128 builtins are currently not built for x86_64.
This causes linker to complain baout missing symbols when linking
glibc 2.27 with float128 support.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53608

Files:
  lib/builtins/CMakeLists.txt
  lib/builtins/fp_lib.h


Index: lib/builtins/fp_lib.h
===
--- lib/builtins/fp_lib.h
+++ lib/builtins/fp_lib.h
@@ -103,11 +103,12 @@
 COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b);
 
 #elif defined QUAD_PRECISION
-#if __LDBL_MANT_DIG__ == 113
+// __LDBL_MANT_DIG__ is set to 64 for x86_64.
+#if __LDBL_MANT_DIG__ == 113 || defined(__x86_64__)
 #define CRT_LDBL_128BIT
 typedef __uint128_t rep_t;
 typedef __int128_t srep_t;
-typedef long double fp_t;
+typedef __float128 fp_t;
 #define REP_C (__uint128_t)
 // Note: Since there is no explicit way to tell compiler the constant is a
 // 128-bit integer, we let the constant be casted to 128-bit integer
Index: lib/builtins/CMakeLists.txt
===
--- lib/builtins/CMakeLists.txt
+++ lib/builtins/CMakeLists.txt
@@ -232,6 +232,7 @@
 
 if (NOT MSVC)
   set(x86_64_SOURCES
+  ${GENERIC_TF_SOURCES}
   x86_64/floatdidf.c
   x86_64/floatdisf.c
   x86_64/floatdixf.c


Index: lib/builtins/fp_lib.h
===
--- lib/builtins/fp_lib.h
+++ lib/builtins/fp_lib.h
@@ -103,11 +103,12 @@
 COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b);
 
 #elif defined QUAD_PRECISION
-#if __LDBL_MANT_DIG__ == 113
+// __LDBL_MANT_DIG__ is set to 64 for x86_64.
+#if __LDBL_MANT_DIG__ == 113 || defined(__x86_64__)
 #define CRT_LDBL_128BIT
 typedef __uint128_t rep_t;
 typedef __int128_t srep_t;
-typedef long double fp_t;
+typedef __float128 fp_t;
 #define REP_C (__uint128_t)
 // Note: Since there is no explicit way to tell compiler the constant is a
 // 128-bit integer, we let the constant be casted to 128-bit integer
Index: lib/builtins/CMakeLists.txt
===
--- lib/builtins/CMakeLists.txt
+++ lib/builtins/CMakeLists.txt
@@ -232,6 +232,7 @@
 
 if (NOT MSVC)
   set(x86_64_SOURCES
+  ${GENERIC_TF_SOURCES}
   x86_64/floatdidf.c
   x86_64/floatdisf.c
   x86_64/floatdixf.c
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits