From: Avi Kivity <avi@redhat.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC] TCG new op: setcond
Date: Tue, 04 Nov 2008 16:24:29 +0200 [thread overview]
Message-ID: <49105B1D.6080901@redhat.com> (raw)
In-Reply-To: <761ea48b0811040215l3fa16cd6j41e7ee750602e6ea@mail.gmail.com>
Laurent Desnogues wrote:
> this patch implements a new TCG op, setcond, that sets a temp
> to 1 if the condition is true, else to 0. The benefit is the potential
> removal of brcond instructions, and helpers size reduction which
> can lead to using TCG instead of helpers.
>
> This patch is only posted here to get comments before I dig
> further into that and propose a proper update.
>
> One of the ARM helpers (sub with flag settings) has been
> converted to TCG and uses setcond to compute carry.
>
> setcond has been implemented only for x86_64 TCG back-end.
>
>
> +// TODO should apply to setcond_i64 but not tested
> +static void tcg_out_setcond(TCGContext *s, int cond,
> + TCGArg ret, TCGArg arg1, TCGArg arg2, int rexw)
> +{
> + /* clear ret since setcc only sets the lower 8 bits */
> + tcg_out_modrm(s, 0x01 | (ARITH_XOR << 3) | rexw, ret, ret);
> + /* cmp */
> + tcg_out_modrm(s, 0x01 | (ARITH_CMP << 3) | rexw, arg2, arg1);
> + /* setcc */
> + // TODO this should use tcg_out_modrm
> + // however currently tcg_out_modrm outputs an extra byte for [abcd]l
> + //tcg_out_modrm(s, (0x90 + tcg_cond_to_jcc[cond]) | P_EXT | P_REXB, ret, 0);
> + if (ret > 3)
> + tcg_out8(s, 0x40);
> + else if (ret > 7)
> + tcg_out8(s, 0x41);
>
if ret == 8 this fails. You need to reverse the order of the tests.
> + tcg_out8(s, 0x0f);
> + tcg_out8(s, 0x90 + tcg_cond_to_jcc[cond]);
> + tcg_out8(s, 0xc0 + (ret & 7));
> +}
> +
>
>
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2008-11-04 14:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-04 10:15 [Qemu-devel] [RFC] TCG new op: setcond Laurent Desnogues
2008-11-04 13:16 ` Paul Brook
2008-11-04 13:33 ` Laurent Desnogues
2008-11-04 14:24 ` Avi Kivity [this message]
2008-11-05 16:11 ` Laurent Desnogues
2008-11-09 10:50 ` Blue Swirl
-- strict thread matches above, loose matches on Subject: below --
2008-11-08 19:13 Laurent Desnogues
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=49105B1D.6080901@redhat.com \
--to=avi@redhat.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).