On Sat, Jun 30, 2012 at 10:58 AM, Georg-Johann Lay <g...@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! Steven