From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32150 invoked by alias); 29 Oct 2015 13:09:17 -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 32137 invoked by uid 89); 29 Oct 2015 13:09:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qk0-f173.google.com Received: from mail-qk0-f173.google.com (HELO mail-qk0-f173.google.com) (209.85.220.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 29 Oct 2015 13:09:06 +0000 Received: by qkbl190 with SMTP id l190so16632131qkb.2 for ; Thu, 29 Oct 2015 06:09:04 -0700 (PDT) X-Received: by 10.55.212.157 with SMTP id s29mr2014633qks.100.1446124144350; Thu, 29 Oct 2015 06:09:04 -0700 (PDT) Received: from msticlxl57.ims.intel.com (jfdmzpr01-ext.jf.intel.com. [134.134.139.70]) by smtp.gmail.com with ESMTPSA id u89sm518401qkl.27.2015.10.29.06.09.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Oct 2015 06:09:03 -0700 (PDT) Date: Thu, 29 Oct 2015 13:13:00 -0000 From: Ilya Enkovich To: Bill Schmidt Cc: Christophe Lyon , gcc-patches Subject: Re: [Boolean Vector, patch 1/5] Introduce boolean vector to be used as a vector comparison type Message-ID: <20151029130803.GB63456@msticlxl57.ims.intel.com> References: <20151022162105.GB23452@msticlxl57.ims.intel.com> <20151023111240.GC23452@msticlxl57.ims.intel.com> <1446050893.7184.0.camel@oc8801110288.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg03158.txt.bz2 On 28 Oct 22:37, Ilya Enkovich wrote: > Seems the problem occurs in this check in expand_vector_operations_1: > > /* A scalar operation pretending to be a vector one. */ > if (VECTOR_BOOLEAN_TYPE_P (type) > && !VECTOR_MODE_P (TYPE_MODE (type)) > && TYPE_MODE (type) != BLKmode) > return; > > This is to filter out scalar operations on boolean vectors. > The problem here is that TYPE_MODE (type) doesn't return > V4SImode assigned to the type but calls vector_type_mode > instead which tries to find an integer mode for it and returns > TImode. This causes function exit and we don't expand vector > comparison. > > Suppose simple option to fix it is to change default get_mask_mode > hook to return BLKmode in case chosen integer vector mode is not > vector_mode_supported_p. > > Thanks, > Ilya > Here is a patch which fixes the problem on ARM (and on i386 with -mno-sse also). I checked it fixes the problem on ARM and also bootstrapped and checked it on x86_64-unknown-linux-gnu. Is it OK? Thanks, Ilya -- gcc/ 2015-10-29 Ilya Enkovich * targhooks.c (default_get_mask_mode): Use BLKmode in case target doesn't support required vector mode. * stor-layout.c (layout_type): Check for BLKmode. diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 58ecd7b..ae7d6fb 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -2185,7 +2185,8 @@ layout_type (tree type) TYPE_SATURATING (type) = TYPE_SATURATING (TREE_TYPE (type)); TYPE_UNSIGNED (type) = TYPE_UNSIGNED (TREE_TYPE (type)); /* Several boolean vector elements may fit in a single unit. */ - if (VECTOR_BOOLEAN_TYPE_P (type)) + if (VECTOR_BOOLEAN_TYPE_P (type) + && type->type_common.mode != BLKmode) TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (type->type_common.mode)); else diff --git a/gcc/targhooks.c b/gcc/targhooks.c index c39f266..d378864 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -1095,10 +1095,16 @@ default_get_mask_mode (unsigned nunits, unsigned vector_size) unsigned elem_size = vector_size / nunits; machine_mode elem_mode = smallest_mode_for_size (elem_size * BITS_PER_UNIT, MODE_INT); + machine_mode vector_mode; gcc_assert (elem_size * nunits == vector_size); - return mode_for_vector (elem_mode, nunits); + vector_mode = mode_for_vector (elem_mode, nunits); + if (VECTOR_MODE_P (vector_mode) + && !targetm.vector_mode_supported_p (vector_mode)) + vector_mode = BLKmode; + + return vector_mode; } /* By default, the cost model accumulates three separate costs (prologue,