This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH] Fix PR63259: bswap not recognized when finishing with rotation


> From: Jakub Jelinek [mailto:jakub@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.

> 
> 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





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]