public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Carlotti <andrew.carlotti@arm.com>
To: Matthieu Longo <matthieu.longo@arm.com>
Cc: binutils@sourceware.org,
	Richard Earnshaw <richard.earnshaw@arm.com>,
	Nick Clifton <nickc@redhat.com>
Subject: Re: [PATCH v1 4/4] aarch64: testsuite: share test utils macros and use them
Date: Tue, 27 Feb 2024 16:31:09 +0000	[thread overview]
Message-ID: <ca00a6d0-86c7-37bc-bd14-b1a832a9e61f@e124511.cambridge.arm.com> (raw)
In-Reply-To: <20240227105917.295899-5-matthieu.longo@arm.com>

On Tue, Feb 27, 2024 at 10:59:17AM +0000, Matthieu Longo wrote:
> 
> This patch rewrites assembly tests to use utils macros declared in
> sysreg-test-utils.inc. Some tests were adapted to use the new macro
> rw_sys_reg.
> ---
>  .../aarch64/sysreg/armv8_9-a-sysregs-bad.d    |   2 +-
>  .../aarch64/sysreg/armv8_9-a-sysregs-bad.l    |  90 ++++-
>  .../gas/aarch64/sysreg/armv8_9-a-sysregs.d    |   3 +-
>  .../gas/aarch64/sysreg/armv8_9-a-sysregs.s    | 139 +++----
>  .../gas/aarch64/sysreg/illegal-sysreg-3.d     |   2 +-
>  .../gas/aarch64/sysreg/illegal-sysreg-4.d     |   2 +-
>  gas/testsuite/gas/aarch64/sysreg/sysreg-1.d   |   2 +
>  gas/testsuite/gas/aarch64/sysreg/sysreg-1.s   | 223 ++++++------
>  gas/testsuite/gas/aarch64/sysreg/sysreg-2.d   |   3 +-
>  gas/testsuite/gas/aarch64/sysreg/sysreg-2.s   |  47 ++-
>  gas/testsuite/gas/aarch64/sysreg/sysreg-3.d   |   3 +-
>  gas/testsuite/gas/aarch64/sysreg/sysreg-3.s   |  25 +-
>  gas/testsuite/gas/aarch64/sysreg/sysreg-6.d   |   2 +
>  gas/testsuite/gas/aarch64/sysreg/sysreg-6.s   |   7 +-
>  gas/testsuite/gas/aarch64/sysreg/sysreg-7.d   |   2 +
>  gas/testsuite/gas/aarch64/sysreg/sysreg-7.s   |  32 +-
>  gas/testsuite/gas/aarch64/sysreg/sysreg-8.d   |   2 +
>  gas/testsuite/gas/aarch64/sysreg/sysreg-8.s   | 339 +++++++++---------
>  .../gas/aarch64/sysreg/sysreg-test-utils.inc  |  32 ++
>  gas/testsuite/gas/aarch64/sysreg/sysreg.d     |   6 +-
>  gas/testsuite/gas/aarch64/sysreg/sysreg.s     |  63 ++--
>  gas/testsuite/gas/aarch64/sysreg/sysreg128.d  |  42 +--
>  gas/testsuite/gas/aarch64/sysreg/sysreg128.s  |  27 +-
>  23 files changed, 576 insertions(+), 519 deletions(-)
>  create mode 100644 gas/testsuite/gas/aarch64/sysreg/sysreg-test-utils.inc
> 
...
> diff --git a/gas/testsuite/gas/aarch64/sysreg/armv8_9-a-sysregs.s b/gas/testsuite/gas/aarch64/sysreg/armv8_9-a-sysregs.s
> index bf9019c9ac8..318d8bb9097 100644
> --- a/gas/testsuite/gas/aarch64/sysreg/armv8_9-a-sysregs.s
> +++ b/gas/testsuite/gas/aarch64/sysreg/armv8_9-a-sysregs.s
> @@ -1,32 +1,23 @@
> -	msr PMSDSFR_EL1, x3
> -	mrs x3, PMSDSFR_EL1
> +	.include "sysreg-test-utils.inc"
> +
> +.text
> +	rw_sys_reg sys_reg=PMSDSFR_EL1 xreg=x3 r=1 w=1
>  
>  	mrs x0, ERXGSR_EL1
>  
> -	msr SCTLR2_EL1, x3
> -	mrs x3, SCTLR2_EL1
> -	msr SCTLR2_EL12, x3
> -	mrs x3, SCTLR2_EL12
> -	msr SCTLR2_EL2, x3
> -	mrs x3, SCTLR2_EL2
> -	msr SCTLR2_EL3, x3
> -	mrs x3, SCTLR2_EL3
> -
> -	msr HDFGRTR2_EL2, x3
> -	mrs x3, HDFGRTR2_EL2
> -	msr HDFGWTR2_EL2, x3
> -	mrs x3, HDFGWTR2_EL2
> -	msr HFGRTR2_EL2, x3
> -	mrs x3, HFGRTR2_EL2
> -	msr HFGWTR2_EL2, x3
> -	mrs x3, HFGWTR2_EL2
> -
> -	msr PFAR_EL1, x0
> -	mrs x0, PFAR_EL1
> -	msr PFAR_EL2, x0
> -	mrs x0, PFAR_EL2
> -	msr PFAR_EL12, x0
> -	mrs x0, PFAR_EL12
> +	rw_sys_reg sys_reg=SCTLR2_EL1 xreg=x3 r=1 w=1
> +	rw_sys_reg sys_reg=SCTLR2_EL12 xreg=x3 r=1 w=1
> +	rw_sys_reg sys_reg=SCTLR2_EL2 xreg=x3 r=1 w=1
> +	rw_sys_reg sys_reg=SCTLR2_EL3 xreg=x3 r=1 w=1
> +
> +	rw_sys_reg sys_reg=HDFGRTR2_EL2 xreg=x3 r=1 w=1
> +	rw_sys_reg sys_reg=HDFGWTR2_EL2 xreg=x3 r=1 w=1
> +	rw_sys_reg sys_reg=HFGRTR2_EL2 xreg=x3 r=1 w=1
> +	rw_sys_reg sys_reg=HFGWTR2_EL2 xreg=x3 r=1 w=1
> +
> +	rw_sys_reg sys_reg=PFAR_EL1 xreg=x0 r=1 w=1
> +	rw_sys_reg sys_reg=PFAR_EL2 xreg=x0 r=1 w=1
> +	rw_sys_reg sys_reg=PFAR_EL12 xreg=x0 r=1 w=1

This may be just my preference, and I know you're just extending existing
practice here, but I'm not keen on hiding the actual instructions away behind
macros (especially if there's little or no reduction in the size of the
assembly file).  I think it makes it harder to check that the input assembly
matches the output assembly, and I've seen several cases recently where such
discrepancies were missed.  It also adds lots of macro invocation messages to
the error check files.

In the case of a large multidimensional cross-product of operand values it
might make more sense to use macros, but in that case you'd still need to check
and include the full assembly contents in the .d file.   You can probably get
equally effective test coverage in most cases by just checking each dimension
separately anyway.

  reply	other threads:[~2024-02-27 16:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 10:59 [PATCH v1 0/4][Binutils] aarch64: testsuite: refactoring of some tests to share test macros Matthieu Longo
2024-02-27 10:59 ` [PATCH v1 1/4] aarch64: testsuite: replace instruction addresses by regex Matthieu Longo
2024-05-10 10:34   ` Richard Earnshaw (lists)
2024-02-27 10:59 ` [PATCH v1 2/4] aarch64: testsuite: use same regs for read and write tests Matthieu Longo
2024-05-10 10:37   ` Richard Earnshaw (lists)
2024-02-27 10:59 ` [PATCH v1 3/4] aarch64: testsuite: reorder write and read to match macro order Matthieu Longo
2024-05-10 10:40   ` Richard Earnshaw (lists)
2024-02-27 10:59 ` [PATCH v1 4/4] aarch64: testsuite: share test utils macros and use them Matthieu Longo
2024-02-27 16:31   ` Andrew Carlotti [this message]
2024-03-01 10:10     ` Matthieu Longo
2024-03-04 14:43       ` Andrew Carlotti
2024-05-10 10:34         ` Richard Earnshaw (lists)
2024-05-10 10:42   ` Richard Earnshaw (lists)
2024-04-24 10:48 ` [PATCH v1 0/4][Binutils] aarch64: testsuite: refactoring of some tests to share test macros Matthieu Longo

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=ca00a6d0-86c7-37bc-bd14-b1a832a9e61f@e124511.cambridge.arm.com \
    --to=andrew.carlotti@arm.com \
    --cc=binutils@sourceware.org \
    --cc=matthieu.longo@arm.com \
    --cc=nickc@redhat.com \
    --cc=richard.earnshaw@arm.com \
    /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).