From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3725 invoked by alias); 25 Jul 2011 09:11:01 -0000 Received: (qmail 3714 invoked by uid 22791); 25 Jul 2011 09:11:00 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate3.uk.ibm.com (HELO mtagate3.uk.ibm.com) (194.196.100.163) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 Jul 2011 09:10:45 +0000 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate3.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p6P9Agfa015518 for ; Mon, 25 Jul 2011 09:10:42 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6P9Agnr2605158 for ; Mon, 25 Jul 2011 10:10:42 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6P9Agaw014412 for ; Mon, 25 Jul 2011 03:10:42 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p6P9AeaS014391; Mon, 25 Jul 2011 03:10:41 -0600 Message-Id: <201107250910.p6P9AeaS014391@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 25 Jul 2011 11:10:40 +0200 Subject: Re: [patch] Fix PR tree-optimization/49771 To: richard.guenther@gmail.com (Richard Guenther) Date: Mon, 25 Jul 2011 09:44:00 -0000 From: "Ulrich Weigand" Cc: ira.rosen@linaro.org (Ira Rosen), gcc-patches@gcc.gnu.org, patches@linaro.org (Patch Tracking) In-Reply-To: from "Richard Guenther" at Jul 24, 2011 04:31:48 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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/msg02115.txt.bz2 Richard Guenther wrote: > On Sun, Jul 24, 2011 at 2:02 PM, Ira Rosen wrote: > > On 21 July 2011 15:19, Ira Rosen wrote: > >> 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 = PHI > > D.4593_42 = (void *) ivtmp.53_32; > > D.4520_33 = MEM[base: D.4593_42, offset: 0B]; > > D.4521_34 = D.4520_33 + 1; > > MEM[symbol: a, index: ivtmp.42_50, offset: 0B] = D.4521_34; > > ivtmp.42_45 = ivtmp.42_50 + 4; > > if (ivtmp.42_45 != 16) > > goto ; > > else > > goto ; > > > > and the load is changed by dom2 to: > > > > : > > ... > > D.4520_33 = 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: > > Hum. This smells like we are hiding sth from the tree optimizers? Well, the back-end assumes a pointer to vector type is always naturally aligned, and therefore the data it points to can be accessed via a simple load, with no extra rotate needed. It seems what happened here is that somehow, a pointer to int gets replaced by a pointer to vector, even though their alignment properties are different. This vector pointer must originate somehow in the vectorizer, however, since the original C source does not contain any vector types at all ... Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com