From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v10.5 15/20] target/arm: Use vector infrastructure for aa64 constant shifts
Date: Thu, 25 Jan 2018 09:14:57 -0800 [thread overview]
Message-ID: <c1e1d069-ea67-154e-7578-225c8f4ff4ad@linaro.org> (raw)
In-Reply-To: <CAFEAcA_tFAC-Zcn4UGkOT6h1H+QPxttNJe=M+cfbbXLUvBqAYg@mail.gmail.com>
On 01/25/2018 09:03 AM, Peter Maydell wrote:
> On 17 January 2018 at 16:14, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>> target/arm/translate-a64.c | 386 ++++++++++++++++++++++++++++++++++++++-------
>> 1 file changed, 329 insertions(+), 57 deletions(-)
>>
>> diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
>> index 2495414603..1b5005637d 100644
>> --- a/target/arm/translate-a64.c
>> +++ b/target/arm/translate-a64.c
>> @@ -6489,17 +6489,6 @@ static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src,
>> }
>> }
>>
>> -/* Common SHL/SLI - Shift left with an optional insert */
>> -static void handle_shli_with_ins(TCGv_i64 tcg_res, TCGv_i64 tcg_src,
>> - bool insert, int shift)
>> -{
>> - if (insert) { /* SLI */
>> - tcg_gen_deposit_i64(tcg_res, tcg_res, tcg_src, shift, 64 - shift);
>> - } else { /* SHL */
>> - tcg_gen_shli_i64(tcg_res, tcg_src, shift);
>> - }
>> -}
>> -
>> /* SRI: shift right with insert */
>> static void handle_shri_with_ins(TCGv_i64 tcg_res, TCGv_i64 tcg_src,
>> int size, int shift)
>> @@ -6603,7 +6592,11 @@ static void handle_scalar_simd_shli(DisasContext *s, bool insert,
>> tcg_rn = read_fp_dreg(s, rn);
>> tcg_rd = insert ? read_fp_dreg(s, rd) : tcg_temp_new_i64();
>>
>> - handle_shli_with_ins(tcg_rd, tcg_rn, insert, shift);
>> + if (insert) {
>> + tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_rn, shift, 64 - shift);
>> + } else {
>> + tcg_gen_shli_i64(tcg_rd, tcg_rn, shift);
>> + }
>
> It looks like you're folding handle_shli_with_ins() into its
> now only callsite, but handle_shri_with_ins() has been left as
> its own function?
I didn't notice that. I'll have a look.
>> +static void gen_shr8_ins_i64(TCGv_i64 d, TCGv_i64 a, int64_t shift)
>> +{
>> + uint64_t mask = (0xff >> shift) * (-1ull / 0xff);
>> + TCGv_i64 t = tcg_temp_new_i64();
>> +
>> + tcg_gen_shri_i64(t, a, shift);
>> + tcg_gen_andi_i64(t, t, mask);
>> + tcg_gen_andi_i64(d, d, ~mask);
>> + tcg_gen_or_i64(d, d, t);
>> + tcg_temp_free_i64(t);
>
> The previous code was able to work with just shifts and deposits --
> why do we need to open-code this kind of mask-and-or now? Is this
> because we now operate an i64 at a time when we used to operate
> on smaller quantities at once?
Yes, exactly. It's now 4 total operations instead of 16.
I should also tidy this to use a new dup_const function that's been introduced
since I first wrote this code...
r~
next prev parent reply other threads:[~2018-01-25 17:15 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 16:14 [Qemu-devel] [PATCH v10.5 00/20] tcg: generic vector operations Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 01/20] tcg: Allow multiple word entries into the constant pool Richard Henderson
2018-01-22 18:35 ` Peter Maydell
2018-01-22 19:15 ` Alex Bennée
2018-01-22 19:56 ` Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 02/20] tcg: Add types and basic operations for host vectors Richard Henderson
2018-01-22 18:53 ` Peter Maydell
2018-01-22 20:02 ` Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 03/20] tcg: Standardize integral arguments to expanders Richard Henderson
2018-01-22 19:17 ` Peter Maydell
2018-01-22 20:04 ` Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 04/20] tcg: Add generic vector expanders Richard Henderson
2018-01-26 12:17 ` Alex Bennée
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 05/20] tcg: Add generic vector ops for constant shifts Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 06/20] tcg: Add generic vector ops for comparisons Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 07/20] tcg: Add generic vector ops for multiplication Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 08/20] tcg: Add generic helpers for saturating arithmetic Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 09/20] tcg: Add generic vector helpers with a scalar operand Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 10/20] tcg/optimize: Handle vector opcodes during optimize Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 11/20] target/arm: Align vector registers Richard Henderson
2018-01-26 9:52 ` Alex Bennée
2018-01-26 16:43 ` Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 12/20] target/arm: Use vector infrastructure for aa64 add/sub/logic Richard Henderson
2018-01-25 16:44 ` Peter Maydell
2018-01-25 17:06 ` Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 13/20] target/arm: Use vector infrastructure for aa64 mov/not/neg Richard Henderson
2018-01-25 16:46 ` Peter Maydell
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 14/20] target/arm: Use vector infrastructure for aa64 dup/movi Richard Henderson
2018-01-25 16:50 ` Peter Maydell
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 15/20] target/arm: Use vector infrastructure for aa64 constant shifts Richard Henderson
2018-01-25 17:03 ` Peter Maydell
2018-01-25 17:14 ` Richard Henderson [this message]
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 16/20] target/arm: Use vector infrastructure for aa64 compares Richard Henderson
2018-01-25 17:16 ` Peter Maydell
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 17/20] target/arm: Use vector infrastructure for aa64 multiplies Richard Henderson
2018-01-25 17:23 ` Peter Maydell
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 18/20] target/arm: Use vector infrastructure for aa64 orr/bic immediate Richard Henderson
2018-01-25 17:24 ` Peter Maydell
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 19/20] tcg/i386: Add vector operations Richard Henderson
2018-01-17 16:14 ` [Qemu-devel] [PATCH v10.5 20/20] tcg/aarch64: " Richard Henderson
2018-01-17 17:14 ` [Qemu-devel] [PATCH v10.5 00/20] tcg: generic " no-reply
2018-01-25 17:28 ` 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=c1e1d069-ea67-154e-7578-225c8f4ff4ad@linaro.org \
--to=richard.henderson@linaro.org \
--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 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).