* [Qemu-devel] [PATCH v2] tcg: Implement tcg_gen_shri2_i64()
@ 2019-02-25 15:42 David Hildenbrand
2019-02-25 16:20 ` Richard Henderson
2019-02-25 16:34 ` Richard Henderson
0 siblings, 2 replies; 5+ messages in thread
From: David Hildenbrand @ 2019-02-25 15:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, David Hildenbrand
Will be helpful for s390x. Input 128 bit and output 64 bit only, which
is sufficient for now.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
v1 -> v2:
- Use one output (lower part) only
- Shield off big shifts by an assert
tcg/tcg-op.c | 15 +++++++++++++++
tcg/tcg-op.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 1bd7ef24af..e4fa75c074 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -2381,6 +2381,21 @@ void tcg_gen_sub2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al,
}
}
+void tcg_gen_shri2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah, int64_t count)
+{
+ tcg_debug_assert(count >= 0 && count <= 64);
+ if (count == 0) {
+ tcg_gen_mov_i64(ret, al);
+ } else if (count == 64) {
+ tcg_gen_mov_i64(ret, ah);
+ } else {
+ TCGv_i64 t0 = tcg_temp_new_i64();
+ tcg_gen_shri_i64(t0, al, count);
+ tcg_gen_deposit_i64(ret, t0, ah, 64 - count, count);
+ tcg_temp_free_i64(t0);
+ }
+}
+
void tcg_gen_mulu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2)
{
if (TCG_TARGET_HAS_mulu2_i64) {
diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h
index d3e51b15af..1ffe689276 100644
--- a/tcg/tcg-op.h
+++ b/tcg/tcg-op.h
@@ -513,6 +513,7 @@ void tcg_gen_add2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al,
TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh);
void tcg_gen_sub2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al,
TCGv_i64 ah, TCGv_i64 bl, TCGv_i64 bh);
+void tcg_gen_shri2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah, int64_t count);
void tcg_gen_mulu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2);
void tcg_gen_muls2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2);
void tcg_gen_mulsu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 arg2);
--
2.17.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [Qemu-devel] [PATCH v2] tcg: Implement tcg_gen_shri2_i64()
2019-02-25 15:42 [Qemu-devel] [PATCH v2] tcg: Implement tcg_gen_shri2_i64() David Hildenbrand
@ 2019-02-25 16:20 ` Richard Henderson
2019-02-25 16:34 ` Richard Henderson
1 sibling, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2019-02-25 16:20 UTC (permalink / raw)
To: David Hildenbrand, qemu-devel
On 2/25/19 7:42 AM, David Hildenbrand wrote:
> Will be helpful for s390x. Input 128 bit and output 64 bit only, which
> is sufficient for now.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>
> v1 -> v2:
> - Use one output (lower part) only
> - Shield off big shifts by an assert
>
> tcg/tcg-op.c | 15 +++++++++++++++
> tcg/tcg-op.h | 1 +
> 2 files changed, 16 insertions(+)
Thanks, queued.
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2] tcg: Implement tcg_gen_shri2_i64()
2019-02-25 15:42 [Qemu-devel] [PATCH v2] tcg: Implement tcg_gen_shri2_i64() David Hildenbrand
2019-02-25 16:20 ` Richard Henderson
@ 2019-02-25 16:34 ` Richard Henderson
2019-02-25 16:36 ` David Hildenbrand
1 sibling, 1 reply; 5+ messages in thread
From: Richard Henderson @ 2019-02-25 16:34 UTC (permalink / raw)
To: David Hildenbrand, qemu-devel
On 2/25/19 7:42 AM, David Hildenbrand wrote:
> +void tcg_gen_shri2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah, int64_t count)
Actually, I now wonder if a better name might be tcg_gen_extract2_i64
(no other change to arguments, i.e. the "len" parameter that extract
has is fixed at 64).
Thoughts?
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2] tcg: Implement tcg_gen_shri2_i64()
2019-02-25 16:34 ` Richard Henderson
@ 2019-02-25 16:36 ` David Hildenbrand
2019-02-25 16:41 ` Richard Henderson
0 siblings, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2019-02-25 16:36 UTC (permalink / raw)
To: Richard Henderson, qemu-devel
On 25.02.19 17:34, Richard Henderson wrote:
> On 2/25/19 7:42 AM, David Hildenbrand wrote:
>> +void tcg_gen_shri2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah, int64_t count)
>
> Actually, I now wonder if a better name might be tcg_gen_extract2_i64
> (no other change to arguments, i.e. the "len" parameter that extract
> has is fixed at 64).
>
> Thoughts?
That is actually a good idea. Maybe add a comment regarding len fixed to 64.
Shall I resend or do you want to fix it up?
>
>
> r~
>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH v2] tcg: Implement tcg_gen_shri2_i64()
2019-02-25 16:36 ` David Hildenbrand
@ 2019-02-25 16:41 ` Richard Henderson
0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2019-02-25 16:41 UTC (permalink / raw)
To: David Hildenbrand, qemu-devel
On 2/25/19 8:36 AM, David Hildenbrand wrote:
> On 25.02.19 17:34, Richard Henderson wrote:
>> On 2/25/19 7:42 AM, David Hildenbrand wrote:
>>> +void tcg_gen_shri2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah, int64_t count)
>>
>> Actually, I now wonder if a better name might be tcg_gen_extract2_i64
>> (no other change to arguments, i.e. the "len" parameter that extract
>> has is fixed at 64).
>>
>> Thoughts?
>
> That is actually a good idea. Maybe add a comment regarding len fixed to 64.
>
> Shall I resend or do you want to fix it up?
I'll fix it up.
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-02-25 16:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-25 15:42 [Qemu-devel] [PATCH v2] tcg: Implement tcg_gen_shri2_i64() David Hildenbrand
2019-02-25 16:20 ` Richard Henderson
2019-02-25 16:34 ` Richard Henderson
2019-02-25 16:36 ` David Hildenbrand
2019-02-25 16:41 ` Richard Henderson
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.