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
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~
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~
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
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~
© 2016 - 2025 Red Hat, Inc.