From: Richard Henderson <rth@twiddle.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2 05/11] target-arm: Implement ccmp branchless
Date: Mon, 7 Sep 2015 22:18:17 -0700 [thread overview]
Message-ID: <55EE6F99.9040309@twiddle.net> (raw)
In-Reply-To: <CAFEAcA_JxkqqD3E25a3a5YqKinxJHb22Q4JC9oA51swdU-txJw@mail.gmail.com>
On 09/07/2015 10:31 AM, Peter Maydell wrote:
>> - if (cond < 0x0e) { /* continue */
>> - gen_set_label(label_continue);
>> + /* If COND was false, force the flags to #nzcv.
>> + Note that T1 = (COND ? 0 : -1), T2 = (COND ? -1 : 0). */
>> + tcg_t1 = tcg_temp_new_i32();
>> + tcg_t2 = tcg_temp_new_i32();
>> + tcg_gen_neg_i32(tcg_t1, tcg_t0);
>> + tcg_gen_subi_i32(tcg_t2, tcg_t0, 1);
>
> t2 is ~t1, right? Do we get better/worse code if we use
> tcg_gen_andc_i32(..., tcg_t1) rather than creating t2 and
> using gen_and_i32 ?
>
>> +
>> + if (nzcv & 8) { /* N */
>> + tcg_gen_or_i32(cpu_NF, cpu_NF, tcg_t1);
>> + } else {
>> + tcg_gen_and_i32(cpu_NF, cpu_NF, tcg_t2);
>> + }
>> + if (nzcv & 4) { /* Z */
>> + tcg_gen_and_i32(cpu_ZF, cpu_ZF, tcg_t2);
>> + } else {
>> + tcg_gen_or_i32(cpu_ZF, cpu_ZF, tcg_t0);
>> + }
>> + if (nzcv & 2) { /* C */
>> + tcg_gen_or_i32(cpu_CF, cpu_CF, tcg_t0);
>> + } else {
>> + tcg_gen_and_i32(cpu_CF, cpu_CF, tcg_t2);
>> + }
>> + if (nzcv & 1) { /* V */
>> + tcg_gen_or_i32(cpu_VF, cpu_VF, tcg_t1);
>> + } else {
>> + tcg_gen_and_i32(cpu_VF, cpu_VF, tcg_t2);
If the host supports andc, it's probably better to use only the one temp. But
otherwise we may save 4 not insns. Is it worth complicating the code for that?
r~
next prev parent reply other threads:[~2015-09-08 5:18 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-02 17:57 [Qemu-devel] [PATCH v2 00/11] target-arm improvements for aarch64 Richard Henderson
2015-09-02 17:57 ` [Qemu-devel] [PATCH v2 01/11] target-arm: Share all common TCG temporaries Richard Henderson
2015-09-07 16:57 ` Peter Maydell
2015-09-08 5:13 ` Richard Henderson
2015-09-02 17:57 ` [Qemu-devel] [PATCH v2 02/11] target-arm: Introduce DisasCompare Richard Henderson
2015-09-07 17:09 ` Peter Maydell
2015-09-08 5:09 ` Richard Henderson
2015-09-08 8:13 ` Peter Maydell
2015-09-02 17:57 ` [Qemu-devel] [PATCH v2 03/11] target-arm: Handle always condition codes within arm_test_cc Richard Henderson
2015-09-07 17:11 ` Peter Maydell
2015-09-02 17:57 ` [Qemu-devel] [PATCH v2 04/11] target-arm: Use setcond and movcond for csel Richard Henderson
2015-09-07 17:17 ` Peter Maydell
2015-09-08 5:12 ` Richard Henderson
2015-09-02 17:57 ` [Qemu-devel] [PATCH v2 05/11] target-arm: Implement ccmp branchless Richard Henderson
2015-09-07 17:31 ` Peter Maydell
2015-09-08 5:18 ` Richard Henderson [this message]
2015-09-08 8:19 ` Peter Maydell
2015-09-08 15:20 ` Richard Henderson
2015-09-02 17:57 ` [Qemu-devel] [PATCH v2 06/11] target-arm: Implement fcsel with movcond Richard Henderson
2015-09-07 17:42 ` Peter Maydell
2015-09-08 15:21 ` Richard Henderson
2015-09-02 17:57 ` [Qemu-devel] [PATCH v2 07/11] target-arm: Recognize SXTB, SXTH, SXTW, ASR Richard Henderson
2015-09-07 17:47 ` Peter Maydell
2015-09-02 17:57 ` [Qemu-devel] [PATCH v2 08/11] target-arm: Recognize UXTB, UXTH, LSR, LSL Richard Henderson
2015-09-07 18:00 ` Peter Maydell
2015-09-02 17:57 ` [Qemu-devel] [PATCH v2 09/11] target-arm: Eliminate unnecessary zero-extend in disas_bitfield Richard Henderson
2015-09-07 18:02 ` Peter Maydell
2015-09-02 17:57 ` [Qemu-devel] [PATCH v2 10/11] target-arm: Recognize ROR Richard Henderson
2015-09-07 18:06 ` Peter Maydell
2015-09-02 17:57 ` [Qemu-devel] [PATCH v2 11/11] target-arm: Use tcg_gen_extrh_i64_i32 Richard Henderson
2015-09-07 18:11 ` Peter Maydell
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=55EE6F99.9040309@twiddle.net \
--to=rth@twiddle.net \
--cc=peter.maydell@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.