Steven Bosscher | 29 Jun 2012 16:35
Picon

[patch] Remove CASE_USE_BIT_TESTS target macro

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?

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)
 <at>  <at>  -1722,13 +1722,6  <at>  <at>  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.  */
(Continue reading)

Richard Guenther | 29 Jun 2012 16:42
Picon

Re: [patch] Remove CASE_USE_BIT_TESTS target macro

On Fri, Jun 29, 2012 at 4:35 PM, Steven Bosscher <stevenb.gcc <at> gmail.com> 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
> ===================================================================
(Continue reading)

Steven Bosscher | 29 Jun 2012 16:52
Picon

Re: [patch] Remove CASE_USE_BIT_TESTS target macro

On Fri, Jun 29, 2012 at 4:42 PM, Richard Guenther
<richard.guenther <at> gmail.com> wrote:
> On Fri, Jun 29, 2012 at 4:35 PM, Steven Bosscher <stevenb.gcc <at> gmail.com> wrote:
>> Hello,
>>
>> This patch removes the CASE_USE_BIT_TESTS target macro.
...
> Ok.  (poison CASE_USE_BIT_TESTS?)

Right, I've done that in the patch I commited.

Ciao!
Steven

Georg-Johann Lay | 30 Jun 2012 10:58
Picon
Favicon

Re: [patch] Remove CASE_USE_BIT_TESTS target macro

Steven Bosscher schrieb:
> 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...)

Even if a target supports ward_mode shifts with variable offsets
it might be the case that it's not appropriate to use it in switch/case
expansion because it is too expensive.

For example, avr supports word_mode shifts but because there is no
barrel shifter, a loop has to be used. Likewise for "odd" shift
offsets with const_int offsets.

Johann

> Bootstrapped and tested on powerpc64-unknown-linux-gnu. OK for trunk?
> 
> Ciao!
> Steven
> 
> 
> 	* stmt.c (CASE_USE_BIT_TESTS): Fold away into its only user ...
> 	(expand_switch_using_bit_tests_p): ...here.
(Continue reading)

Steven Bosscher | 30 Jun 2012 12:01
Picon

Re: [patch] Remove CASE_USE_BIT_TESTS target macro

On Sat, Jun 30, 2012 at 10:58 AM, Georg-Johann Lay <gjl <at> gcc.gnu.org> wrote:
> Steven Bosscher schrieb:
>>
>> 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...)
>
>
> Even if a target supports ward_mode shifts with variable offsets
> it might be the case that it's not appropriate to use it in switch/case
> expansion because it is too expensive.
>
> For example, avr supports word_mode shifts but because there is no
> barrel shifter, a loop has to be used. Likewise for "odd" shift
> offsets with const_int offsets.

Cost is an orthogonal issue.

The CASE_USE_BIT_TESTS macro tests whether the operation is supported
at all for a target. There is a cost check after that to see if the
shift is cheap, see lshift_cheap_p().

Ciao!
(Continue reading)


Gmane