Fix bogus store_merging_x.c failures for avr.
authorSenthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
Tue, 8 Nov 2016 06:30:31 +0000 (06:30 +0000)
committerSenthil Kumar Selvaraj <saaadhu@gcc.gnu.org>
Tue, 8 Nov 2016 06:30:31 +0000 (06:30 +0000)
Store merging isn't profitable for the avr. Add a new
effective target keyword "store_merge", and turn it on
only if non_strict_align *and* int32plus, as targets with
smallish word sizes are unlikely to profit from this optimization.

gcc/testsuite/ChangeLog

2016-11-03  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>

* gcc.dg/store_merging_1.c: Require store_merge.
* gcc.dg/store_merging_2.c: Likewise.
* gcc.dg/store_merging_4.c: Likewise.
* gcc.dg/store_merging_5.c: Likewise.
* gcc.dg/store_merging_6.c: Likewise.
* gcc.dg/store_merging_7.c: Likewise.
* gcc.dg/store_merging_8.c: Likewise.
* lib/target-supports.exp (check_effective_target_store_merge): New.

From-SVN: r241953

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/store_merging_1.c
gcc/testsuite/gcc.dg/store_merging_2.c
gcc/testsuite/gcc.dg/store_merging_4.c
gcc/testsuite/gcc.dg/store_merging_5.c
gcc/testsuite/gcc.dg/store_merging_6.c
gcc/testsuite/gcc.dg/store_merging_7.c
gcc/testsuite/gcc.dg/store_merging_8.c
gcc/testsuite/lib/target-supports.exp

index bb0d2c99e6c9e62054bdf95d2fb430a509ab904e..ba30991faff6ec8e48101b1f92c18938ed5c7764 100644 (file)
@@ -1,3 +1,14 @@
+2016-11-08  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
+
+       * gcc.dg/store_merging_1.c: Require store_merge.
+       * gcc.dg/store_merging_2.c: Likewise.
+       * gcc.dg/store_merging_4.c: Likewise.
+       * gcc.dg/store_merging_5.c: Likewise. 
+       * gcc.dg/store_merging_6.c: Likewise.
+       * gcc.dg/store_merging_7.c: Likewise.
+       * gcc.dg/store_merging_8.c: Likewise.
+       * lib/target-supports.exp (check_effective_target_store_merge): New.
+
 2016-11-07  David Edelsohn  <dje.gcc@gmail.com>
 
        * gcc.target/powerpc/fold-vec-add-1.c: Add dg-options -maltivec.
index 35f4d82e6b22a231f1d7c6b3688a4bbcb57d2510..4cc43dfd9e17ddc0984bd263708a96a8be1fd035 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target non_strict_align } */
+/* { dg-require-effective-target store_merge } */
 /* { dg-options "-O2 -fdump-tree-store-merging" } */
 
 struct bar {
index 8e2acf390891284d96f646efd2b025a2ad7cb87d..8cd29f4243c15730224156ca4bb8dc233f615aef 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-require-effective-target non_strict_align } */
+/* { dg-require-effective-target store_merge } */
 /* { dg-options "-O2 -fdump-tree-store-merging" } */
 
 struct bar
index a3d67697d6418ba0cd8aaad2f92d9ea720ec7ffc..719c2c038e4520b150808e11d1ac55984f279361 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target non_strict_align } */
+/* { dg-require-effective-target store_merge } */
 /* { dg-options "-O2 -fdump-tree-store-merging" } */
 
 /* Check that we can merge interleaving stores that are guaranteed
index 4ffe512b842b81d97d0158cb765669758c5ff898..e6c349767bc6c67bfe5e36ff5828edf99d87301f 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target non_strict_align } */
+/* { dg-require-effective-target store_merge } */
 /* { dg-options "-O2 -fdump-tree-store-merging" } */
 
 /* Make sure that non-aliasing non-constant interspersed stores do not
index 42b5c4f92dc8e99ec1a84cec4ce557eeaeab8d18..314829da6d3c1d1e3f78cbec13f41927f4018ed8 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-require-effective-target non_strict_align } */
+/* { dg-require-effective-target store_merge } */
 /* { dg-options "-O2 -fdump-tree-store-merging" } */
 
 /* Check that we can widen accesses to bitfields.  */
index 4be352fef4a61d97f0e95784f5061f7fc124b937..c744ece64073821bdfa7cfeb5a601beca0c12c9d 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target non_strict_align } */
+/* { dg-require-effective-target store_merge } */
 /* { dg-options "-O2 -fdump-tree-store-merging" } */
 
 /* Check that we can merge consecutive array members through the pointer.
index 15e80c7d9533c40f0159241eb6fd1953d017fbe9..e710a544ff0591a53f2977c835265417ab0e4e4a 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-require-effective-target non_strict_align } */
+/* { dg-require-effective-target store_merge } */
 /* { dg-options "-O2 -fdump-tree-store-merging" } */
 
 struct baz {
index 24a067d039c2d4cd4ce1c313b7cc2a791e2dcc03..b683c09c1db0eb9edd73f2e2e824d6b0368df3fe 100644 (file)
@@ -8107,3 +8107,17 @@ proc check_effective_target_divmod_simode { } {
 
     return [check_effective_target_divmod]
 }
+
+# Return 1 if store merging optimization is applicable for target.
+# Store merging is not profitable for targets like the avr which
+# can load/store only one byte at a time. Use int size as a proxy
+# for the number of bytes the target can write, and skip for targets
+# with a smallish (< 32) size.
+
+proc check_effective_target_store_merge { } {
+    if { [is-effective-target non_strict_align ] && [is-effective-target int32plus] } {
+       return 1
+    }
+
+    return 0
+}