From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32114 invoked by alias); 15 Nov 2016 11:19:31 -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 32101 invoked by uid 89); 15 Nov 2016 11:19:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_50,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=CMPRB, CMBRB2, sk:bytein, setb 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 ESMTP; Tue, 15 Nov 2016 11:19:21 +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 uAFBJF2a014303; Tue, 15 Nov 2016 05:19:15 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id uAFBJD1p014297; Tue, 15 Nov 2016 05:19:13 -0600 Date: Tue, 15 Nov 2016 11:19:00 -0000 From: Segher Boessenkool To: Kelvin Nilsen Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH,rs6000] Add built-in function support for Power9 byte instructions Message-ID: <20161115111912.GC12325@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg01421.txt.bz2 Hi! On Mon, Nov 14, 2016 at 04:43:35PM -0700, Kelvin Nilsen wrote: > * config/rs6000/altivec.md (UNSPEC_CMPRB): New unspec value. > (UNSPEC_CMPRB2): New unspec value. I wonder if you really need both? The number of arguments will tell which is which, anyway? > (cmprb_p): New expansion. Not such a great name (now you get a gen_cmprb_p function which isn't a predicate itself). > (CMPRB): Add byte-in-range built-in function. > (CMBRB2): Add byte-in-either_range built-in function. > (CMPEQB): Add byte-in-set builtin-in function. "builtin-in", and you typoed an underscore? > +;; Predicate: test byte within range. > +;; Return in target register operand 0 a non-zero value iff the byte > +;; held in bits 24:31 of operand 1 is within the inclusive range > +;; bounded below by operand 2's bits 0:7 and above by operand 2's > +;; bits 8:15. > +(define_expand "cmprb_p" It seems you got the bit numbers mixed up. Maybe just call it the low byte, and the byte just above? (And it always sets 0 or 1 here, you might want to make that more explicit). > +;; Set bit 1 (the GT bit, 0x2) of CR register operand 0 to 1 iff the That's 4, i.e. 0b0100. > +;; Set operand 0 register to non-zero value iff the CR register named > +;; by operand 1 has its GT bit (0x2) or its LT bit (0x1) set. > +(define_insn "*setb" LT is 8, GT is 4. If LT is set it returns -1, otherwise if GT is set it returns 1, otherwise it returns 0. > +;; Predicate: test byte within two ranges. > +;; Return in target register operand 0 a non-zero value iff the byte > +;; held in bits 24:31 of operand 1 is within the inclusive range > +;; bounded below by operand 2's bits 0:7 and above by operand 2's > +;; bits 8:15 or if the byte is within the inclusive range bounded > +;; below by operand 2's bits 16:23 and above by operand 2's bits 24:31. > +(define_expand "cmprb2_p" The high bound is higher in the reg than the low bound. See the example where 0x3930 is used to do isdigit (and yes 0x3039 would be much more fun, but alas). > +;; Predicate: test byte membership within set of 8 bytes. > +;; Return in target register operand 0 a non-zero value iff the byte > +;; held in bits 24:31 of operand 1 equals at least one of the eight > +;; byte values represented by the 64-bit register supplied as operand > +;; 2. Note that the 8 byte values held within operand 2 need not be > +;; unique. (trailing space) I wonder if we really need all these predicate expanders, if it wouldn't be easier if the builtin handling code did the setb itself? Segher