From owner-freebsd-toolchain@FreeBSD.ORG Sat Sep 15 10:36:12 2012 Return-Path: Delivered-To: toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7DC11106566C; Sat, 15 Sep 2012 10:36:12 +0000 (UTC) (envelope-from tijl@coosemans.org) Received: from mailrelay020.isp.belgacom.be (Mailrelay020.isp.belgacom.be [195.238.6.95]) by mx1.freebsd.org (Postfix) with ESMTP id 4EB478FC0A; Sat, 15 Sep 2012 10:36:11 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EAHBZVFBbsSJD/2dsb2JhbABFDrhBgzuBCIIgAQEFViIBEAsOCgkWDwkDAgECASceBg0BBwEBiA26d4shFIZUA45pgSCVeYIsPIFY Received: from 67.34-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.34.67]) by relay.skynet.be with ESMTP; 15 Sep 2012 12:35:00 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id q8FAYxgd001311; Sat, 15 Sep 2012 12:35:00 +0200 (CEST) (envelope-from tijl@coosemans.org) Message-ID: <505459CD.2090308@coosemans.org> Date: Sat, 15 Sep 2012 12:34:53 +0200 From: Tijl Coosemans User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:14.0) Gecko/20120804 Thunderbird/14.0 MIME-Version: 1.0 To: Steve Kargl References: <20120911132410.GA87126@troutmask.apl.washington.edu> <504F4645.4070900@FreeBSD.org> <504F4A6B.4010001@coosemans.org> <504F5101.8090906@FreeBSD.org> <505101C3.70203@freebsd.org> <20120913020833.GA8255@troutmask.apl.washington.edu> <1347550332.1110.108.camel@revolution.hippie.lan> <20120913161024.GA13846@troutmask.apl.washington.edu> <20120914202319.GB5244@lor.one-eyed-alien.net> <20120915001808.GA70215@troutmask.apl.washington.edu> <20120915010600.GA70426@troutmask.apl.washington.edu> In-Reply-To: <20120915010600.GA70426@troutmask.apl.washington.edu> X-Enigmail-Version: 1.4.2 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigE4BDDEC79567F38A12DCF386" Cc: Ian Lepore , current@freebsd.org, Dimitry Andric , toolchain@freebsd.org Subject: Re: Clang as default compiler November 4th X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Sep 2012 10:36:12 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE4BDDEC79567F38A12DCF386 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 15-09-2012 03:06, 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=20 >> of calls to the library routines. AFAIK, the library >> routines are faster and more accurate. >> >=20 > Yep. Clang has problems with at least sinf on i386 FreeBSD. >=20 > % pwd > /usr/home/kargl/trunk/math/sine >=20 > % make clean && make CC=3Dcc 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 >=20 > % ./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 >=20 > % make clean && make CC=3Dclang 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 >=20 > % ./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 A ULP this big can't be because of using a built-in instead of a library call, right? Something must be wrong with clang's implementation of the built-in. The fcos/fsin instructions have a limited domain and return a value unchanged if it's outside that domain. Maybe clang doesn't check this. This error probably also explains the precision loss in j0, because it calls cos/sin. --------------enigE4BDDEC79567F38A12DCF386 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iF4EAREIAAYFAlBUWdMACgkQfoCS2CCgtitafwD/WLfHJvjHlGOSb6KI/3sotFXq aTwA3tCJrjNJw5ERZq0A/iQCvvE1YAysrqd04GnCIBqy8jwCbdXkzgenJtJQPN5+ =Vyd7 -----END PGP SIGNATURE----- --------------enigE4BDDEC79567F38A12DCF386--