From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81145 invoked by alias); 13 Oct 2017 09:21:55 -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 80389 invoked by uid 89); 13 Oct 2017 09:21:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f65.google.com Received: from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com) (74.125.82.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Oct 2017 09:21:53 +0000 Received: by mail-wm0-f65.google.com with SMTP id u138so19681667wmu.5 for ; Fri, 13 Oct 2017 02:21:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=uBv1JlUslsAUyCTQEjzq5E8lGvO6y7+bD6NPncA1b7M=; b=RaRiQgAETaQcTLjPiG3vlL3JXn5gddGNLTziwvM+Mi7si4RvGW/l6SxcA+PVpEAXMh qprm/pOHZ8Vk841hM1Vperop4hf1W2X1M+sLxWMmh8Mhss1WaANnLNp9X0vhIz8+hPWJ MF3Yja8tKwR3Cxh8ylBtxW97Do+jd/KZCaJ6fmCgrnjAzVdOa8+R1YaE5nRkQ5ez8xvw gRGoU13keURrYuDHWv+0xreyNJbKTxuf6kjZPItVXlIMSUTnmOdspMaAp4MkWkGAUSDZ chvnO0Hj0NaGLWiI2IRHr0Z12FAip+3E2iKoVW0QD2uJgORD55ns8/vQ0ex6r4Qc6EDv l7mg== X-Gm-Message-State: AMCzsaXV5aMOJDHUD1aB6VZcoKW7TUByO1oY8YOQPcNpwqd7zaNdp2uX FY+6IMK6jH1JdtcKhPnNYqHs8h8EfpU/KBqra7c= X-Google-Smtp-Source: AOwi7QAWk60rY+0ZDNWsNjKv7GFaVa/sqQVrmjrhmNG1uBsGUG/jfOb7AtfO0ZliEct1nN2hQRhuhiR1F/K/4eFNMWk= X-Received: by 10.80.145.39 with SMTP id e36mr1356868eda.182.1507886511126; Fri, 13 Oct 2017 02:21:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.143.34 with HTTP; Fri, 13 Oct 2017 02:21:50 -0700 (PDT) In-Reply-To: <1507838577.26707.176.camel@brimstone.rchland.ibm.com> References: <1507838577.26707.176.camel@brimstone.rchland.ibm.com> From: Richard Biener Date: Fri, 13 Oct 2017 09:26:00 -0000 Message-ID: Subject: Re: [PATCH] (gimple) Allow integer return type from vector compares To: will_schmidt@vnet.ibm.com Cc: GCC Patches , Segher Boessenkool , Bill Schmidt , David Edelsohn Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00836.txt.bz2 On Thu, Oct 12, 2017 at 10:02 PM, Will Schmidt wrote: > Hi, > > Update the logic in verify_gimple_comparision to allow a vector integer result > from a vector comparison, where it previously was limited to only allowing > compares with boolean results. This allows powerpc intrinsics such as this > one to build (after gimple folding): > vector bool int vec_cmpeq (vector signed int, vector signed int); > > This has been tested in conjunction with the "rs6000 GIMPLE folding for vector > compares" patch (posted separately) on p6 and newer. > > OK for trunk? Well. It was this way before AVX512 introduced those vector boolean types. There we decided to have comparisons always return a boolean vector. Previously there was an additional restriction in that the vector elements of the boolean result had to be the same size as the elements of the comparison operands. You are now supposed to use the "canonical" _1 = _2 != _3 ? { your true value vector } : { your false value vector}; with a VEC_COND_EXPR. Richard. > Thanks, > -Will > > [gcc] > > 2017-10-12 Will Schmidt > > * gcc/tree-cfg.c: (@ verify_gimple_comparison ): allow boolean result > from vector compares. > > diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c > index b5e0460..adf3607 100644 > --- a/gcc/tree-cfg.c > +++ b/gcc/tree-cfg.c > @@ -3624,14 +3624,16 @@ verify_gimple_comparison (tree type, tree op0, tree op1, enum tree_code code) > debug_generic_expr (op0_type); > debug_generic_expr (op1_type); > return true; > } > } > - /* Or a boolean vector type with the same element count > - as the comparison operand types. */ > + /* Or a vector type with the same element count > + as the comparison operand types. The vector type may > + be boolean or integer. */ > else if (TREE_CODE (type) == VECTOR_TYPE > - && TREE_CODE (TREE_TYPE (type)) == BOOLEAN_TYPE) > + && (( TREE_CODE (TREE_TYPE (type)) == BOOLEAN_TYPE) > + || ( TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE))) > { > if (TREE_CODE (op0_type) != VECTOR_TYPE > || TREE_CODE (op1_type) != VECTOR_TYPE) > { > error ("non-vector operands in vector comparison"); > >