This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Optimizing if (foo==1 || foo==3 || foo==7 || etc...) ???
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 21 Jan 2004 21:41:18 -0500 (EST)
- Subject: Optimizing if (foo==1 || foo==3 || foo==7 || etc...) ???
I was wondering about the optimization where you take
if (foo==1 || foo==3 || foo==7 || etc...)
and turn it into:
if ((1 << foo) & N)
I thought I saw a post from like a year ago adding this optimization
to GCC but I don't know whether it went in. I think this would be
useful in making GCC itself faster since we do a lot of this type of
construct in the insn- files testing the variable `which_alternative'.
Anyone know what's up with this optimization?
Thanks,
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu