]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-math-opts.c (find_bswap_or_nop_1): Fix creation of MARKER_BYTE_UNKNOWN marke...
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Tue, 21 Oct 2014 12:38:36 +0000 (12:38 +0000)
committerThomas Preud'homme <thopre01@gcc.gnu.org>
Tue, 21 Oct 2014 12:38:36 +0000 (12:38 +0000)
2014-10-21  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    * tree-ssa-math-opts.c (find_bswap_or_nop_1): Fix creation of
    MARKER_BYTE_UNKNOWN markers when handling casts.

    gcc/testsuite/
    * gcc.dg/optimize-bswaphi-1.c: New bswap pass test.

From-SVN: r216511

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/optimize-bswaphi-1.c
gcc/tree-ssa-math-opts.c

index 978d7dc57c73a19fb3df99553795bef25381c890..6b1e1bbc19a5b4a83b60aeec8683f59542886aa7 100644 (file)
@@ -1,3 +1,8 @@
+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
index 920fd48c404dc991bbfb415296c6e7554ef19ec4..57735a16164607c842251c7c57604794a38f6910 100644 (file)
@@ -1,3 +1,7 @@
+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.
index 3e51f043cae62f744ca99c893fa158392454da26..18aba284e263bd34dd4fd3d51f46fe6a44407d34 100644 (file)
@@ -42,6 +42,20 @@ uint32_t read_be16_3 (unsigned char *data)
   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" } } */
index 3c6e9355fff6fa33f69ea5bb1b0d808f8bf5043e..2ef2333bc111b529874664c3518271079f02823d 100644 (file)
@@ -1916,7 +1916,8 @@ find_bswap_or_nop_1 (gimple stmt, struct symbolic_number *n, int limit)
            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)
              {