qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 13/14] target/arm: Implement the CPY* instructions
Date: Sat, 9 Sep 2023 10:06:17 -0700	[thread overview]
Message-ID: <28b64da1-6c0f-012e-1af9-ac27a8581f6f@linaro.org> (raw)
In-Reply-To: <20230907160340.260094-14-peter.maydell@linaro.org>

On 9/7/23 09:03, Peter Maydell wrote:
> +void HELPER(cpyp)(CPUARMState *env, uint32_t syndrome, uint32_t wdesc,
> +                  uint32_t rdesc, uint32_t move)
> +{
> +    int rd = mops_destreg(syndrome);
> +    int rs = mops_srcreg(syndrome);
> +    int rn = mops_sizereg(syndrome);
> +    uint32_t rmemidx = FIELD_EX32(rdesc, MTEDESC, MIDX);
> +    uint32_t wmemidx = FIELD_EX32(wdesc, MTEDESC, MIDX);
> +    bool forwards = true;
> +    uintptr_t ra = GETPC();
> +    uint64_t toaddr = env->xregs[rd];
> +    uint64_t fromaddr = env->xregs[rs];
> +    uint64_t copysize = env->xregs[rn];
> +    uint64_t stagecopysize, step;
> +
> +    check_mops_enabled(env, ra);
> +
> +    if (copysize > 0x007FFFFFFFFFFFFFULL) {
> +        copysize = 0x007FFFFFFFFFFFFFULL;
> +    }

CPYFP does not have the same saturation as CPYP.

Again, you would do better if 'move' was a parameter for an inline, so that the tests can 
be folded away.

> +void HELPER(cpym)(CPUARMState *env, uint32_t syndrome, uint32_t wdesc,
> +                  uint32_t rdesc, uint32_t move)
> +{
> +    /* Main: we choose to copy until less than a page remaining */
> +    CPUState *cs = env_cpu(env);
> +    int rd = mops_destreg(syndrome);
> +    int rs = mops_srcreg(syndrome);
> +    int rn = mops_sizereg(syndrome);
> +    uint32_t rmemidx = FIELD_EX32(rdesc, MTEDESC, MIDX);
> +    uint32_t wmemidx = FIELD_EX32(wdesc, MTEDESC, MIDX);
> +    uintptr_t ra = GETPC();
> +    bool forwards;
> +    uint64_t toaddr, fromaddr, copysize, step;
> +
> +    check_mops_enabled(env, ra);
> +
> +    /* We choose to NOP out "no data to copy" before consistency checks */
> +    if (env->xregs[rn] == 0) {
> +        return;
> +    }
> +
> +    check_mops_wrong_option(env, syndrome, ra);
> +
> +    if ((int64_t)env->xregs[rn] < 0) {
> +        forwards = true;
> +        toaddr = env->xregs[rd] + env->xregs[rn];
> +        fromaddr = env->xregs[rs] + env->xregs[rn];
> +        copysize = -env->xregs[rn];
> +    } else {
> +        forwards = false;
> +        copysize = env->xregs[rn];
> +        /* This toaddr and fromaddr point to the *last* byte to copy */
> +        toaddr = env->xregs[rd] + copysize - 1;
> +        fromaddr = env->xregs[rs] + copysize - 1;
> +    }

You're passing 'move' but not using it.  I would have expected that here.


r~


  reply	other threads:[~2023-09-09 17:07 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-07 16:03 [PATCH 00/14] target/arm: Implement FEAT_MOPS Peter Maydell
2023-09-07 16:03 ` [PATCH 01/14] target/arm: Remove unused allocation_tag_mem() argument Peter Maydell
2023-09-08 14:12   ` Philippe Mathieu-Daudé
2023-09-07 16:03 ` [PATCH 02/14] target/arm: Don't skip MTE checks for LDRT/STRT at EL0 Peter Maydell
2023-09-08 19:53   ` Richard Henderson
2023-09-07 16:03 ` [PATCH 03/14] target/arm: Add ID_AA64ISAR2_EL1 Peter Maydell
2023-09-08 14:14   ` Philippe Mathieu-Daudé
2023-09-07 16:03 ` [PATCH 04/14] target/arm: Implement FEAT_MOPS enable bits Peter Maydell
2023-09-08 20:56   ` Richard Henderson
2023-09-07 16:03 ` [PATCH 05/14] target/arm: Pass unpriv bool to get_a64_user_mem_index() Peter Maydell
2023-09-08 14:19   ` Philippe Mathieu-Daudé
2023-09-08 20:45   ` Richard Henderson
2023-09-07 16:03 ` [PATCH 06/14] target/arm: Define syndrome function for MOPS exceptions Peter Maydell
2023-09-08 20:45   ` Richard Henderson
2023-09-07 16:03 ` [PATCH 07/14] target/arm: New function allocation_tag_mem_probe() Peter Maydell
2023-09-08 20:51   ` Richard Henderson
2023-09-07 16:03 ` [PATCH 08/14] target/arm: Implement MTE tag-checking functions for FEAT_MOPS Peter Maydell
2023-09-08 20:52   ` Richard Henderson
2023-09-07 16:03 ` [PATCH 09/14] target/arm: Implement the SET* instructions Peter Maydell
2023-09-09 15:58   ` Richard Henderson
2023-09-07 16:03 ` [PATCH 10/14] target/arm: Define new TB flag for ATA0 Peter Maydell
2023-09-09 16:03   ` Richard Henderson
2023-09-07 16:03 ` [PATCH 11/14] target/arm: Implement the SETG* instructions Peter Maydell
2023-09-09 16:38   ` Richard Henderson
2023-09-11 14:17     ` Peter Maydell
2023-09-11 21:17       ` Richard Henderson
2023-09-07 16:03 ` [PATCH 12/14] target/arm: Implement MTE tag-checking functions for FEAT_MOPS copies Peter Maydell
2023-09-09 16:42   ` Richard Henderson
2023-09-07 16:03 ` [PATCH 13/14] target/arm: Implement the CPY* instructions Peter Maydell
2023-09-09 17:06   ` Richard Henderson [this message]
2023-09-12 12:27     ` Peter Maydell
2023-09-07 16:03 ` [PATCH 14/14] target/arm: Enable FEAT_MOPS for CPU 'max' Peter Maydell
2023-09-09 16:53   ` Richard Henderson

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=28b64da1-6c0f-012e-1af9-ac27a8581f6f@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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 NNTP newsgroup(s).