This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH] Fix PR64718: bad 16-bit bswap replacement
- From: Richard Biener <rguenther at suse dot de>
- To: Thomas Preud'homme <thomas dot preudhomme at arm dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 23 Jan 2015 11:18:42 +0100 (CET)
- Subject: RE: [PATCH] Fix PR64718: bad 16-bit bswap replacement
- Authentication-results: sourceware.org; auth=none
- References: <000401d036ef$7e082110$7a186330$ at arm dot com> <alpine dot LSU dot 2 dot 11 dot 1501231044460 dot 12482 at zhemvz dot fhfr dot qr> <000501d036f5$45e69090$d1b3b1b0$ at arm dot com>
On Fri, 23 Jan 2015, Thomas Preud'homme wrote:
> > From: Richard Biener [mailto:rguenther@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't think using short_unsigned_type_node or
> > short_integer_type_node
> > is correct - that depends on the SHORT_TYPE_SIZE target macro which
> > may very well not match HImode.
>
> Indeed, my mistake. What about intHI_type_node and unsigned_intHI_type_node?
>
> >
> > I think for the rotation itself whether the type is signed or unsigned
> > doesn't matter and the bswap builtins expect unsigned input. So I think
> > you should use an unsigned type unconditionally.
>
> Ok then only unsigned_intHI_type_node.
That should work - you already use uint16_type_node for load_type
so I suggest to use uint16_type_node instead of unsigned_intHI_type_node.
That's technically even more correct if you consider BITS_PER_UNIT != 8
(though bswap pass is disabled in that case).
> >
> > Which means you can simply use build_nonstandard_integer_type (16,
> > 1);
> > or even bswap_type as-is (it should match the unsigned builtin argument
> > type already?)
>
> bswap_type is not set for 16-bit bswap since we removed the need to have
> a builtin bswap in the first place, hence this line.
I see.
Ok with using uint16_type_node.
Thanks,
Richard.