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 (take 2)
- 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
- Date: Sat, 25 Jan 2003 08:44:48 -0800
- Subject: Re: [PATCH] Implement switch statements with bit tests (take 2)
- References: <Pine.LNX.4.44.0301250729040.13975-100000@www.eyesopen.com>
On Sat, Jan 25, 2003 at 07:54:18AM -0700, Roger Sayle wrote:
> * stmt.c (emit_case_bit_tests): New routine to implement suitable
> switch statements using the equivalent of "if ((1<<x) & cst) ... ".
> (case_bit_test_cmp): New comparison function for "qsort" to order
> case_bit_tests by decreasing number of destination nodes.
> (lshift_cheap_p): New function to determine if "1 << x" is cheap.
> (expand_end_case_type): Use emit_case_bit_tests to implement
> suitable switch statments.
> (CASE_USE_BIT_TESTS): New target macro to disable the above.
> * Makefile.in (stmt.o): Add dependency on optab.h.
> * doc/tm.texi (CASE_USE_BIT_TESTS): Document new target macro.
>
> * gcc.c-torture/execute/switch-1.c: New test case.
Ok.
r~