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: Richard Henderson <rth at redhat dot com>
- To: Roger Sayle <roger at www dot eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Andi Kleen <ak at suse dot de>, Jan Hubicka <jh at suse dot cz>
- Date: Fri, 24 Jan 2003 00:12:49 -0800
- Subject: Re: [PATCH] Implement switch statements with bit tests
- References: <Pine.LNX.4.44.0301231845570.16282-100000@www.eyesopen.com>
On Thu, Jan 23, 2003 at 07:49:30PM -0700, Roger Sayle wrote:
> Here MINVAL is the lowest case value in the switch, RANGE is
> the value MAXVAL - MINVAL, i.e. the highest case value - MINVAL,
> DEFAULT is the default case target. To work RANGE must be less
> than the number of bits in SImode, i.e. 31 or less on typical
> 32-bit architectures.
I don't see why you're stuck on SImode.
If I'm on a 64-bit target, then I ought to be able to use DImode
as well. Recall that this is
1UL << (int)X
not
1 << (long)X
I also think you ought to find the narrowest mode that fits the
arguments. If MAXVAL is 15, there's no reason we couldn't use
HImode.
r~