On Fri, Jun 29, 2012 at 4:35 PM, Steven Bosscher <[email protected]> wrote:
> Hello,
>
> This patch removes the CASE_USE_BIT_TESTS target macro. The default
> value of the macro is defined in stmt.c, where the only user of the
> macro is also. No target re-defines the macro.
>
> (I wonder if the test is necessary at all. AFAICT all targets support
> shifts in word_mode. The macro was originally written to test for
> ashlsi3, which is _not_ supported on all targets -- but word_mode
> shifts are. Oh well, another day perhaps...)
>
> Bootstrapped and tested on powerpc64-unknown-linux-gnu. OK for trunk?
Ok. (poison CASE_USE_BIT_TESTS?)
Thanks,
Richard.
> Ciao!
> Steven
>
>
> * stmt.c (CASE_USE_BIT_TESTS): Fold away into its only user ...
> (expand_switch_using_bit_tests_p): ...here.
> * doc/tm.texi.in (CASE_USE_BIT_TESTS): Remove documentation.
> * doc/tm.texi (CASE_USE_BIT_TESTS): Regenerate.
>
> Index: stmt.c
> ===================================================================
> --- stmt.c (revision 189073)
> +++ stmt.c (working copy)
> @@ -1722,13 +1722,6 @@ add_case_node (struct case_node *head, tree type,
> /* Maximum number of case bit tests. */
> #define MAX_CASE_BIT_TESTS 3
>
> -/* By default, enable case bit tests on targets with ashlsi3. */
> -#ifndef CASE_USE_BIT_TESTS
> -#define CASE_USE_BIT_TESTS (optab_handler (ashl_optab, word_mode) \
> - != CODE_FOR_nothing)
> -#endif
> -
> -
> /* A case_bit_test represents a set of case nodes that may be
> selected from using a bit-wise comparison. HI and LO hold
> the integer to be tested against, LABEL contains the label
> @@ -1888,8 +1881,10 @@ bool
> expand_switch_using_bit_tests_p (tree index_expr, tree range,
> unsigned int uniq, unsigned int count)
> {
> - return (CASE_USE_BIT_TESTS
> - && ! TREE_CONSTANT (index_expr)
> + if (optab_handler (ashl_optab, word_mode) == CODE_FOR_nothing)
> + return false;
> +
> + return (! TREE_CONSTANT (index_expr)
> && compare_tree_int (range, GET_MODE_BITSIZE (word_mode)) < 0
> && compare_tree_int (range, 0) > 0
> && lshift_cheap_p ()
> Index: doc/tm.texi
> ===================================================================
> --- doc/tm.texi (revision 189074)
> +++ doc/tm.texi (working copy)
> @@ -10306,16 +10306,6 @@ The default is four for machines with a @code{case
> five otherwise. This is best for most machines.
> @end deftypefn
>
> -@defmac CASE_USE_BIT_TESTS
> -Define this macro to be a C expression to indicate whether C switch
> -statements may be implemented by a sequence of bit tests. This is
> -advantageous on processors that can efficiently implement left shift
> -of 1 by the number of bits held in a register, but inappropriate on
> -targets that would require a loop. By default, this macro returns
> -@code{true} if the target defines an @code{ashlsi3} pattern, and
> -@code{false} otherwise.
> -@end defmac
> -
> @defmac WORD_REGISTER_OPERATIONS
> Define this macro if operations between registers with integral mode
> smaller than a word are always performed on the entire register.
> Index: doc/tm.texi.in
> ===================================================================
> --- doc/tm.texi.in (revision 189074)
> +++ doc/tm.texi.in (working copy)
> @@ -10180,16 +10180,6 @@ The default is four for machines with a @code{case
> five otherwise. This is best for most machines.
> @end deftypefn
>
> -@defmac CASE_USE_BIT_TESTS
> -Define this macro to be a C expression to indicate whether C switch
> -statements may be implemented by a sequence of bit tests. This is
> -advantageous on processors that can efficiently implement left shift
> -of 1 by the number of bits held in a register, but inappropriate on
> -targets that would require a loop. By default, this macro returns
> -@code{true} if the target defines an @code{ashlsi3} pattern, and
> -@code{false} otherwise.
> -@end defmac
> -
> @defmac WORD_REGISTER_OPERATIONS
> Define this macro if operations between registers with integral mode
> smaller than a word are always performed on the entire register.