Re: Clang as default compiler November 4th

From: Warner Losh <imp_at_bsdimp.com>
Date: Sat, 15 Sep 2012 10:03:22 -0600
On Sep 15, 2012, at 3:14 AM, Roman Divacky wrote:

> LLVM by default turns these:
> 
>    case LibFunc::copysign:  case LibFunc::copysignf:  case LibFunc::copysignl:
>    case LibFunc::fabs:      case LibFunc::fabsf:      case LibFunc::fabsl:
>    case LibFunc::sin:       case LibFunc::sinf:       case LibFunc::sinl:
>    case LibFunc::cos:       case LibFunc::cosf:       case LibFunc::cosl:
>    case LibFunc::sqrt:      case LibFunc::sqrtf:      case LibFunc::sqrtl:
>    case LibFunc::floor:     case LibFunc::floorf:     case LibFunc::floorl:
>    case LibFunc::nearbyint: case LibFunc::nearbyintf: case LibFunc::nearbyintl:
>    case LibFunc::ceil:      case LibFunc::ceilf:      case LibFunc::ceill:
>    case LibFunc::rint:      case LibFunc::rintf:      case LibFunc::rintl:
>    case LibFunc::trunc:     case LibFunc::truncf:     case LibFunc::truncl:
>    case LibFunc::log2:      case LibFunc::log2f:      case LibFunc::log2l:
>    case LibFunc::exp2:      case LibFunc::exp2f:      case LibFunc::exp2l:
> 
> from lib calls to direct code (ie. instruction or sequence of). This is not a "bug"
> but feature ;)
> 
> I am not sure what the rules for the transformation should be. Allow it only with
> -ffast-math ? Disallow it on i386? Really, no idea.

In the past, gcc has only done this with -ffast-math, but my 'in the past' is a long time ago...

> Steve, you tested on i386? Can you test on amd64?
> 
> Do you guys have any opinion what to do here?
> 
> On Fri, Sep 14, 2012 at 06:06:00PM -0700, Steve Kargl wrote:
>> On Fri, Sep 14, 2012 at 05:18:08PM -0700, Steve Kargl wrote:
>>> 
>>> A third class of failure appears to be that clang emits
>>> i387 fpu instructions for at least sinf and cosf instead 
>>> of calls to the library routines.  AFAIK, the library
>>> routines are faster and more accurate.
>>> 
>> 
>> Yep. Clang has problems with at least sinf on i386 FreeBSD.
>> 
>> % pwd
>> /usr/home/kargl/trunk/math/sine
>> 
>> % make clean && make CC=cc testf
>> cc -o testf -O2 -pipe -static -I/usr/local/include -I../mp testf.c \
>> -L/usr/local/lib -L../mp -lsgk -lmpfr -lgmp -lm
>> 
>> % ./testf -m 0 -M 1e20 -r
>> ULP Range |
>> -----------+-------------------------
>> [0.0:0.6] | 1006424    (100.00%)
>> (0.6:0.7] | 0  ( 0.00%)
>> (0.7:0.8] | 0  ( 0.00%)
>> (0.8:0.9] | 0  ( 0.00%)
>> (0.9:1.0] | 0  ( 0.00%)
>> (1.0:2.0] | 0  ( 0.00%)
>> (2.0:3.0] | 0  ( 0.00%)
>> 3.0 < ULP | 0  ( 0.00%)
>> -----------+-------------------------
>>   Count   | 1006424
>>   Max ULP | 0.50084
>> Max ULP x | 53462490661259313152.000000 0x1.72f876p+65
>> 
>> % make clean && make CC=clang testf
>> clang -o testf -O2 -pipe -static -I/usr/local/include -I../mp testf.c \
>> -L/usr/local/lib -L../mp -lsgk -lmpfr -lgmp -lm
>> 
>> % ./testf -m 0 -M 1e20 -r
>> ULP Range |
>> -----------+-------------------------
>> [0.0:0.6] | 1  ( 0.00%)
>> (0.6:0.7] | 0  ( 0.00%)
>> (0.7:0.8] | 0  ( 0.00%)
>> (0.8:0.9] | 0  ( 0.00%)
>> (0.9:1.0] | 0  ( 0.00%)
>> (1.0:2.0] | 0  ( 0.00%)
>> (2.0:3.0] | 0  ( 0.00%)
>> 3.0 < ULP | 999998     (100.00%)
>> -----------+-------------------------
>>   Count   | 999999
>>   Max ULP | 1328505256679420125050194353979392.00000
>> Max ULP x | 75516780764213542912.000000 0x1.06006p+66
>> 
>> -- 
>> Steve
>> _______________________________________________
>> freebsd-current_at_freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-current
>> To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"
> _______________________________________________
> freebsd-toolchain_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
> To unsubscribe, send any mail to "freebsd-toolchain-unsubscribe_at_freebsd.org"
Received on Sat Sep 15 2012 - 14:03:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:30 UTC