From owner-freebsd-toolchain@freebsd.org Wed Mar 13 16:13:43 2019 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49CB01538898; Wed, 13 Mar 2019 16:13:43 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D4DE0878D1; Wed, 13 Mar 2019 16:13:34 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id x2DGDQCX035176 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 13 Mar 2019 09:13:26 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id x2DGDQjN035171; Wed, 13 Mar 2019 09:13:26 -0700 (PDT) (envelope-from sgk) Date: Wed, 13 Mar 2019 09:13:26 -0700 From: Steve Kargl To: Hans Petter Selasky Cc: freebsd-toolchain@freebsd.org, freebsd-current@freebsd.org Subject: Re: Optimization bug with floating-point? Message-ID: <20190313161326.GA35122@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: <20190313024506.GA31746@troutmask.apl.washington.edu> <20190313151635.GA34757@troutmask.apl.washington.edu> <14ead2c2-b586-309d-947f-1395b5284dd1@selasky.org> <20190313155009.GA34852@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.2 (2019-01-07) X-Rspamd-Queue-Id: D4DE0878D1 X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [3.66 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[sgk@troutmask.apl.washington.edu]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; IP_SCORE(0.02)[ip: (0.09), ipnet: 128.95.0.0/16(0.08), asn: 73(0.01), country: US(-0.07)]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[washington.edu]; AUTH_NA(1.00)[]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.41)[0.406,0]; RCVD_IN_DNSWL_MED(-0.20)[21.76.95.128.list.dnswl.org : 127.0.11.2]; MX_GOOD(-0.01)[cached: troutmask.apl.washington.edu]; NEURAL_SPAM_LONG(0.92)[0.915,0]; NEURAL_SPAM_MEDIUM(0.63)[0.628,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:73, ipnet:128.95.0.0/16, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_LAST(0.00)[] X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Mar 2019 16:13:43 -0000 On Wed, Mar 13, 2019 at 04:56:26PM +0100, Hans Petter Selasky wrote: > On 3/13/19 4:50 PM, Steve Kargl wrote: > > Using sin() and cos() directly as in > > > > /* Double precision csinh() without using C's double complex.s */ > > void > > dp_csinh(double x, double y, double *re, double *im) > > { > > double c, s; > > *re = sinh(x) * cos(y); > > *im = cosh(x) * sin(y); > > } > > > > does not change the result. I'll also note that libm > > is compiled by clang, and I do not recompile it for the > > tests. Both gcc8 and cc are using the same libm. > > > > I've also tested clang of amd64 with the -m32, it fails > > as well. > > Hi, > > I cannot see this is failing with 11-stable userland. Can you check with > objdump() that clang doesn't optimise it to sincos() ? It doesn't. % nm z | grep sin U csinhf 00401360 T dp_csinh U sin U sinh > FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on > LLVM 3.8.0) > Target: x86_64-unknown-freebsd11.0 The test does not fail on x86_64 unless you add the -m32 option, which forces i386 behavior. cc --version FreeBSD clang version 7.0.1 (tags/RELEASE_701/final 349250) (based on LLVM 7.0.1) Target: x86_64-unknown-freebsd13.0 cc -fno-builtin -O2 -o z a.c -lm && ./z Max u: 2.297073 Count: 0 cc -fno-builtin -O2 -o z a.c -lm -m32 && ./z Max u: 23.061242 Count: 39 > Thread model: posix > InstalledDir: /usr/bin > > cc -lm -O2 -Wall test.c && ./a.out > Max ULP: 2.297073 > Count: 0 add -m32. > > clang40 -lm -O2 test6.c > > ./a.out > Max ULP: 2.297073 > Count: 0 > > clang50 -lm -O2 test6.c > > ./a.out > Max ULP: 2.297073 > Count: 0 > > clang60 -lm -O2 test6.c > > ./a.out > Max ULP: 2.297073 > Count: 0 -- Steve