> -----Original Message----- > From: Richard Sandiford [mailto:rsand...@linux.vnet.ibm.com] > Sent: 27 January 2014 16:50 > To: Paulo Matos > Cc: gcc@gcc.gnu.org > Subject: Re: Mode change for bswap pattern expansion > > Sorry, I meant we use an unspec for the first ("V2HI") rotate. > I.e. rather than: > > (set (subreg:V2HI (match_dup 2) 0) > (rotate:V2HI (subreg:V2HI (match_dup 1) 0) > (const_int 8))) > (set (match_dup 0) > (rotate:SI (match_dup 2) > (const_int 16))) > > we have: > > (set (match_dup 2) (unspec:SI [(match_dup 1)] UNSPEC_FOO)) > (set (match_dup 0) > (rotate:SI (match_dup 2) > (const_int 16))) > > In your case the define_insn for the UNSPEC_FOO pattern would have the > same attributes as a V2HI rotate, so it should get scheduled in the same way. >
In that case it would work. My only concern would then be if it prevents further optimizations. On the other hand I am not sure if GCC would try to optimize a rotate with vector V2HI mode... Might give both solutions a try and see what results I get. Thanks, Paulo Matos > Thanks, > Richard