From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19388 invoked by alias); 4 May 2012 21:26:53 -0000 Received: (qmail 19336 invoked by uid 22791); 4 May 2012 21:26:53 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_FC X-Spam-Check-By: sourceware.org Received: from mail-wg0-f41.google.com (HELO mail-wg0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 May 2012 21:26:40 +0000 Received: by wgbds1 with SMTP id ds1so1613147wgb.2 for ; Fri, 04 May 2012 14:26:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.180.78.105 with SMTP id a9mr16137425wix.20.1336166798728; Fri, 04 May 2012 14:26:38 -0700 (PDT) Received: by 10.216.100.197 with HTTP; Fri, 4 May 2012 14:26:38 -0700 (PDT) In-Reply-To: <7FB04A5C213E9943A72EE127DB74F0ADD15FEADFF8@SJEXCHCCR02.corp.ad.broadcom.com> References: <7FB04A5C213E9943A72EE127DB74F0ADD15FEADD80@SJEXCHCCR02.corp.ad.broadcom.com> <7FB04A5C213E9943A72EE127DB74F0ADD15FEADFF8@SJEXCHCCR02.corp.ad.broadcom.com> Date: Fri, 04 May 2012 21:26:00 -0000 Message-ID: Subject: Re: Why doesn't GCC generate conditional move for COND_EXPR? From: Andrew Pinski To: Bingfeng Mei Cc: Richard Guenther , "gcc@gcc.gnu.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2012-05/txt/msg00071.txt.bz2 On Tue, Oct 25, 2011 at 4:28 AM, Bingfeng Mei wrote: > Thanks, Andrew. I also implemented a quick patch on our port (based on GC= C 4.5). > I noticed it produced better code now for our applications. Maybe elimina= ting > control flow in earlier stage helps other optimizing passes. Currently, t= ree > if-conversion pass is not turned on by default (only with tree vectorizat= ion > or some other passes). Maybe it is worth to make it default at -O2 (for t= hose > processors support conditional move)? I just committed the patch which does the expansion of COND_EXPR to condmov to the trunk. I have more patches which do what ifcvt does but in phiopt (which seems better in general as ifcvt work only over loops). I hope to post those patches in the coming weeks. Thanks, Andrew Pinski > > Cheers, > Bingfeng > >> -----Original Message----- >> From: Andrew Pinski [mailto:pinskia@gmail.com] >> Sent: 24 October 2011 17:20 >> To: Richard Guenther >> Cc: Bingfeng Mei; gcc@gcc.gnu.org >> Subject: Re: Why doesn't GCC generate conditional move for COND_EXPR? >> >> On Mon, Oct 24, 2011 at 7:00 AM, Richard Guenther >> wrote: >> > On Mon, Oct 24, 2011 at 2:55 PM, Bingfeng Mei >> wrote: >> >> Hello, >> >> I noticed that COND_EXPR is not expanded to conditional move >> >> as MIN_EXPR/MAX_EXPR are (assuming movmodecc is available). >> >> I wonder why not? >> >> >> >> I have some loop that fails tree vectorization, but still contains >> >> COND_EXPR from tree ifcvt pass. In the end, the generated code >> >> is worse than if I don't turned -ftree-vectorize on. =C2=A0This >> >> is on our private port. >> > >> > Because nobody touched COND_EXPR expansion since ages. >> >> I have a patch which I will be submitting next week or so that does >> this expansion correctly. =C2=A0In fact I have a few patches which impro= ves >> the generation of COND_EXPR in simple cases (in PHI-OPT). >> >> Thanks, >> Andrew Pinski >