qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Max Filippov <jcmvbkbc@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] target/xtensa: rework zero overhead loops implementation
Date: Sat, 12 Jan 2019 08:11:11 +1100	[thread overview]
Message-ID: <e61a4039-cf71-973d-0a11-b77c6c7eed75@linaro.org> (raw)
In-Reply-To: <20190111114918.27893-1-jcmvbkbc@gmail.com>

On 1/11/19 10:49 PM, Max Filippov wrote:
> @@ -706,6 +716,17 @@ static inline void cpu_get_tb_cpu_state(CPUXtensaState *env, target_ulong *pc,
>      *flags |= xtensa_get_ring(env);
>      if (env->sregs[PS] & PS_EXCM) {
>          *flags |= XTENSA_TBFLAG_EXCM;
> +    } else if (xtensa_option_enabled(env->config, XTENSA_OPTION_LOOP)) {
> +        target_ulong lend_dist = env->sregs[LEND] - (env->pc & LINKABLE_MASK);
> +
> +        if (lend_dist < LINKABLE_SIZE + env->config->max_insn_size) {
> +            target_ulong lbeg_off = env->sregs[LEND] - env->sregs[LBEG];
> +
> +            *cs_base = lend_dist;
> +            if (lbeg_off < 256) {
> +                *cs_base |= lbeg_off << XTENSA_CSBASE_LBEG_OFF_SHIFT;
> +            }
> +        }
>      }
>      if (xtensa_option_enabled(env->config, XTENSA_OPTION_EXTENDED_L32R) &&
>              (env->sregs[LITBASE] & 1)) {

I think the only other thing that would be nice is some comment that describes
the loop scheme.  I can follow it now, but it took a while of re-reading.  In
particular, the fact that 0 means "disabled", and happens to work because we
(correctly) only check for LEND at the end of an instruction.  Thus the offset
from pc_first will always be non-zero when we check.


r~

      parent reply	other threads:[~2019-01-11 21:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 11:49 [Qemu-devel] [PATCH] target/xtensa: rework zero overhead loops implementation Max Filippov
2019-01-11 20:53 ` Richard Henderson
2019-01-11 20:59   ` Max Filippov
2019-01-11 21:11 ` Richard Henderson [this message]

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=e61a4039-cf71-973d-0a11-b77c6c7eed75@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=jcmvbkbc@gmail.com \
    --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).