[Bug middle-end/35306] Missing expression simplication for conditional OR

xinliangli at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Feb 24 00:37:00 GMT 2008



------- Comment #2 from xinliangli at gmail dot com  2008-02-24 00:36 -------
(In reply to comment #1)
> (In reply to comment #0)
> > The following rule is not handled by GCC
> > 
> > (a & x) || (a & y) ===>  a & (x | y)
> 
> Perhaps that is because those two expressions aren't equivalent?
> 
> But, confirmed, assuming you meant to say that
> 
>   int bla(int a, int x, int y)
>   {
>           return (a & x) || (a & y);
>   }
> 
> isn't transformed to the equivalent of
> 
>   int blabla(int a, int x, int y)
>   {
>           return !!(a & (x | y));
>   }
> 
> This _is_ handled for constant x, y though.
> 
> 
> Segher
> 

Right --- missing context in bug report.

(a&x) || (a&y) ==> (a&(x|y) != 0)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35306



More information about the Gcc-bugs mailing list