qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Alexander Graf <agraf@suse.de>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] s390x: Add laa and laag instructions
Date: Mon, 11 May 2015 20:53:56 -0700	[thread overview]
Message-ID: <55517954.8010308@twiddle.net> (raw)
In-Reply-To: <1431047528-81504-2-git-send-email-agraf@suse.de>

On 05/07/2015 06:12 PM, Alexander Graf wrote:
> +static ExitStatus op_laa(DisasContext *s, DisasOps *o)
> +{
> +    TCGv_i64 m2 = tcg_temp_new_i64();
> +
> +    /* XXX should be atomic */
> +    tcg_gen_qemu_ld32s(m2, o->in2, get_mem_index(s));
> +
> +    /* Set r1 to the unmodified contents of m2 */
> +    tcg_gen_mov_i64(o->out, m2);
> +
> +    /* m2 = r3 + m2 */
> +    tcg_gen_add_i64(m2, o->in1, m2);
> +    tcg_gen_qemu_st32(m2, o->in2, get_mem_index(s));
> +
> +    /* Set in2 to the input operand for cc calculation */
> +    tcg_gen_mov_i64(o->in2, o->out);
> +
> +    tcg_temp_free_i64(m2);
> +    return NO_EXIT;
> +}

I don't believe that this computes the right cc.
You need to place m2 into in2, not out.

That said, maybe

  tcg_temp_free_i64(o->in2);
  o->in2 = m2;

is the right way to perform that copy.  Since we
know that in2 was in2_a2, allocating a temp for an
address, we also know we can both (1) free it and
(2) put another temp in there that will be freed.

Don't worry about the atomic-ness of the operation
until some of the many patch sets going round on
that very subject are resolved.  This will be good
enough for system mode for now.

I think maybe the whole target ought to be cleaned
up for the new TCGMemOps.  For this, you could share
the code for LAA and LAAG with the TCGMemOp in insn->data.


r~

  reply	other threads:[~2015-05-12  3:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08  1:12 [Qemu-devel] [PATCH 1/2] s390x: Add some documentation in opcode list Alexander Graf
2015-05-08  1:12 ` [Qemu-devel] [PATCH 2/2] s390x: Add laa and laag instructions Alexander Graf
2015-05-12  3:53   ` Richard Henderson [this message]
2015-05-12 19:22     ` Alexander Graf
2015-05-12  3:37 ` [Qemu-devel] [PATCH 1/2] s390x: Add some documentation in opcode list 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=55517954.8010308@twiddle.net \
    --to=rth@twiddle.net \
    --cc=agraf@suse.de \
    --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).