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 927593858C3A for ; Wed, 20 Oct 2021 16:20:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 927593858C3A 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 19KGJ0I4026783; Wed, 20 Oct 2021 11:19:00 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 19KGJ0OB026782; Wed, 20 Oct 2021 11:19:00 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 20 Oct 2021 11:19:00 -0500 From: Segher Boessenkool To: HAO CHEN GUI Cc: gcc-patches , David , Bill Schmidt Subject: Re: [PATCH, rs6000] Disable gimple fold for float or double vec_minmax when fast-math is not set Message-ID: <20211020161900.GS614@gate.crashing.org> References: <787f0d5d-a8f5-c513-997f-a5b906951da4@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <787f0d5d-a8f5-c513-997f-a5b906951da4@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, BODY_8BITS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Oct 2021 16:20:03 -0000 Hi! On Wed, Oct 20, 2021 at 05:04:56PM +0800, HAO CHEN GUI wrote: > This patch disables gimple folding for float or double vec_min/max when fast-math is not set. It makes vec_min/max conform with the guide. > > Bootstrapped and tested on powerpc64le-linux with no regressions. Is this okay for trunk? Any recommendations? Thanks a lot. > >   I refined the patch according to reviewers' advice. The attachments are > the ChangeLog and patch diff in case the email body is messed up. > > > ChangeLog > > 2021-10-20 Haochen Gui > > gcc/ >         * config/rs6000/rs6000-call.c (rs6000_gimple_fold_builtin): >         Disable gimple fold for VSX_BUILTIN_XVMINDP, > ALTIVEC_BUILTIN_VMINFP, >         VSX_BUILTIN_XVMAXDP, ALTIVEC_BUILTIN_VMAXFP when fast-math > is not >         set. Content-Type: text/plain; charset=UTF-8; format=flowed Please don't use flowed. It makes patches unreadable and unusable if you do (they will not apply anymore). Also, the left border should be one tab, not eight spaces, and the right border is at 80 chars (so there are 72 usable chars on a line). Don't end a line in ":" if you don't overflow a line if you put text after it. > --- a/gcc/config/rs6000/rs6000-call.c > +++ b/gcc/config/rs6000/rs6000-call.c > @@ -12159,6 +12159,14 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator > *gsi) >        return true; >      /* flavors of vec_min.  */ >      case VSX_BUILTIN_XVMINDP: > +    case ALTIVEC_BUILTIN_VMINFP: > +      { > +       lhs = gimple_call_lhs (stmt); > +       tree type = TREE_TYPE (lhs); > +       if (HONOR_NANS (type) || HONOR_SIGNED_ZEROS (type)) > +         return false; > +       gcc_fallthrough (); > +      } Both vminfp anf xvmindp (and xvminsp and xsmindp) return -0 or the minimum of +0 and -0, that is okay even with HONOR_SIGNED_ZEROS, I think? x[sv]min[sd]p returns the number for the minimum of a NaN and a number, but vminfp returns a NaN. Do you really want to make the xvmindp builtin handle less than it does currently? And, what about vminfp? Did tht do the wrong thing before? There are no tests for any of that apparently. Hrm. Segher