On Tue, Oct 7, 2014 at 11:43 PM, Thomas Preud'homme <thomas.preudho...@arm.com> wrote: >> From: Jakub Jelinek [mailto:ja...@redhat.com] >> Sent: Wednesday, October 08, 2014 2:39 PM >> >> Doesn't it turn 16-bit {L,R}ROTATE_EXPR used alone into >> __builtin_bswap16? >> For those the question is if the canonical GIMPLE should be the rotation >> or >> byteswap, I'd think rotation would be perhaps better. Or depending on >> if >> the backend has bswaphi2 or rotate pattern? > > Good point. It seems better to keep the status quo.
There is already code which converts __builtin_bswap16 to the rotate so maybe it does not matter. Though I have not seen code which does the rotate into a bswaphi2 pattern. Thanks, Andrew > >> >> Also, perhaps you could short-circuit this if the rotation isn't by constant >> or not a multiple of BITS_PER_UNIT. So >> switch (code) >> { >> case BIT_IOR_EXPR: >> break; >> case LROTATE_EXPR: >> case RROTATE_EXPR: >> if (!tree_fits_uhwi_p (gimple_assign_rhs2 (cur_stmt)) >> || (tree_to_uhwi (gimple_assign_rhs2 (cur_stmt)) >> % BITS_PER_UNIT)) >> continue; >> break; >> default: >> continue; >> } >> ? > > Right. Thanks for the comments. > > Best regards, > > Thomas > > > >