From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3665 invoked by alias); 4 Feb 2014 18:56:56 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 3652 invoked by uid 89); 4 Feb 2014 18:56:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-we0-f178.google.com Received: from mail-we0-f178.google.com (HELO mail-we0-f178.google.com) (74.125.82.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 04 Feb 2014 18:56:54 +0000 Received: by mail-we0-f178.google.com with SMTP id q59so4515744wes.23 for ; Tue, 04 Feb 2014 10:56:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=1qyoq9LJjAGX3qVBYVPwLuGThAlYhgc2zk/R+DGslhI=; b=DmDNlSmyeWj5BQH91+3OEJIHC8y4KcOT6BHY0QD6VAhWQEeYbUWvXNDfEgPRvEsJ4A epf3CfnJauqnprWFpUvSXSzsQLK7sE1IXxQGaUW64U0FdTrNoJy3T91Y2GGENH0WimZ6 mwBtslOL72N1cwK4li+4qJ4bSE+uCKMbEvz+NEcbU6fRqujJnhXN9hDMYyfRzvqyXGz3 BiycJtRb0DdJLRFv+O1k8TLRmCyInS6Jk1yJTPece1K0z194PCA+c3QXhnhhaBnp/zXl EOQgqjoFJIbXasaNSep9R0eekmUoPdUMRssV6ju7fCeUhHKwjI0wkVCCQocLqPfBxaML 9CNA== X-Gm-Message-State: ALoCoQmcLURbFUct3dOTfu3Eishtt020NluWyBPnxqCAjE3CkslJ5A/Wmg6FsHeRKo2zXQVRV3EllsGSf/paoCUS1dX0Z5cfM/pV55qAQtbt/jYr80uhRp+IIe7YqQ4yHqw0zfq16+rPAJ6B6qcCT143R1OWUcty3aWHc8//VCsAfJEm6sBCHUrLvcjrQ+OxboLn3mQb2UMs MIME-Version: 1.0 X-Received: by 10.180.12.115 with SMTP id x19mr14029387wib.19.1391540210736; Tue, 04 Feb 2014 10:56:50 -0800 (PST) Received: by 10.180.96.74 with HTTP; Tue, 4 Feb 2014 10:56:50 -0800 (PST) In-Reply-To: References: Date: Tue, 04 Feb 2014 18:56:00 -0000 Message-ID: Subject: Re: Merge epilog loop & loop version due to alias/alignment in vectorization? From: Xinliang David Li To: Bingfeng Mei Cc: "gcc@gcc.gnu.org" , Cong Hou Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00031.txt.bz2 See also http://gcc.gnu.org/ml/gcc/2013-08/msg00259.html There are some concerns, but it would be interesting to do some benchmarking of this. David On Tue, Feb 4, 2014 at 8:27 AM, Bingfeng Mei wrote: > Hi, > One of biggest issues we have with GCC vectorization is bloated code size. > For example, vectorized version is 2.5 times of non-vectorized one for the > following simple code. One reason is that GCC often creates one loop copy > because of aliasing/alignment and one epilog loop because of loop iteration > constraint. > > void foo (int *a, int *b, int N) > { > int i; > for (i = 0; i < N; i++) > { > a[i] = b[i]; > } > } > > Looking closely, the epilog loop and alignement/aliasing loop are almost > identical, just different in initial values for some variables entering > the loop. Can they be merged into one in such situations? If yes, any > suggestion on how to implement it? > > ... > : > # i_39 = PHI > _41 = (long unsigned int) i_39; > _42 = _41 * 4; > _43 = a_7(D) + _42; > _44 = b_9(D) + _42; > _45 = *_44; > *_43 = _45; > i_47 = i_39 + 1; > if (N_4(D) > i_47) > goto ; > else > goto ; > > : > goto ; > > : > # i_51 = PHI > tmp.6_56 = (int) ratio_mult_vf.5_38; > if (niters.3_34 == ratio_mult_vf.5_38) > goto ; > else > goto ; > > : > # i_50 = PHI > goto ; > > : > goto ; > > : > > : > # i_24 = PHI <0(12), i_32(14)> > _26 = (long unsigned int) i_24; > _27 = _26 * 4; > _28 = a_7(D) + _27; > _29 = b_9(D) + _27; > _30 = *_29; > *_28 = _30; > i_32 = i_24 + 1; > if (N_4(D) > i_32) > goto ; > else > goto ; > ... > > Thanks, > Bingfeng