This is the mail archive of the
mailing list for the GCC project.
Re: Why doesn't GCC generate conditional move for COND_EXPR?
- From: Andrew Pinski <andrew dot pinski at caviumnetworks dot com>
- To: Bingfeng Mei <bmei at broadcom dot com>
- Cc: Richard Guenther <richard dot guenther at gmail dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 4 May 2012 14:26:38 -0700
- Subject: Re: Why doesn't GCC generate conditional move for COND_EXPR?
- References: <7FB04A5C213E9943A72EE127DB74F0ADD15FEADD80@SJEXCHCCR02.corp.ad.broadcom.com> <CAFiYyc0xGcf5iphRq2Z59-R4GG6wUvWHMuP_GfCUTSqyokZDfirstname.lastname@example.org> <CA+=Sn1mQ=XHw+J_mtVN=g54T3FNjagGOxNyO6ZPc1tf6_4_DqQ@mail.gmail.com> <7FB04A5C213E9943A72EE127DB74F0ADD15FEADFF8@SJEXCHCCR02.corp.ad.broadcom.com>
On Tue, Oct 25, 2011 at 4:28 AM, Bingfeng Mei <email@example.com> wrote:
> Thanks, Andrew. I also implemented a quick patch on our port (based on GCC 4.5).
> I noticed it produced better code now for our applications. Maybe eliminating
> control flow in earlier stage helps other optimizing passes. Currently, tree
> if-conversion pass is not turned on by default (only with tree vectorization
> or some other passes). Maybe it is worth to make it default at -O2 (for those
> 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.
>> -----Original Message-----
>> From: Andrew Pinski [mailto:firstname.lastname@example.org]
>> Sent: 24 October 2011 17:20
>> To: Richard Guenther
>> Cc: Bingfeng Mei; email@example.com
>> Subject: Re: Why doesn't GCC generate conditional move for COND_EXPR?
>> On Mon, Oct 24, 2011 at 7:00 AM, Richard Guenther
>> <firstname.lastname@example.org> wrote:
>> > On Mon, Oct 24, 2011 at 2:55 PM, Bingfeng Mei <email@example.com>
>> >> 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. ÂThis
>> >> 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. ÂIn fact I have a few patches which improves
>> the generation of COND_EXPR in simple cases (in PHI-OPT).
>> Andrew Pinski