From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20958 invoked by alias); 21 Oct 2011 09:26:39 -0000 Received: (qmail 20940 invoked by uid 22791); 21 Oct 2011 09:26:37 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Oct 2011 09:26:22 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9L9QLfu001786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Oct 2011 05:26:22 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9L9QKvE026944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 Oct 2011 05:26:21 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p9L9QKEU015105; Fri, 21 Oct 2011 11:26:20 +0200 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p9L9QJWt015104; Fri, 21 Oct 2011 11:26:19 +0200 Date: Fri, 21 Oct 2011 09:55:00 -0000 From: Jakub Jelinek To: Richard Guenther Cc: Richard Guenther , Ira Rosen , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Extend vect_recog_bool_pattern also to stores into bool memory (PR tree-optimization/50596) Message-ID: <20111021092619.GQ2210@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <20111019171440.GE2210@tyan-ft48-01.lab.bos.redhat.com> <20111020103154.GJ2210@tyan-ft48-01.lab.bos.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 X-SW-Source: 2011-10/txt/msg01942.txt.bz2 On Fri, Oct 21, 2011 at 11:19:32AM +0200, Richard Guenther wrote: > I'll try to poke at that a bit, thus support general bit-precision types for > loads and stores and the few operations that are safe on them. If you > have a store to a bool like > > int *a, *b; > _Bool *c; > > for (;;) > c[i] = a[i] < b[i]; > > will the compare choose an int vector type and then demote it to > char for the store? Yes. The pattern recognizer would turn this into: int *a, *b; for (;;) { int tmp = a[i] < b[i] ? 1 : 0; ((char *)c)[i] = (char) tmp; // Still using _Bool for TBAA purposes } > I suppose trying to generally handle loads/stores > for these types shouldn't interfere too much with this. But I'll see ... If you manage to get the generic stuff working (remove the condition from get_vectype_from_scalar_type about TYPE_PRECISION and handle what is needed), then vect_recog_bool_pattern would need to be adjusted slightly (to not start on a cast from some kind of bool to another kind of bool, which now results in return NULL because get_vectype_from_scalar_type returns NULL_TREE) and from the patch I've posted we'd need just the tree-vect-patterns.c bits (adjusted as you say to unconditionally create VCE instead of special casing MEM_REF, and additionally attempting to use signed instead of unsigned type to avoid unnecessary casts) and something in vectorizable_store so that it doesn't fail on VCEs, at least not in pattern stmts. Jakub