From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id C7FF63858422 for ; Thu, 22 Sep 2022 14:06:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C7FF63858422 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 28ME5GsZ001437; Thu, 22 Sep 2022 09:05:16 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 28ME5Fag001436; Thu, 22 Sep 2022 09:05:15 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 22 Sep 2022 09:05:15 -0500 From: Segher Boessenkool To: "Kewen.Lin" Cc: HAO CHEN GUI , gcc-patches , David , Peter Bergner Subject: Re: [PATCH v6, rs6000] Implemented f[min/max]_optab by xs[min/max]dp [PR103605] Message-ID: <20220922140515.GI25951@gate.crashing.org> References: <20220921215652.GG25951@gate.crashing.org> <2c999590-8222-2879-3fe3-ca69159293ec@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2c999590-8222-2879-3fe3-ca69159293ec@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! On Thu, Sep 22, 2022 at 10:28:23AM +0800, Kewen.Lin wrote: > on 2022/9/22 05:56, Segher Boessenkool wrote: > > On Fri, Jun 24, 2022 at 10:02:19AM +0800, HAO CHEN GUI wrote: > > In the other direction I am worried that the unspecs will degrade > > performance (relative to smin/smax) when -ffast-math *is* active (and > > this new builtin code and pattern doesn't blow up). > > For fmin/fmax it would be fine, since they are transformed to {MAX,MIN} > EXPR in middle end, and yes, it can degrade for the bifs, although IMHO > the previous expansion to smin/smax contradicts with the bif names (users > expect to map them to xs{min,max}dp than others). But builtins *never* say to generate any particular instruction. They say to generate code that implements certain functionality. For many builtins this does of course boil down to specific instructions, but even then it could be optimised away completely or replace with something more specific if things can be folded or such. > > I still think we should get RTL codes for this, to have access to proper > > floating point min/max semantics always and everywhere. "fmin" and > > "fmax" seem to be good names :-) > > It would be good, especially if we have observed some uses of these bifs > and further opportunities around them. :) Currently we only have smin/smax for float, and those are not valid for NaNs, or when the sign of zeros is relevant. On the other hand the semantics of fmin/fmax are settled and in most standards nowadays. So it is time we did this I would say :-) Segher