Looking at PR77308, one of the issues is that the bswap optimization phase doesn...
authorWilco Dijkstra <wdijkstr@arm.com>
Wed, 16 Nov 2016 18:10:34 +0000 (18:10 +0000)
committerWilco Dijkstra <wilco@gcc.gnu.org>
Wed, 16 Nov 2016 18:10:34 +0000 (18:10 +0000)
Looking at PR77308, one of the issues is that the bswap optimization
phase doesn't work on ARM.  This is due to an odd check that uses
SLOW_UNALIGNED_ACCESS (which is always true on ARM).  Since the testcase
in PR77308 generates much better code with this patch (~13% fewer
instructions), it seems best to remove this check.

    gcc/
* tree-ssa-math-opts.c (bswap_replace): Remove test
of SLOW_UNALIGNED_ACCESS.

    testsuite/
* gcc.dg/optimize-bswapdi-3.c: Remove xfail.
* gcc.dg/optimize-bswaphi-1.c: Likewise.
* gcc.dg/optimize-bswapsi-2.c: Likewise.

From-SVN: r242506

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/optimize-bswapdi-3.c
gcc/testsuite/gcc.dg/optimize-bswaphi-1.c
gcc/testsuite/gcc.dg/optimize-bswapsi-2.c
gcc/tree-ssa-math-opts.c

index be573a3124b919ef8732a8c68b2545e8e5037ba0..a5290bafc4a7fa8cf940f851f1415d8361c4bd48 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-16  Wilco Dijkstra  <wdijkstr@arm.com>
+
+       * tree-ssa-math-opts.c (bswap_replace): Remove test
+       of SLOW_UNALIGNED_ACCESS.
+
 2016-11-16  Alexander Monakov  <amonakov@ispras.ru>
 
        * config/nvptx/mkoffload.c (main): Check that either OpenACC or OpenMP
index d750f25d328f848986eec79ce92cd17a3499d567..3f8831e066afbc98f110f914367685ec1f60ac6c 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-16  Wilco Dijkstra  <wdijkstr@arm.com>
+
+       * gcc.dg/optimize-bswapdi-3.c: Remove xfail.
+       * gcc.dg/optimize-bswaphi-1.c: Likewise.        
+       * gcc.dg/optimize-bswapsi-2.c: Likewise.
+
 2016-11-16  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
        PR libgfortran/78314
index 273b4bc622cb32564533e1352b5fc8ad52054f8b..6f682014622ab79e541cdf26d13f16a7d87f158d 100644 (file)
@@ -61,4 +61,4 @@ uint64_t read_be64_3 (unsigned char *data)
 }
 
 /* { dg-final { scan-tree-dump-times "64 bit load in target endianness found at" 3 "bswap" } } */
-/* { dg-final { scan-tree-dump-times "64 bit bswap implementation found at" 3 "bswap" { xfail alpha*-*-* arm*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "64 bit bswap implementation found at" 3 "bswap" } } */
index c18ca6174d12a786a71252dfe47cfe78ca58750a..852ccfe5c1acd519f2cf340cc55f3ea74b1ec21f 100644 (file)
@@ -55,5 +55,4 @@ swap16 (HItype in)
 }
 
 /* { 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" 1 "bswap" { target alpha*-*-* arm*-*-* } } } */
-/* { dg-final { scan-tree-dump-times "16 bit bswap implementation found at" 4 "bswap" { xfail alpha*-*-* arm*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "16 bit bswap implementation found at" 4 "bswap" } } */
index a1558af2cc74adde439d42223b00977d9eeb9639..01ae3776ed3f44fbc300d001f8c67ec11625d03b 100644 (file)
@@ -45,4 +45,4 @@ uint32_t read_be32_3 (unsigned char *data)
 }
 
 /* { dg-final { scan-tree-dump-times "32 bit load in target endianness found at" 3 "bswap" } } */
-/* { dg-final { scan-tree-dump-times "32 bit bswap implementation found at" 3 "bswap" { xfail alpha*-*-* arm*-*-* } } } */
+/* { dg-final { scan-tree-dump-times "32 bit bswap implementation found at" 3 "bswap" } } */
index b28c808c55489ae1ae16c173d66c561c1897e6ab..a389dfcae14f35e3e5ec9d52c2a5bcf3b76c07e7 100644 (file)
@@ -2649,11 +2649,6 @@ bswap_replace (gimple *cur_stmt, gimple *src_stmt, tree fndecl,
 
       align = get_object_alignment (src);
 
-      if (bswap
-         && align < GET_MODE_ALIGNMENT (TYPE_MODE (load_type))
-         && SLOW_UNALIGNED_ACCESS (TYPE_MODE (load_type), align))
-       return false;
-
       /* Move cur_stmt just before  one of the load of the original
         to ensure it has the same VUSE.  See PR61517 for what could
         go wrong.  */