From 06658c6d05b360dfb85b173d67975603d5e960f3 Mon Sep 17 00:00:00 2001 From: Senthil Kumar Selvaraj Date: Tue, 8 Nov 2016 06:30:31 +0000 Subject: [PATCH] Fix bogus store_merging_x.c failures for avr. 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 * 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 | 11 +++++++++++ gcc/testsuite/gcc.dg/store_merging_1.c | 2 +- gcc/testsuite/gcc.dg/store_merging_2.c | 2 +- gcc/testsuite/gcc.dg/store_merging_4.c | 2 +- gcc/testsuite/gcc.dg/store_merging_5.c | 2 +- gcc/testsuite/gcc.dg/store_merging_6.c | 2 +- gcc/testsuite/gcc.dg/store_merging_7.c | 2 +- gcc/testsuite/gcc.dg/store_merging_8.c | 2 +- gcc/testsuite/lib/target-supports.exp | 14 ++++++++++++++ 9 files changed, 32 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bb0d2c99e6c..ba30991faff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2016-11-08 Senthil Kumar Selvaraj + + * 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 * gcc.target/powerpc/fold-vec-add-1.c: Add dg-options -maltivec. diff --git a/gcc/testsuite/gcc.dg/store_merging_1.c b/gcc/testsuite/gcc.dg/store_merging_1.c index 35f4d82e6b2..4cc43dfd9e1 100644 --- a/gcc/testsuite/gcc.dg/store_merging_1.c +++ b/gcc/testsuite/gcc.dg/store_merging_1.c @@ -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 { diff --git a/gcc/testsuite/gcc.dg/store_merging_2.c b/gcc/testsuite/gcc.dg/store_merging_2.c index 8e2acf39089..8cd29f4243c 100644 --- a/gcc/testsuite/gcc.dg/store_merging_2.c +++ b/gcc/testsuite/gcc.dg/store_merging_2.c @@ -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 diff --git a/gcc/testsuite/gcc.dg/store_merging_4.c b/gcc/testsuite/gcc.dg/store_merging_4.c index a3d67697d64..719c2c038e4 100644 --- a/gcc/testsuite/gcc.dg/store_merging_4.c +++ b/gcc/testsuite/gcc.dg/store_merging_4.c @@ -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 diff --git a/gcc/testsuite/gcc.dg/store_merging_5.c b/gcc/testsuite/gcc.dg/store_merging_5.c index 4ffe512b842..e6c349767bc 100644 --- a/gcc/testsuite/gcc.dg/store_merging_5.c +++ b/gcc/testsuite/gcc.dg/store_merging_5.c @@ -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 diff --git a/gcc/testsuite/gcc.dg/store_merging_6.c b/gcc/testsuite/gcc.dg/store_merging_6.c index 42b5c4f92dc..314829da6d3 100644 --- a/gcc/testsuite/gcc.dg/store_merging_6.c +++ b/gcc/testsuite/gcc.dg/store_merging_6.c @@ -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. */ diff --git a/gcc/testsuite/gcc.dg/store_merging_7.c b/gcc/testsuite/gcc.dg/store_merging_7.c index 4be352fef4a..c744ece6407 100644 --- a/gcc/testsuite/gcc.dg/store_merging_7.c +++ b/gcc/testsuite/gcc.dg/store_merging_7.c @@ -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. diff --git a/gcc/testsuite/gcc.dg/store_merging_8.c b/gcc/testsuite/gcc.dg/store_merging_8.c index 15e80c7d953..e710a544ff0 100644 --- a/gcc/testsuite/gcc.dg/store_merging_8.c +++ b/gcc/testsuite/gcc.dg/store_merging_8.c @@ -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 { diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 24a067d039c..b683c09c1db 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -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 +} -- 2.30.2