This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH] Fix PR61375: cancel bswap optimization when value doesn't fit in a HOST_WIDE_INT
- From: "Thomas Preud'homme" <thomas dot preudhomme at arm dot com>
- To: "'Jakub Jelinek'" <jakub at redhat dot com>
- Cc: "Richard Biener" <richard dot guenther at gmail dot com>, "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 23 Jun 2014 17:29:02 +0800
- Subject: RE: [PATCH] Fix PR61375: cancel bswap optimization when value doesn't fit in a HOST_WIDE_INT
- Authentication-results: sourceware.org; auth=none
- References: <002c01cf8453$e32b4710$a981d530$ at arm dot com> <CAFiYyc3F==SQgWMWp2NOXAQvdB5UNQ1j6pJGDC6ebs-e9rnduw at mail dot gmail dot com> <002301cf8c74$3a934a20$afb9de60$ at arm dot com> <CAFiYyc0Y6do+ahNngtoE=RzVutBw3=5MXcNr0fXpM6xaOo+YUw at mail dot gmail dot com> <20140623083630 dot GO31640 at tucnak dot redhat dot com> <002a01cf8ec0$3d351df0$b79f59d0$ at arm dot com> <20140623085831 dot GP31640 at tucnak dot redhat dot com>
> From: Jakub Jelinek [mailto:jakub@redhat.com]
> Sent: Monday, June 23, 2014 4:59 PM
>
> Host could e.g. in theory have CHAR_BIT 32, while target BITS_PER_UNIT 8
> (otherwise bswap pass would give up). sizeof (unsigned HOST_WIDE_INT)
> could
> very well be 2 in that case.
In this case the pass would skip any value of more than 2 bytes. However although the original comments on struct symbolic_number implies that there is a mapping between host bytes (the bytes of the symbolic number) and target bytes, it isn't the case since do_shift_rotate () shift the symbolic number by quantity of BYTES_PER_UNIT instead of CHAR_BIT. Also there is quite a few 8 here and there. Although not a problem in practice, the mix of 8 and BITS_PER_UNIT does not look very good. I guess a quick review would be in order. Of course, with regards to the backport the mix of 8 and BITS_PER_UNIT should be left as is and only confusion about how to represent a target value into a host type should be fixed if any.
I'll come back to you whenever this is done.
Best regards,
Thomas