[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 65/88] target/hppa: Implement HAVG
|
From: |
Richard Henderson |
|
Subject: |
[PATCH v3 65/88] target/hppa: Implement HAVG |
|
Date: |
Wed, 1 Nov 2023 18:29:53 -0700 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/hppa/helper.h | 1 +
target/hppa/insns.decode | 2 ++
target/hppa/op_helper.c | 14 ++++++++++++++
target/hppa/translate.c | 5 +++++
4 files changed, 22 insertions(+)
diff --git a/target/hppa/helper.h b/target/hppa/helper.h
index 02798aa105..51c24b31b0 100644
--- a/target/hppa/helper.h
+++ b/target/hppa/helper.h
@@ -16,6 +16,7 @@ DEF_HELPER_FLAGS_1(ldc_check, TCG_CALL_NO_RWG, void, tl)
DEF_HELPER_FLAGS_2(hadd_ss, TCG_CALL_NO_RWG, i64, i64, i64)
DEF_HELPER_FLAGS_2(hadd_us, TCG_CALL_NO_RWG, i64, i64, i64)
+DEF_HELPER_FLAGS_2(havg, TCG_CALL_NO_RWG, i64, i64, i64)
DEF_HELPER_FLAGS_2(hsub_ss, TCG_CALL_NO_RWG, i64, i64, i64)
DEF_HELPER_FLAGS_2(hsub_us, TCG_CALL_NO_RWG, i64, i64, i64)
diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode
index 29b49c6cf4..6959555bf3 100644
--- a/target/hppa/insns.decode
+++ b/target/hppa/insns.decode
@@ -214,6 +214,8 @@ hadd 000010 ..... ..... 00000011 11 0 ..... @rrr
hadd_ss 000010 ..... ..... 00000011 01 0 ..... @rrr
hadd_us 000010 ..... ..... 00000011 00 0 ..... @rrr
+havg 000010 ..... ..... 00000010 11 0 ..... @rrr
+
hsub 000010 ..... ..... 00000001 11 0 ..... @rrr
hsub_ss 000010 ..... ..... 00000001 01 0 ..... @rrr
hsub_us 000010 ..... ..... 00000001 00 0 ..... @rrr
diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c
index ece523bea0..cba610ac75 100644
--- a/target/hppa/op_helper.c
+++ b/target/hppa/op_helper.c
@@ -410,6 +410,20 @@ uint64_t HELPER(hadd_us)(uint64_t r1, uint64_t r2)
return ret;
}
+uint64_t HELPER(havg)(uint64_t r1, uint64_t r2)
+{
+ uint64_t ret = 0;
+
+ for (int i = 0; i < 64; i += 16) {
+ int f1 = extract64(r1, i, 16);
+ int f2 = extract64(r2, i, 16);
+ int fr = f1 + f2;
+
+ ret = deposit64(ret, i, 16, (fr >> 1) | (fr & 1));
+ }
+ return ret;
+}
+
uint64_t HELPER(hsub_ss)(uint64_t r1, uint64_t r2)
{
uint64_t ret = 0;
diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index 2f1333b91c..2fdd4448ae 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -2804,6 +2804,11 @@ static bool trans_hadd_us(DisasContext *ctx, arg_rrr *a)
return do_multimedia(ctx, a, gen_helper_hadd_us);
}
+static bool trans_havg(DisasContext *ctx, arg_rrr *a)
+{
+ return do_multimedia(ctx, a, gen_helper_havg);
+}
+
static bool trans_hsub(DisasContext *ctx, arg_rrr *a)
{
return do_multimedia(ctx, a, tcg_gen_vec_sub16_i64);
--
2.34.1
- [PATCH v3 64/88] target/hppa: Implement HSUB, (continued)
- [PATCH v3 64/88] target/hppa: Implement HSUB, Richard Henderson, 2023/11/01
- [PATCH v3 46/88] target/hppa: Decode d for cmpb instructions, Richard Henderson, 2023/11/01
- [PATCH v3 50/88] target/hppa: Implement DEPD, DEPDI, Richard Henderson, 2023/11/01
- [PATCH v3 52/88] target/hppa: Implement SHRPD, Richard Henderson, 2023/11/01
- [PATCH v3 53/88] target/hppa: Implement CLRBTS, POPBTS, PUSHBTS, PUSHNOM, Richard Henderson, 2023/11/01
- [PATCH v3 54/88] target/hppa: Implement STDBY, Richard Henderson, 2023/11/01
- [PATCH v3 60/88] target/hppa: Adjust vmstate_env for pa2.0 tlb, Richard Henderson, 2023/11/01
- [PATCH v3 73/88] include/hw/elf: Remove truncating signed casts, Richard Henderson, 2023/11/01
- [PATCH v3 61/88] target/hppa: Use tcg_temp_new_i64 not tcg_temp_new, Richard Henderson, 2023/11/01
- [PATCH v3 77/88] target/hppa: Add pa2.0 cpu local tlb flushes, Richard Henderson, 2023/11/01
- [PATCH v3 65/88] target/hppa: Implement HAVG,
Richard Henderson <=
- [PATCH v3 62/88] target/hppa: Replace tcg_gen_*_tl with tcg_gen_*_i64, Richard Henderson, 2023/11/01
- [PATCH v3 67/88] target/hppa: Implement HSHLADD, HSHRADD, Richard Henderson, 2023/11/01
- [PATCH v3 75/88] linux-user/hppa: Drop EXCP_DUMP from handled exceptions, Richard Henderson, 2023/11/01
- [PATCH v3 45/88] target/hppa: Decode d for bb instructions, Richard Henderson, 2023/11/01
- [PATCH v3 78/88] target/hppa: Avoid async_safe_run_on_cpu on uniprocessor system, Richard Henderson, 2023/11/01
- [PATCH v3 74/88] hw/hppa: Translate phys addresses for the cpu, Richard Henderson, 2023/11/01
- [PATCH v3 70/88] target/hppa: Fix interruption based on default PSW, Richard Henderson, 2023/11/01
- [PATCH v3 56/88] hw/hppa: Use uint32_t instead of target_ureg, Richard Henderson, 2023/11/01
- [PATCH v3 58/88] target/hppa: Remove most of the TARGET_REGISTER_BITS redirections, Richard Henderson, 2023/11/01
- [PATCH v3 72/88] target/hppa: Return zero for r0 from load_gpr, Richard Henderson, 2023/11/01