This is the mail archive of the gcc-patches@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: [PATCH] Implement switch statements with bit tests


Roger Sayle <roger@www.eyesopen.com> writes:

> A more generic approach might be
> 
> 	if ((int)(CST << x) < 0)
> 
> i.e. push the relevant bit into the most significant or sign-bit,
> and then use instructions that test if the word is negative.

That's a good idea. It will make CST larger and harder to emit,
though; although in case one needs to shift x's range anyway, one can
compensate for that, too.

-- 
	Falk


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