+2014-10-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * tree-ssa-math-opts.c (find_bswap_or_nop_1): Fix creation of
+ MARKER_BYTE_UNKNOWN markers when handling casts.
+
2014-10-21 Richard Biener <rguenther@suse.de>
* tree-ssa-phiopt.c (value_replacement): Properly verify we
+2014-10-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * gcc.dg/optimize-bswaphi-1.c: New bswap pass test.
+
2014-10-21 Richard Biener <rguenther@suse.de>
* g++.dg/ipa/devirt-42.C: Fix dump scanning routines.
return *(data + 1) | (*data << 8);
}
+typedef int SItype __attribute__ ((mode (SI)));
+typedef int HItype __attribute__ ((mode (HI)));
+
+/* Test that detection of significant sign extension works correctly. This
+ checks that unknown byte marker are set correctly in cast of cast. */
+
+HItype
+swap16 (HItype in)
+{
+ return (HItype) (((in >> 0) & 0xFF) << 8)
+ | (((in >> 8) & 0xFF) << 0);
+}
+
/* { dg-final { scan-tree-dump-times "16 bit load in target endianness found at" 3 "bswap" } } */
-/* { dg-final { scan-tree-dump-times "16 bit bswap implementation found at" 3 "bswap" { xfail alpha*-*-* arm*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "16 bit bswap implementation found at" 1 "bswap" { target alpha*-*-* arm*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "16 bit bswap implementation found at" 4 "bswap" { xfail alpha*-*-* arm*-*-* } } } */
/* { dg-final { cleanup-tree-dump "bswap" } } */
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);
+ n->n |= MARKER_BYTE_UNKNOWN
+ << ((type_size - 1 - i) * BITS_PER_MARKER);
if (type_size < 64 / BITS_PER_MARKER)
{