This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH] Fix PR63266: Keep track of impact of sign extension in bswap
- From: "Thomas Preud'homme" <thomas dot preudhomme at arm dot com>
- To: "'Christophe Lyon'" <christophe dot lyon at linaro dot org>
- Cc: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 25 Sep 2014 14:39:28 +0800
- Subject: RE: [PATCH] Fix PR63266: Keep track of impact of sign extension in bswap
- Authentication-results: sourceware.org; auth=none
- References: <000001cfd198$71470e30$53d52a90$ at arm dot com> <CAFiYyc12bCCxtunYgib+kPvY7-R=ygiw0sBY-bPz=V7NkqPRyQ at mail dot gmail dot com> <CAKdteOZOJp6dA9FVYuX_Nmwo9JQZkSh0yERAr5Wg8cn3w0WXYA at mail dot gmail dot com>
> From: Christophe Lyon [mailto:christophe.lyon@linaro.org]
> Sent: Thursday, September 25, 2014 4:28 AM
>
> Hi Thomas,
Hi Christophe,
>
> Although I could notice the improvement:
> Pass disappears [PASS => ]:
> gcc.dg/optimize-bswapsi-1.c scan-tree-dump-times bswap "32 bit
> bswap
> implementation found at" 3
> New pass [ => PASS]:
> gcc.dg/optimize-bswapsi-1.c scan-tree-dump-times bswap "32 bit
> bswap
> implementation found at" 4
>
> for arm-*, armeb-* and aarch64-* targets, there is no change for
> aarch64_be: is this expected?
No, but neither is this:
@@ -1905,11 +1913,10 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
/* Sign extension: result is dependent on the value. */
old_type_size = TYPE_PRECISION (n->type) / BITS_PER_UNIT;
- if (!TYPE_UNSIGNED (n->type)
- && type_size > old_type_size
- && n->n & ((uint64_t) 0xff << ((old_type_size - 1)
- * BITS_PER_MARKER)))
- return NULL;
+ if (!TYPE_UNSIGNED (n->type) && type_size > old_type_size
+ && HEAD_MARKER (n->n, old_type_size))
+ for (i = 0; i < type_size - old_type_size; i++)
+ n->n |= MARKER_BYTE_UNKNOWN << (type_size - 1 - i);
if (type_size < 64 / BITS_PER_MARKER)
{
type_size - 1 - I gives a number of marker bytes to shift. I forgot to multiply by the number of bits in a marker. Can you do the change locally and tell me if the test now succeed for aarch64_be?
Best regards,
Thomas