From owner-freebsd-toolchain@freebsd.org Wed Mar 13 15:56:54 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 56D5E1537CAC; Wed, 13 Mar 2019 15:56:54 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5274E85EAA; Wed, 13 Mar 2019 15:56:53 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [176.74.212.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 2ACB4260306; Wed, 13 Mar 2019 16:56:50 +0100 (CET) Subject: Re: Optimization bug with floating-point? To: sgk@troutmask.apl.washington.edu Cc: freebsd-toolchain@freebsd.org, freebsd-current@freebsd.org 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> From: Hans Petter Selasky Message-ID: Date: Wed, 13 Mar 2019 16:56:26 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190313155009.GA34852@troutmask.apl.washington.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 5274E85EAA X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-4.85 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; IP_SCORE(-2.57)[ip: (-8.71), ipnet: 2a01:4f8::/29(-2.18), asn: 24940(-1.94), country: DE(-0.01)]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: mail.turbocat.net]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; SUBJECT_ENDS_QUESTION(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] 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 15:56:54 -0000 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() ? FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0) Target: x86_64-unknown-freebsd11.0 Thread model: posix InstalledDir: /usr/bin cc -lm -O2 -Wall test.c && ./a.out Max ULP: 2.297073 Count: 0 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 --HPS