Open Quuxplusone opened 6 years ago
Bugzilla Link | PR39376 |
Status | NEW |
Importance | P enhancement |
Reported by | Manoj Gupta (manojgupta@google.com) |
Reported on | 2018-10-21 19:41:05 -0700 |
Last modified on | 2021-10-08 06:35:38 -0700 |
Version | unspecified |
Hardware | PC Windows NT |
CC | dodoentertainment@gmail.com, efriedma@quicinc.com, joerg@NetBSD.org, llozano@chromium.org, llvm-bugs@lists.llvm.org, manojgupta@google.com, paul@pbristow.uk, saugustine@google.com, srhines@google.com, yunlian@google.com |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
Aren't you confusing long double (aka 80bit Intel extended precision) with IEEE754 quad precision?
Compiler-rt is using the long double type for the builtins under quad precision
(for all architectures). Maybe __float128 should have been used instead?
For x86, My understanding is generally compiler converts uses of long double to
fp80 instructions so the uses are often not emitted as call to builtins.
lib/builtins/fp_lib.h
elif defined QUAD_PRECISION
#if __LDBL_MANT_DIG__ == 113
#define CRT_LDBL_128BIT
typedef __uint128_t rep_t;
typedef __int128_t srep_t;
typedef long double fp_t;
#define REP_C (__uint128_t)
(In reply to Manoj Gupta from comment #2)
> Compiler-rt is using the long double type for the builtins under quad
> precision (for all architectures). Maybe __float128 should have been used
> instead?
That's the right approach. (compiler-rt was written before __float128 existed,
so "should have been used" isn't really right, but you get the idea.)
Thanks Eli,
I have corrected the bug title. I want to work on adding the missing pieces but will need to find some time for it.
With the change above, what functions would still be missing?
afaik, that change is not complete or correct for float128 on x86_64 since it was likely causing fp80 functions to be (mis)compiled as f128 but I haven't investigated since then.
Having finally got clang-cl to work on Windows 10 using Mingw64 / GCC 8.1,
I was hoping to be able to run Boost.Multiprecision and Boost.Math examples
that use float128 using GCC's quadmath.h and the library libquadmath.dll. These
examples all work as expected for GCC.
When I make quadmath.h visible via an include, or copying the file into Clang's
include tree, I get this disappointing message
C:\LLVM\clang-800\LLVM\lib\clang\8.0.0\include\quadmath.h(33): error: unsupported machine mode 'TC'
C:\LLVM\clang-800\LLVM\lib\clang\8.0.0\include\quadmath.h(47): error: __float128 is not supported on this target
Any suggestions on how this might be made to work?
What is machine mode 'TC'?
It would provide full Boost multiprecision portability on the msvc, gcc and
clang platforms.
Thank you.
(In reply to Paul A. Bristow from comment #7)
> Any suggestions on how this might be made to work?
Please file a new bug. The compile-time error is not really the same issue.
(IIRC we restrict the targets where 128-bit floats are supported for gcc
compatibility; not sure what the current state is.)
> What is machine mode 'TC'?
It's a complex 128-bit float (i.e. a pair of 128-bit floats).
Thanks.
What is machine mode 'TC'?
It's a complex 128-bit float (i.e. a pair of 128-bit floats).
Is curious as I am not knowinly using complex, but perhaps it is in the internals of Boost.Multiprecision.
As suggested I have posted a new 'bug'.
https://bugs.llvm.org/show_bug.cgi?id=40879
__float_128 clang-cl on Windows 10 x64 using Mingw64 / GCC 8.1 to enable 128-bit float Boost.Multiprecision and Boost.Math fails to compile
I can also reproduce this with glibc 2.26 on Amazon Linux 2 using this docker image.
The Dockerfile for that image can be found here.
I'm using LLVM 13