RE: [PATCH] Fix PR64718: bad 16-bit bswap replacement

2015-01-28 Thread Thomas Preud'homme
Best regards, Thomas > -Original Message- > From: Richard Biener [mailto:rguent...@suse.de] > Sent: Friday, January 23, 2015 6:19 PM > To: Thomas Preud'homme > Cc: gcc-patches@gcc.gnu.org > Subject: RE: [PATCH] Fix PR64718: bad 16-bit bswap replacement > &

RE: [PATCH] Fix PR64718: bad 16-bit bswap replacement

2015-01-23 Thread Richard Biener
On Fri, 23 Jan 2015, Thomas Preud'homme wrote: > > From: Richard Biener [mailto:rguent...@suse.de] > > Sent: Friday, January 23, 2015 6:01 PM > > > + if (bswap && n->range == 16) > > > +bswap_type = TYPE_UNSIGNED (TREE_TYPE (src)) ? > > short_unsigned_type_node > > > +

RE: [PATCH] Fix PR64718: bad 16-bit bswap replacement

2015-01-23 Thread Thomas Preud'homme
> From: Richard Biener [mailto:rguent...@suse.de] > Sent: Friday, January 23, 2015 6:01 PM > > + if (bswap && n->range == 16) > > +bswap_type = TYPE_UNSIGNED (TREE_TYPE (src)) ? > short_unsigned_type_node > > +: > short_integer_type_node; > > I don'

Re: [PATCH] Fix PR64718: bad 16-bit bswap replacement

2015-01-23 Thread Richard Biener
On Fri, 23 Jan 2015, Thomas Preud'homme wrote: > Hi Richard, > > When detecting a 16-bit hand-crafted byte swap, the bswap pass replaces the > sequence of statements by a rotation left of 8 bits of the same type as the > source. For source whose type size is bigger than 16 bits this is wrong. F

[PATCH] Fix PR64718: bad 16-bit bswap replacement

2015-01-23 Thread Thomas Preud'homme
Hi Richard, When detecting a 16-bit hand-crafted byte swap, the bswap pass replaces the sequence of statements by a rotation left of 8 bits of the same type as the source. For source whose type size is bigger than 16 bits this is wrong. For instance, int swap(int x) { return (unsigned short) (