public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Why doesn't GCC generate conditional move for COND_EXPR?
@ 2011-10-24 14:45 Bingfeng Mei
  2011-10-24 16:19 ` Richard Guenther
  0 siblings, 1 reply; 5+ messages in thread
From: Bingfeng Mei @ 2011-10-24 14:45 UTC (permalink / raw)
  To: gcc

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.

Thanks,
Bingfeng Mei

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why doesn't GCC generate conditional move for COND_EXPR?
  2011-10-24 14:45 Why doesn't GCC generate conditional move for COND_EXPR? Bingfeng Mei
@ 2011-10-24 16:19 ` Richard Guenther
  2011-10-25  3:12   ` Andrew Pinski
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Guenther @ 2011-10-24 16:19 UTC (permalink / raw)
  To: Bingfeng Mei; +Cc: gcc

On Mon, Oct 24, 2011 at 2:55 PM, Bingfeng Mei <bmei@broadcom.com> 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.  This
> is on our private port.

Because nobody touched COND_EXPR expansion since ages.

> Thanks,
> Bingfeng Mei
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why doesn't GCC generate conditional move for COND_EXPR?
  2011-10-24 16:19 ` Richard Guenther
@ 2011-10-25  3:12   ` Andrew Pinski
  2011-10-25 14:10     ` Bingfeng Mei
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Pinski @ 2011-10-25  3:12 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Bingfeng Mei, gcc

On Mon, Oct 24, 2011 at 7:00 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Mon, Oct 24, 2011 at 2:55 PM, Bingfeng Mei <bmei@broadcom.com> 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.  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).

Thanks,
Andrew Pinski

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Why doesn't GCC generate conditional move for COND_EXPR?
  2011-10-25  3:12   ` Andrew Pinski
@ 2011-10-25 14:10     ` Bingfeng Mei
  2012-05-04 21:26       ` Andrew Pinski
  0 siblings, 1 reply; 5+ messages in thread
From: Bingfeng Mei @ 2011-10-25 14:10 UTC (permalink / raw)
  To: Andrew Pinski, Richard Guenther; +Cc: gcc

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)? 

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
> <richard.guenther@gmail.com> wrote:
> > On Mon, Oct 24, 2011 at 2:55 PM, Bingfeng Mei <bmei@broadcom.com>
> 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.  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).
> 
> Thanks,
> Andrew Pinski


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why doesn't GCC generate conditional move for COND_EXPR?
  2011-10-25 14:10     ` Bingfeng Mei
@ 2012-05-04 21:26       ` Andrew Pinski
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Pinski @ 2012-05-04 21:26 UTC (permalink / raw)
  To: Bingfeng Mei; +Cc: Richard Guenther, gcc

On Tue, Oct 25, 2011 at 4:28 AM, Bingfeng Mei <bmei@broadcom.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.

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
>> <richard.guenther@gmail.com> wrote:
>> > On Mon, Oct 24, 2011 at 2:55 PM, Bingfeng Mei <bmei@broadcom.com>
>> 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.  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).
>>
>> Thanks,
>> Andrew Pinski
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-04 21:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-24 14:45 Why doesn't GCC generate conditional move for COND_EXPR? Bingfeng Mei
2011-10-24 16:19 ` Richard Guenther
2011-10-25  3:12   ` Andrew Pinski
2011-10-25 14:10     ` Bingfeng Mei
2012-05-04 21:26       ` Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).