From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>, qemu-arm <qemu-arm@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v3b 15/18] target/arm: Implement SVE Integer Compare - Scalars Group
Date: Tue, 12 Jun 2018 15:27:37 -1000 [thread overview]
Message-ID: <fef082f7-e297-61d8-8850-6d33e93b976f@linaro.org> (raw)
In-Reply-To: <CAFEAcA-weWiOLsrucjWMUjAh3tgS02RgBChpZOiOgd3HZK+imw@mail.gmail.com>
On 06/05/2018 08:02 AM, Peter Maydell wrote:
>> + if (count & 63) {
>> + d->p[i] = ~(-1ull << (count & 63)) & esz_mask;
>
> Is this d->p[i] = MAKE_64BIT_MASK(0, count & 63) & esz_mask; ?
Fixed.
>> + tcg_gen_setcond_i64(cond, cmp, rn, rm);
>> + tcg_gen_extrl_i64_i32(cpu_NF, cmp);
>> + tcg_temp_free_i64(cmp);
>> +
>> + /* VF = !NF & !CF. */
>> + tcg_gen_xori_i32(cpu_VF, cpu_NF, 1);
>> + tcg_gen_andc_i32(cpu_VF, cpu_VF, cpu_CF);
>> +
>> + /* Both NF and VF actually look at bit 31. */
>> + tcg_gen_neg_i32(cpu_NF, cpu_NF);
>> + tcg_gen_neg_i32(cpu_VF, cpu_VF);
>
> Microoptimization, but I think you can save an instruction here
> using
> /* VF = !NF & !CF == !(NF || CF); we know NF and CF are
> * both 0 or 1, so the result of the logical NOT has
> * VF bit 31 set or clear as required.
> */
> tcg_gen_or_i32(cpu_VF, cpu_NF, cpu_CF);
> tcg_gen_not_i32(cpu_VF, cpu_VF);
No, ~({0,1} | {0,1}) -> {-1,-2}.
>> + /* For the helper, compress the different conditions into a computation
>> + * of how many iterations for which the condition is true.
>> + *
>> + * This is slightly complicated by 0 <= UINT64_MAX, which is nominally
>> + * 2**64 iterations, overflowing to 0. Of course, predicate registers
>> + * aren't that large, so any value >= predicate size is sufficient.
>> + */
>
> The comment says that 0 <= UINT64_MAX is a special case,
> but I don't understand how the code accounts for it ?
>
>> + tcg_gen_sub_i64(t0, op1, op0);
>> +
>> + /* t0 = MIN(op1 - op0, vsz). */
>> + if (a->eq) {
>> + /* Equality means one more iteration. */
>> + tcg_gen_movi_i64(t1, vsz - 1);
>> + tcg_gen_movcond_i64(TCG_COND_LTU, t0, t0, t1, t0, t1);
By bounding the input, here, to the vector size. This reduces the (2**64-1)+1
case, which we can't represent, to a vsz+1 case, which we can. This produces
the same result for this instruction.
This does point out that I should be using the new tcg_gen_umin_i64 helper
instead of open-coding with movcond.
r~
next prev parent reply other threads:[~2018-06-13 1:27 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-30 18:01 [Qemu-devel] [PATCH v3b 00/18] target/arm: SVE instructions, part 2 Richard Henderson
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 01/18] target/arm: Extend vec_reg_offset to larger sizes Richard Henderson
2018-06-04 16:47 ` Peter Maydell
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 02/18] target/arm: Implement SVE Permute - Unpredicated Group Richard Henderson
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 03/18] target/arm: Implement SVE Permute - Predicates Group Richard Henderson
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 04/18] target/arm: Implement SVE Permute - Interleaving Group Richard Henderson
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 05/18] target/arm: Implement SVE compress active elements Richard Henderson
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 06/18] target/arm: Implement SVE conditionally broadcast/extract element Richard Henderson
2018-06-04 16:46 ` Peter Maydell
2018-06-13 1:02 ` Richard Henderson
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 07/18] target/arm: Implement SVE copy to vector (predicated) Richard Henderson
2018-06-04 16:51 ` Peter Maydell
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 08/18] target/arm: Implement SVE reverse within elements Richard Henderson
2018-06-04 16:56 ` Peter Maydell
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 09/18] target/arm: Implement SVE vector splice (predicated) Richard Henderson
2018-06-04 17:08 ` Peter Maydell
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 10/18] target/arm: Implement SVE Select Vectors Group Richard Henderson
2018-06-04 17:12 ` Peter Maydell
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 11/18] target/arm: Implement SVE Integer Compare - " Richard Henderson
2018-06-04 17:30 ` Peter Maydell
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 12/18] target/arm: Implement SVE Integer Compare - Immediate Group Richard Henderson
2018-06-04 17:36 ` Peter Maydell
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 13/18] target/arm: Implement SVE Partition Break Group Richard Henderson
2018-06-05 17:10 ` Peter Maydell
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 14/18] target/arm: Implement SVE Predicate Count Group Richard Henderson
2018-06-05 17:27 ` Peter Maydell
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 15/18] target/arm: Implement SVE Integer Compare - Scalars Group Richard Henderson
2018-06-05 18:02 ` Peter Maydell
2018-06-13 1:27 ` Richard Henderson [this message]
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 16/18] target/arm: Implement FDUP/DUP Richard Henderson
2018-06-05 18:05 ` Peter Maydell
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 17/18] target/arm: Implement SVE Integer Wide Immediate - Unpredicated Group Richard Henderson
2018-06-07 8:54 ` Peter Maydell
2018-05-30 18:01 ` [Qemu-devel] [PATCH v3b 18/18] target/arm: Implement SVE Floating Point Arithmetic " Richard Henderson
2018-06-07 10:45 ` Peter Maydell
2018-06-07 16:41 ` Richard Henderson
2018-05-30 18:23 ` [Qemu-devel] [PATCH v3b 00/18] target/arm: SVE instructions, part 2 no-reply
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=fef082f7-e297-61d8-8850-6d33e93b976f@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.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 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).