public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Christophe Lyon <christophe.lyon@linaro.org>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] testsuite/arm: Fix scan-assembler-times in pr96770.c with movt/movw
Date: Mon, 29 Mar 2021 09:01:21 +0000	[thread overview]
Message-ID: <1617008481-18633-1-git-send-email-christophe.lyon@linaro.org> (raw)

The previous change to this testcase missed the fact that the data may
be accessed via an anchor, depending on the optimization level,
leading to false failures.

This patch restricts matching to upper16:lower16 followed by
non-spaces, followed by +4 (in f4) or +320 (in f5).

Using '.*' instead of '[^ \]' would match accross the whole assembly
file, which is not what we want, hence the limitation with spaces.

2021-03-29  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	PR target/96770
	* gcc.target/arm/pure-code/pr96770.c: Fix scan-assembler-times
	with movt/movw.
---
 gcc/testsuite/gcc.target/arm/pure-code/pr96770.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c b/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c
index ae1bd10..3c69614 100644
--- a/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c
+++ b/gcc/testsuite/gcc.target/arm/pure-code/pr96770.c
@@ -4,12 +4,13 @@
 int arr[1000];
 int *f4 (void) { return &arr[1]; }
 
-/* For cortex-m0 (thumb-1/v6m), we generate 4 movs with upper/lower:#arr+4.  */
+/* For cortex-m0 (thumb-1/v6m), we generate 2 pairs of movs/adds with upper/lower:#arr+4.  */
 /* { dg-final { scan-assembler-times "arr\\+4" 4 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */
 
 /* For cortex-m with movt/movw (thumb-1/v8m.base or thumb-2), we
-   generate a movt/movw pair with upper/lower:#arr+4.  */
-/* { dg-final { scan-assembler-times "arr\\+4" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
+   generate a movt/movw pair with upper/lower:#arr+4 possibly via an anchor.  */
+/* { dg-final { scan-assembler-times "upper16:\[^ \]+.\\+4" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
+/* { dg-final { scan-assembler-times "lower16:\[^ \]+\\+4" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
 
 int *f5 (void) { return &arr[80]; }
 
@@ -17,5 +18,6 @@ int *f5 (void) { return &arr[80]; }
 /* { dg-final { scan-assembler-times "arr\\+320" 1 { target { { ! arm_thumb1_movt_ok } && { ! arm_thumb2_ok } } } } } */
 
 /* For cortex-m with movt/movw (thumb-1/v8m.base or thumb-2), we
-   generate a movt/movw pair with upper/lower:arr+320.  */
-/* { dg-final { scan-assembler-times "arr\\+320" 2 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
+   generate a movt/movw pair with upper/lower:arr+320 possibly via an anchor.  */
+/* { dg-final { scan-assembler-times "upper16:\[^ \]+\\+320" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
+/* { dg-final { scan-assembler-times "lower16:\[^ \]+\\+320" 1 { target { arm_thumb1_movt_ok || arm_thumb2_ok } } } } */
-- 
2.7.4


             reply	other threads:[~2021-03-29  9:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29  9:01 Christophe Lyon [this message]
2021-04-06 12:02 ` Christophe Lyon
2021-04-12  8:34   ` Christophe Lyon
2021-04-16 17:51 ` Richard Sandiford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1617008481-18633-1-git-send-email-christophe.lyon@linaro.org \
    --to=christophe.lyon@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).