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]

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


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