This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Implement switch statements with bit tests
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: Roger Sayle <roger at www dot eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 24 Jan 2003 18:35:58 +0100
- Subject: Re: [PATCH] Implement switch statements with bit tests
- References: <Pine.LNX.4.44.0301240922550.21372-100000@www.eyesopen.com>
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