From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18726 invoked by alias); 24 Jul 2011 12:02:40 -0000 Received: (qmail 18718 invoked by uid 22791); 24 Jul 2011 12:02:39 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,TW_EQ,TW_LQ,TW_QB,TW_TQ X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 24 Jul 2011 12:02:25 +0000 Received: by gxk3 with SMTP id 3so2169570gxk.20 for ; Sun, 24 Jul 2011 05:02:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.101.106.25 with SMTP id i25mr3165226anm.80.1311508944495; Sun, 24 Jul 2011 05:02:24 -0700 (PDT) Received: by 10.100.120.2 with HTTP; Sun, 24 Jul 2011 05:02:24 -0700 (PDT) In-Reply-To: References: <201107201835.p6KIZQnF011722@d06av02.portsmouth.uk.ibm.com> Date: Sun, 24 Jul 2011 14:32:00 -0000 Message-ID: Subject: Re: [patch] Fix PR tree-optimization/49771 From: Ira Rosen To: Ulrich Weigand Cc: gcc-patches@gcc.gnu.org, Patch Tracking Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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-07/txt/msg02075.txt.bz2 On 21 July 2011 15:19, Ira Rosen wrote: > On 20 July 2011 21:35, Ulrich Weigand wrote: >> >> The return value of foo with vectorization is 1249 instead >> of 1999 for some reason. > > I reproduced the failure. It occurs without Richard's > (http://gcc.gnu.org/ml/gcc-patches/2011-07/msg01022.html) and this > patches too. Obviously the vectorized loop is executed, but at the > moment I don't understand why. I'll have a better look on Sunday. Actually it doesn't choose the vectorized code. But the scalar version gets optimized in a harmful way for SPU, AFAIU. Here is the scalar loop after vrp2 : # ivtmp.42_50 =3D PHI D.4593_42 =3D (void *) ivtmp.53_32; D.4520_33 =3D MEM[base: D.4593_42, offset: 0B]; D.4521_34 =3D D.4520_33 + 1; MEM[symbol: a, index: ivtmp.42_50, offset: 0B] =3D D.4521_34; ivtmp.42_45 =3D ivtmp.42_50 + 4; if (ivtmp.42_45 !=3D 16) goto ; else goto ; and the load is changed by dom2 to: : ... D.4520_33 =3D MEM[base: vect_pa.9_19, offset: 0B]; ... where vector(4) int * vect_pa.9; And the scalar loop has no rotate for that load: .L3: lqd $13,0($2) lqx $11,$5,$3 cwx $7,$sp,$3 ai $12,$13,1 shufb $6,$12,$11,$7 stqx $6,$5,$3 ai $3,$3,4 ceqi $4,$3,16 I manually added rotqby for $13 and the result was correct (I changed the test to iterate only 4 times to make the things easier). Ira > > Ira > >> >> Bye, >> Ulrich >> >> -- >> =A0Dr. Ulrich Weigand >> =A0GNU Toolchain for Linux on System z and Cell BE >> =A0Ulrich.Weigand@de.ibm.com >> >