Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Feb 2012 13:03:48 -0800
From:      "Thomas D. Dean" <tomdean@speakeasy.org>
To:        freebsd-amd64@freebsd.org
Subject:   Re: Gcc46 and 128 Bit Floating Point
Message-ID:  <4F3EC0B4.6050107@speakeasy.org>
In-Reply-To: <CAGE5yCpvF0-b1iKAVGbya=fUNaYbGyrpj1PHSQxw4BvycNMLDg@mail.gmail.com>
References:  <4F3EA37F.9010207@speakeasy.org> <CAGE5yCpvF0-b1iKAVGbya=fUNaYbGyrpj1PHSQxw4BvycNMLDg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 02/17/12 11:31, Peter Wemm wrote:
> On Fri, Feb 17, 2012 at 10:59 AM, Thomas D. Dean<tomdean@speakeasy.org>  wrote:
> [..]
>> gcc46 is generating 80-bit floating point instructions.
>>
>> The gcc docs state gcc46 will generate 128-bit instructions.
>>
>> I can get gfortran46 to generate 128-bit instructions.
>>
>> How do I get gcc46 to generate 128-bit floating point instructions?
>
> "As of gcc 4.3, a quadruple precision is also supported on x86, but as
> the nonstandard type __float128 rather than long double."
>

AS it turns out, gcc46 does not support long double.  Or, is it just 
because the port lang/gcc46 uses the system libc, which is gcc 4.2.1?

#include <quadmath.h>
#include <stdio.h>
int main() {
   __float128 f128;
   long double ld;
   char s[512];

   f128 = (__float128)1.0;
   f128 += ((__float128)2.0) * FLT128_EPSILON;
   ld = (long double)f128;

   quadmath_snprintf(s, sizeof s, "%.70Qe", f128);
   printf("%s\n%.70Le\n",s,ld);
   if (ld != f128) printf("not equal\n");

   return 0;
}

 > env | grep LD
LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib/gcc46:/lib
 > which gcc46
/usr/local/bin/gcc46
 > locate libquadmath.so
/usr/local/lib/gcc46/libquadmath.so
/usr/local/lib/gcc46/libquadmath.so.0

 > gcc46 -march=corei7 -msse2 -Wall quadtest.c -o quadtest -lquadmath
 > ./quadtest
1.0000000000000000000000000000000003851859888774471706111955885169854637e+00
1.0000000000000000000000000000000000000000000000000000000000000000000000e+00
not equal

Oops!

Tom Dean



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F3EC0B4.6050107>