From patchwork Wed Sep 28 14:23:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 116795 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 74295B6F72 for ; Thu, 29 Sep 2011 00:23:45 +1000 (EST) Received: (qmail 17631 invoked by alias); 28 Sep 2011 14:23:43 -0000 Received: (qmail 17621 invoked by uid 22791); 28 Sep 2011 14:23:41 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-yi0-f47.google.com (HELO mail-yi0-f47.google.com) (209.85.218.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Sep 2011 14:23:26 +0000 Received: by yia27 with SMTP id 27so7213206yia.20 for ; Wed, 28 Sep 2011 07:23:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.237.21 with SMTP id k21mr8480869ybh.10.1317219805541; Wed, 28 Sep 2011 07:23:25 -0700 (PDT) Received: by 10.150.177.4 with HTTP; Wed, 28 Sep 2011 07:23:25 -0700 (PDT) In-Reply-To: References: Date: Wed, 28 Sep 2011 16:23:25 +0200 Message-ID: Subject: Re: Vector Comparison patch From: Richard Guenther To: "Joseph S. Myers" Cc: Artem Shinkarov , Uros Bizjak , Richard Henderson , gcc-patches@gcc.gnu.org X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Mon, Sep 26, 2011 at 5:43 PM, Richard Guenther wrote: > On Mon, Sep 26, 2011 at 4:25 PM, Richard Guenther > wrote: >> On Wed, Sep 7, 2011 at 5:06 PM, Joseph S. Myers wrote: >>> This looks like it has the same issue with maybe needing to use >>> TYPE_MAIN_VARIANT in type comparisons as the shuffle patch. >> >> I don't think so, we move qualifiers to the vector type from the element type >> in make_vector_type and the tests only look at the component type. >> >> I am re-testing the patch currently and will commit it if that succeeds. > > Unfortunately gcc.c-torture/execute/vector-compare-1.c fails with -m32 > for > >    vector (2, double) d0; >    vector (2, double) d1; >    vector (2, long) idres; > >    d0 = (vector (2, double)){(double)argc,  10.}; >    d1 = (vector (2, double)){0., (double)-23}; >    idres = (d0 > d1); > > as appearantly the type we chose to assign to (d0 > d1) is different > from that of idres: > > /space/rguenther/src/svn/trunk/gcc/testsuite/gcc.c-torture/execute/vector-compare-1.c:118:5: > error: incompatible types when assigning to type '__vector(2) long > int' from type '__vector(2) long long int'^M > > Adjusting it to vector (2, long long) otoh yields, for -m64: > > /space/rguenther/src/svn/trunk/gcc/testsuite/gcc.c-torture/execute/vector-compare-1.c:118:5: > error: incompatible types when assigning to type '__vector(2) long > long int' from type '__vector(2) long int' > > But those two types are at least compatible from their modes.  Joseph, > should we accept mode-compatible types in assignments or maybe > transparently convert them? Looks like we have a more suitable solution for these automatically generated vector types - mark them with TYPE_VECTOR_OPAQUE. I'm testing the following incremental patch. Richard. } @@ -10063,8 +10065,10 @@ build_binary_op (location_t location, en } /* Always construct signed integer vector type. */ - intt = c_common_type_for_size (TYPE_PRECISION (TREE_TYPE (type0)), 0); - result_type = build_vector_type (intt, TYPE_VECTOR_SUBPARTS (type0)); + intt = c_common_type_for_size (GET_MODE_BITSIZE + (TYPE_MODE (TREE_TYPE (type0))), 0); + result_type = build_opaque_vector_type (intt, + TYPE_VECTOR_SUBPARTS (type0)); converted = 1; break; } Index: gcc/c-typeck.c =================================================================== --- gcc/c-typeck.c.orig 2011-09-28 16:22:10.000000000 +0200 +++ gcc/c-typeck.c 2011-09-28 16:18:39.000000000 +0200 @@ -9928,8 +9928,10 @@ build_binary_op (location_t location, en } /* Always construct signed integer vector type. */ - intt = c_common_type_for_size (TYPE_PRECISION (TREE_TYPE (type0)), 0); - result_type = build_vector_type (intt, TYPE_VECTOR_SUBPARTS (type0)); + intt = c_common_type_for_size (GET_MODE_BITSIZE + (TYPE_MODE (TREE_TYPE (type0))), 0); + result_type = build_opaque_vector_type (intt, + TYPE_VECTOR_SUBPARTS (type0)); converted = 1; break;