From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/15092 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] math: move x86_64 fabs, fabsf to C with inline asm Date: Mon, 6 Jan 2020 11:17:44 +0300 (MSK) Message-ID: References: <20200105163639.25963-1-amonakov@ispras.ru> <20200105200541.GM30412@brightrain.aerifal.cx> <20200105224354.GN30412@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="199783"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) To: musl@lists.openwall.com Original-X-From: musl-return-15108-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jan 06 09:17:59 2020 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1ioNaJ-000pp6-6p for gllmg-musl@m.gmane.org; Mon, 06 Jan 2020 09:17:59 +0100 Original-Received: (qmail 5184 invoked by uid 550); 6 Jan 2020 08:17:56 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 5162 invoked from network); 6 Jan 2020 08:17:55 -0000 In-Reply-To: <20200105224354.GN30412@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:15092 Archived-At: On Sun, 5 Jan 2020, Rich Felker wrote: > I'm not sure if "this logic" carries over. fabs is a common operation > (ideally compiler would inline it anyway in the caller, though). > copysign not so much. Indeed, in practice we want compilers to recognize and inline simple math functions, especially on x86 where all float registers are call-clobbered. This makes it moot, except maybe for musl-internal uses like in floatscan.c, but there the right solution is probably to use __builtin_ forms if available. (to be clear: I think musl may not implement math functions in terms of math builtins because it might result in a circular dependency, but using builtins for complex math and higher-level functions like in floatscan.c should be fair game) For functions like sqrt GCC can be changed to default to -fno-math-errno on *-musl targets, as progress on flipping it globally seems slow. > Really I'm not even sure it makes sense to have the asm here at all > for fabs either, but perhaps with the gratuitous stack access in the > older-GCC version it does...? That's why I'm asking, the situation just looks ambiguous to me, I can't deduce the intent and I could imagine arguments both ways. I think I'd prefer a more inclusive playground. Please come up with some policy or guidelines if possible. Alexander