This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: jump bypass confuses noce_try_minmax


> 
> Consider this test case:
> 
> int foo(int a)
> {
>   if (a >= 7)
>     a = 7;
>   if (a < -8)
>     a = -8;
>   return a;
> }
> 
> On a target with smin/smax insns, it can be coded trivially:
> 
>   a = smin(a,7);
>   a = smax(a,-8);
>   return a;
> 
> However, the "jump bypass" optimization changes it to this:
> 
> int foo(int a)
> {
>   if (a >= 7)
>     a = 7;
>   else if (a < -8)
>     a = -8;
>   return a;
> }
> 
> And now noce_try_minmax cannot match the min operation, and you end up
> with conditional branches and such.  Note that adding asm("") between
> the conditionals yields the expected output.
> 
> Should jump bypassing be deferred until after ifcvt?
> 
> Or could bypassing be skipped on targets with min/max operations?

Perhaps noce_try_minmax can be told to match the case of conditional
min/conditional max?  
I would expect jump bypassing to be more important than min/max
discovery in this special case.

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]