[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: no quadmath.h on ppc64 ?



On Thu, 05 Apr 2018, Breno Leitao wrote:

>On 04/04/2018 07:01 PM, Dennis Clarke wrote:
>> So there we see "--disable-libquadmath --disable-libquadmath-support".  
>
>This is also disabled on ppc64el and it should be enabled, so, put both ppc64
>and ppc64el on your bug, please.
>
>Since ppc64 supports float128 I suppose this should be enabled by default on
>the ppc64{el} architectures.

I agree with this.  It will give Debian users the chance to use libquadmath
on powerpc (ppc64 and ppc64el).

>Back to toolchain question, I understand that there are two Float128
>implementations right now on Linux, one that is provided by the GCC and
>another one is provided by the Glibc. You are trying to use the GCC
>implementation.

I have a couple of comments about these float128 nomenclature and support,
that I'd like to share, since it took me some time to understand it...

Saying float128 might mean a lot of different stuff.  It can be support
for a floating-point type in the compiler, it can be support for some API
on a library, as well as there are different floating-point types and
different APIs.  These are all somewhat related to the "float128" name.

Compiler support for the __float128 *type* is a GNU extension.  It has been
made available on powerpc, since GCC 6.2, iirc.

Compiler support for the _Float128 *type* is related to an ISO standard
(more specifically to ISO/IEC TS 18661-3). It has been made available
since GCC 7.1, for all architectures that support it, powerpc included.

So, if your program wants to use one of these *types* for a variable, it
needs compiler support.

(Note: before GCC 7.3, you also need to pass -mfloat128 to gcc in order for
the type be exposed.  This is valid for powerpc, on x86 you don't need
that. With newer GCC, it just works)

These types have the same format, so equal values will be represented
exactly the same on a register on in memory.


Than, there is library support...

libquadmath is somewhat related to the __float128 type, and, to the best
of my knowledge, is a GNU extension and it provides many functions to
operate on __float128 values.  For instance, it provides sinq, cosq
(notice the "q" suffix).

Glibc, since version 2.26, provides another interface, with functions that
have the "f128" suffix, for instance sinf128, atanf128, strfromf128.  This
interface is somewhat related to the _Float128 type, since it is defined
in the same standard (i.e.: ISO/IEC TS 18661-3)

So, people who want to use a function from libquadmath, for instance sinq,
need the headers (quadmath.h) and libraries (libquadmath.so) that are
provided by a GCC installation (with libquadmath enabled).

On the other hand, people that want to use a function from ISO/IEC TS
18661-3, for instance sinf128, need the headers (math.h, stdlib.h,
complex.h) and libraries (libc.so, libm.so) from GLIBC (version 2.26 or
above).

I hope that this helps.

Cheers,
Gabriel


Reply to: