[PATCH] Implement switch statements with bit tests

Andi Kleen ak@suse.de
Fri Jan 24 13:19:00 GMT 2003


On Fri, Jan 24, 2003 at 01:11:11PM +0000, Richard Earnshaw wrote:
> > > > #define CASE_USE_BIT_TESTS  0
> > > > 
> > > > [Is there a better way to test for an efficient left shift insn?]
> > > 
> > > Yes, there is.  Use rtx_cost().
> > 
> > I think you still need a target macro. Some architectures have undefined
> > behaviour when the left shift is bigger than the word size
> > (e.g. the vax can trap and others may need a long time to execute
> > the shift) For these an and WORDSIZE-1,... before the mask is needed.
> 
> No, that would be incorrect.  The AND gives a modulo WORDSIZE operation, 
> when what is needed is saturation to WORDSIZE-1.

Not needed when you have no default case.

-Andi



More information about the Gcc-patches mailing list