From: Alexander Graf <agraf@suse.de>
To: Richard Henderson <rth@twiddle.net>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] s390x: Add laa and laag instructions
Date: Tue, 12 May 2015 21:22:05 +0200 [thread overview]
Message-ID: <555252DD.2040102@suse.de> (raw)
In-Reply-To: <55517954.8010308@twiddle.net>
On 05/12/2015 05:53 AM, Richard Henderson wrote:
> 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.
Well, alternatively I could try to make out be the memory value at the
end of the op and invent new load/store helpers for atomic instructions.
That way the op bit should shrink significantly and we get the correct
operand in s->out automatically.
>
> 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.
That's an interesting idea. Let me see what I can pull off.
Alex
next prev parent reply other threads:[~2015-05-12 19:22 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
2015-05-12 19:22 ` Alexander Graf [this message]
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=555252DD.2040102@suse.de \
--to=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).