https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125905

--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jeffrey A. Law from comment #2)
> Another example, this time derived from x264.  I *think* this is
> representative of what's created by the vectorizer for selecting across two
> different loop variants.  It's ultimately just a conditional add.  It's a
> gimple test because I haven't managed to trip it directly in C.
> 
> 
> long __GIMPLE (ssa)
> f (long sa, long ua)
> {
>   long ua15;
>   long hi;
>   _Bool neg;
> 
>   __BB(2):
>   ua15_5 = ua_3(D) + 15l;
>   neg_6 = sa_4(D) < 0l;
>   hi_7 = neg_6 ? 15l : ua15_5;
>   return hi_7;
> }
> 
> Generates:
>         srli    a5,a0,63        # 10    [c=4 l=4]  lshrdi3
>         addi    a1,a1,15        # 31    [c=4 l=4]  *adddi3/1
>         li      a4,15           # 30    [c=4 l=4]  *movdi_64bit/1
>         czero.nez       a0,a1,a5        # 33    [c=4 l=4]  *czero.nez.didi
>         czero.eqz       t0,a4,a5        # 34    [c=4 l=4]  *czero.eqz.didi
>         add     a0,t0,a0        # 22    [c=4 l=4]  *adddi3/0
>         ret             # 47    [c=0 l=4]  simple_return
> 
> But really just one czero is needed.  Select across 0/15 using that single
> czero, then unconditionall add that to a1.


Actually it is select between 0 and ua15_3(D) if I read the gimple correctly. 

That is conditionally add ua15_3(D) to 15.

Reply via email to