From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30473 invoked by alias); 9 May 2016 14:31:52 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 30463 invoked by uid 89); 9 May 2016 14:31:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=letter X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 09 May 2016 14:31:47 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id u49EViDO003573; Mon, 9 May 2016 09:31:44 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id u49EVhkS003572; Mon, 9 May 2016 09:31:43 -0500 Date: Mon, 09 May 2016 14:31:00 -0000 From: Segher Boessenkool To: Michael Meissner , gcc-patches@gcc.gnu.org, David Edelsohn , Bill Schmidt Subject: Re: [PATCH], Add PowerPC ISA 3.0 min/max support Message-ID: <20160509143143.GC31139@gate.crashing.org> References: <20160505191839.GA7023@ibm-tiger.the-meissners.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160505191839.GA7023@ibm-tiger.the-meissners.org> User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2016-05/txt/msg00634.txt.bz2 On Thu, May 05, 2016 at 03:18:39PM -0400, Michael Meissner wrote: > At the present time, the code does not support comparisons involving >= and <= > unless the -ffast-math option is used. I hope eventually to support generating > these instructions without having -ffast-math used. > > The underlying reason is when fast math is not used, we change the condition > from: > > (ge:SI (reg:CCFP ) (const_int 0)) > > to: > > (ior:SI (gt:SI (reg:CCFP ) (const_int 0)) > (eq:SI (reg:CCFP ) (const_int 0))) > > The machine independent portion of the compiler does not recognize this when > trying to generate conditional moves. > > I would imagine the 'fix' is to generate GE/LE all of the time, and then have a > splitter that converts it to IOR of GT/EQ if it is not a conditional move with > ISA 3.0 instructions. That sounds like a plan :-) > -;; Return true if operand is MIN or MAX operator. > +;; Return true if operand is MIN or MAX operator. Since this is only used to > +;; convert floating point MIN/MAX operations into FSEL on pre-vsx systems, > +;; don't include UMIN or UMAX. > (define_predicate "min_max_operator" > - (match_code "smin,smax,umin,umax")) > + (match_code "smin,smax")) Please name it signed_min_max_operator instead? > --- gcc/config/rs6000/rs6000.c (.../svn+ssh://meissner@gcc.gnu.org/svn/gcc/trunk/gcc/config/rs6000) (revision 235831) > +++ gcc/config/rs6000/rs6000.c (.../gcc/config/rs6000) (working copy) > @@ -20534,6 +20534,12 @@ print_operand (FILE *file, rtx x, int co > "local dynamic TLS references"); > return; > > + case '@': > + /* If -mpower9-minmax, use xsmaxcpdp instead of xsmaxdp. */ > + if (TARGET_P9_MINMAX) > + putc ('c', file); > + return; I don't think @ is very mnemonic, nor is this special enough for such a nice letter. Form looking at how it is used, it seems you can make it part of code_attr minmax (and give that a better name, minmax_fp or such)? > + rs6000_emit_minmax (dest, (max_p) ? SMAX : SMIN, op0, op1); Superfluous parentheses. > +rs6000_emit_power9_cmove (rtx dest, rtx op, rtx true_cond, rtx false_cond) Maybe put some "fp" in the name? For "minmax" as well. > + if (swap_p) > + compare_rtx = gen_rtx_fmt_ee (code, CCFPmode, op1, op0); > + else > + compare_rtx = gen_rtx_fmt_ee (code, CCFPmode, op0, op1); if (swap_p) std::swap (op0, op1); and then just generate the one form? Segher