public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR tree-optimization/83195 testcase for arm
@ 2017-11-29  8:30 Jakub Jelinek
  2017-11-29 16:15 ` Kyrill Tkachov
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2017-11-29  8:30 UTC (permalink / raw)
  To: Rainer Orth, Mike Stump, Kyrill Tkachov; +Cc: gcc-patches

Hi!

The pr82929.c testcase uses store_merge effective target, which is
int32plus && nonstrict_align.  Unfortunately, arm is handled for
nonstrict_align wierdly, although it has STRICT_ALIGNMENT 1, it is sometimes
considered nonstrict_align (the only exception apparently).

Now, the testcase really needs a non-strict alignment target where
STRICT_ALIGNMENT is 0, otherwise the optimization it tests is not
beneficial.  So, the following patch stops testing it on arm, and adds
another test where the pointers are guaranteed to be aligned and thus we
can test for the optimization even on non-strict alignment targets.

Bootstrapped/regtested on x86_64-linux and i686-linux, tested by hand using
a cross-compiler to arm, ok for trunk?

2017-11-29  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/83195
	* gcc.dg/pr82929.c: Don't check for "Merging successful" on arm.
	* gcc.dg/pr82929-2.c: New test.

--- gcc/testsuite/gcc.dg/pr82929.c.jj	2017-11-10 15:42:39.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr82929.c	2017-11-28 17:50:43.705221829 +0100
@@ -15,4 +15,4 @@ foo (short *p, short *q, short *r)
   p[1] = e & f;
 }
 
-/* { dg-final { scan-tree-dump-times "Merging successful" 1 "store-merging" } } */
+/* { dg-final { scan-tree-dump-times "Merging successful" 1 "store-merging" { target { ! arm*-*-* } } } } */
--- gcc/testsuite/gcc.dg/pr82929-2.c.jj	2017-11-28 17:47:41.858409094 +0100
+++ gcc/testsuite/gcc.dg/pr82929-2.c	2017-11-28 17:48:55.264526160 +0100
@@ -0,0 +1,21 @@
+/* PR tree-optimization/82929 */
+/* { dg-do compile { target store_merge } } */
+/* { dg-options "-O2 -fdump-tree-store-merging" } */
+
+void
+foo (short *p, short *q, short *r)
+{
+  p = __builtin_assume_aligned (p, __alignof__ (int));
+  q = __builtin_assume_aligned (q, __alignof__ (int));
+  r = __builtin_assume_aligned (r, __alignof__ (int));
+  short a = q[0];
+  short b = q[1];
+  short c = ~a;
+  short d = r[0];
+  short e = r[1];
+  short f = ~b;
+  p[0] = c & d;
+  p[1] = e & f;
+}
+
+/* { dg-final { scan-tree-dump-times "Merging successful" 1 "store-merging" } } */

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix PR tree-optimization/83195 testcase for arm
  2017-11-29  8:30 [PATCH] Fix PR tree-optimization/83195 testcase for arm Jakub Jelinek
@ 2017-11-29 16:15 ` Kyrill Tkachov
  0 siblings, 0 replies; 2+ messages in thread
From: Kyrill Tkachov @ 2017-11-29 16:15 UTC (permalink / raw)
  To: Jakub Jelinek, Rainer Orth, Mike Stump; +Cc: gcc-patches

Hi Jakub,

On 29/11/17 08:18, Jakub Jelinek wrote:
> Hi!
>
> The pr82929.c testcase uses store_merge effective target, which is
> int32plus && nonstrict_align.  Unfortunately, arm is handled for
> nonstrict_align wierdly, although it has STRICT_ALIGNMENT 1, it is sometimes
> considered nonstrict_align (the only exception apparently).
>
> Now, the testcase really needs a non-strict alignment target where
> STRICT_ALIGNMENT is 0, otherwise the optimization it tests is not
> beneficial.  So, the following patch stops testing it on arm, and adds
> another test where the pointers are guaranteed to be aligned and thus we
> can test for the optimization even on non-strict alignment targets.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, tested by hand using
> a cross-compiler to arm, ok for trunk?
>
> 2017-11-29  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR tree-optimization/83195
> 	* gcc.dg/pr82929.c: Don't check for "Merging successful" on arm.
> 	* gcc.dg/pr82929-2.c: New test.
>
> --- gcc/testsuite/gcc.dg/pr82929.c.jj	2017-11-10 15:42:39.000000000 +0100
> +++ gcc/testsuite/gcc.dg/pr82929.c	2017-11-28 17:50:43.705221829 +0100
> @@ -15,4 +15,4 @@ foo (short *p, short *q, short *r)
>     p[1] = e & f;
>   }
>   
> -/* { dg-final { scan-tree-dump-times "Merging successful" 1 "store-merging" } } */
> +/* { dg-final { scan-tree-dump-times "Merging successful" 1 "store-merging" { target { ! arm*-*-* } } } } */
> --- gcc/testsuite/gcc.dg/pr82929-2.c.jj	2017-11-28 17:47:41.858409094 +0100
> +++ gcc/testsuite/gcc.dg/pr82929-2.c	2017-11-28 17:48:55.264526160 +0100
> @@ -0,0 +1,21 @@
> +/* PR tree-optimization/82929 */
> +/* { dg-do compile { target store_merge } } */
> +/* { dg-options "-O2 -fdump-tree-store-merging" } */
> +
> +void
> +foo (short *p, short *q, short *r)
> +{
> +  p = __builtin_assume_aligned (p, __alignof__ (int));
> +  q = __builtin_assume_aligned (q, __alignof__ (int));
> +  r = __builtin_assume_aligned (r, __alignof__ (int));
> +  short a = q[0];
> +  short b = q[1];
> +  short c = ~a;
> +  short d = r[0];
> +  short e = r[1];
> +  short f = ~b;
> +  p[0] = c & d;
> +  p[1] = e & f;
> +}
> +
> +/* { dg-final { scan-tree-dump-times "Merging successful" 1 "store-merging" } } */

Sudi has kindly tried it out and the new test passes on arm, so this 
patch is ok from an arm perspective.
Thanks for fixing this,
Kyrill

> 	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-29 15:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29  8:30 [PATCH] Fix PR tree-optimization/83195 testcase for arm Jakub Jelinek
2017-11-29 16:15 ` Kyrill Tkachov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).