diff mbox

[testsuite] Add new effective-target_store_merge

Message ID 87wpgkzzbp.fsf@atmel.com
State New
Headers show

Commit Message

Senthil Kumar Selvaraj Nov. 3, 2016, 9:29 a.m. UTC
Hi,

  The below patch adds a new effective target keyword (store_merge) for
  use in the store_merging_xxx.c tests.

  The tests currently require non_strict_align, but they still fail for the avr.
  Eyeballing the dump, I found that the pass doesn't attempt merging as it is
  unprofitable for a target like the avr which has only single byte
  stores.

  I figured store merging is unlikely to be profitable for targets with
  smallish word sizes, and added a check_effective_target_store_merge
  that combines non_strict_align and int32plus.

  Is this ok for trunk?

Regards
Senthil

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.

Comments

Mike Stump Nov. 3, 2016, 4:58 p.m. UTC | #1
On Nov 3, 2016, at 2:29 AM, Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> wrote:
> 
>  The below patch adds a new effective target keyword (store_merge) for
>  use in the store_merging_xxx.c tests.
> 
>  The tests currently require non_strict_align, but they still fail for the avr.
>  Eyeballing the dump, I found that the pass doesn't attempt merging as it is
>  unprofitable for a target like the avr which has only single byte
>  stores.
> 
>  I figured store merging is unlikely to be profitable for targets with
>  smallish word sizes, and added a check_effective_target_store_merge
>  that combines non_strict_align and int32plus.
> 
>  Is this ok for trunk?

Ok.

If anyone knows of a reason why this would turn off these tests for a target that currently tests them and works ok, let us know.
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/store_merging_1.c
===================================================================
--- gcc/testsuite/gcc.dg/store_merging_1.c	(revision 241808)
+++ gcc/testsuite/gcc.dg/store_merging_1.c	(working copy)
@@ -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: gcc/testsuite/gcc.dg/store_merging_2.c
===================================================================
--- gcc/testsuite/gcc.dg/store_merging_2.c	(revision 241808)
+++ gcc/testsuite/gcc.dg/store_merging_2.c	(working copy)
@@ -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: gcc/testsuite/gcc.dg/store_merging_4.c
===================================================================
--- gcc/testsuite/gcc.dg/store_merging_4.c	(revision 241808)
+++ gcc/testsuite/gcc.dg/store_merging_4.c	(working copy)
@@ -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: gcc/testsuite/gcc.dg/store_merging_5.c
===================================================================
--- gcc/testsuite/gcc.dg/store_merging_5.c	(revision 241808)
+++ gcc/testsuite/gcc.dg/store_merging_5.c	(working copy)
@@ -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: gcc/testsuite/gcc.dg/store_merging_6.c
===================================================================
--- gcc/testsuite/gcc.dg/store_merging_6.c	(revision 241808)
+++ gcc/testsuite/gcc.dg/store_merging_6.c	(working copy)
@@ -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: gcc/testsuite/gcc.dg/store_merging_7.c
===================================================================
--- gcc/testsuite/gcc.dg/store_merging_7.c	(revision 241808)
+++ gcc/testsuite/gcc.dg/store_merging_7.c	(working copy)
@@ -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: gcc/testsuite/gcc.dg/store_merging_8.c
===================================================================
--- gcc/testsuite/gcc.dg/store_merging_8.c	(revision 241808)
+++ gcc/testsuite/gcc.dg/store_merging_8.c	(working copy)
@@ -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: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	(revision 241808)
+++ gcc/testsuite/lib/target-supports.exp	(working copy)
@@ -8107,3 +8107,16 @@ 
 
     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
+}