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: Optimizing if (foo==1 || foo==3 || foo==7 || etc...) ???


 > From: Kazu Hirata <kazu@cs.umass.edu>
 > 
 > > 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) 
 > 
 > AFAIK, Roger Sayle implemented this if the equivalent thing happens in
 > a switch statement like
 > [...[
 > See
 > 
 > http://gcc.gnu.org/ml/gcc-patches/2003-01/msg01733.html
 > 
 > Perhaps we can generalize the switch statement handling to support the
 > if statement.
 > Kazu Hirata

Thanks for pointing out that thread.  I read it and saw no evidence
whether it went in or not.  (I.e. no final patch and "ok to install"
message.)  Roger?

Second, the patch I recall seeing from a year ago was specifically for
"if" not switches.  Of course it would be best to have both.  But
first I'd like to track down where we lost the original patch.

IIRC, it was submitted from a contributor whose name I hadn't seen
often (ever?) and I recall RTH provided some feedback but I don't
recall it ever going in.  Now searching the archives I can't find it.

Anyone recall this patch?

		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]