[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 26/41] target/sparc: Implement LZCNT
From: |
Richard Henderson |
Subject: |
[PATCH 26/41] target/sparc: Implement LZCNT |
Date: |
Fri, 1 Mar 2024 19:15:46 -1000 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/sparc/translate.c | 18 ++++++++++++++++++
target/sparc/insns.decode | 1 +
2 files changed, 19 insertions(+)
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index c26fd04598..761ae204b9 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -667,6 +667,11 @@ static void gen_op_popc(TCGv dst, TCGv src1, TCGv src2)
tcg_gen_ctpop_tl(dst, src2);
}
+static void gen_op_lzcnt(TCGv dst, TCGv src)
+{
+ tcg_gen_clzi_tl(dst, src, TARGET_LONG_BITS);
+}
+
#ifndef TARGET_SPARC64
static void gen_helper_array8(TCGv dst, TCGv src1, TCGv src2)
{
@@ -3869,6 +3874,19 @@ TRANS(EDGE16LN, VIS2, gen_edge, a, 16, 0, 1)
TRANS(EDGE32N, VIS2, gen_edge, a, 32, 0, 0)
TRANS(EDGE32LN, VIS2, gen_edge, a, 32, 0, 1)
+static bool do_rr(DisasContext *dc, arg_r_r *a,
+ void (*func)(TCGv, TCGv))
+{
+ TCGv dst = gen_dest_gpr(dc, a->rd);
+ TCGv src = gen_load_gpr(dc, a->rs);
+
+ func(dst, src);
+ gen_store_gpr(dc, a->rd, dst);
+ return advance_pc(dc);
+}
+
+TRANS(LZCNT, VIS3, do_rr, a, gen_op_lzcnt)
+
static bool do_rrr(DisasContext *dc, arg_r_r_r *a,
void (*func)(TCGv, TCGv, TCGv))
{
diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode
index 353d26b9e6..f7f532002a 100644
--- a/target/sparc/insns.decode
+++ b/target/sparc/insns.decode
@@ -389,6 +389,7 @@ FCMPEq 10 000 cc:2 110101 ..... 0 0101 0111 ..... \
ADDXC 10 ..... 110110 ..... 0 0001 0001 ..... @r_r_r
ADDXCcc 10 ..... 110110 ..... 0 0001 0011 ..... @r_r_r
+ LZCNT 10 ..... 110110 00000 0 0001 0111 ..... @r_r2
ALIGNADDR 10 ..... 110110 ..... 0 0001 1000 ..... @r_r_r
ALIGNADDRL 10 ..... 110110 ..... 0 0001 1010 ..... @r_r_r
--
2.34.1
- [PATCH 17/41] target/sparc: Implement FHADD, FHSUB, FNHADD, FNADD, (continued)
- [PATCH 17/41] target/sparc: Implement FHADD, FHSUB, FNHADD, FNADD, Richard Henderson, 2024/03/02
- [PATCH 11/41] target/sparc: Use gvec for VIS1 parallel add/sub, Richard Henderson, 2024/03/02
- [PATCH 18/41] target/sparc: Implement FNMUL, Richard Henderson, 2024/03/02
- [PATCH 19/41] target/sparc: Implement FLCMP, Richard Henderson, 2024/03/02
- [PATCH 20/41] target/sparc: Implement FMEAN16, Richard Henderson, 2024/03/02
- [PATCH 22/41] target/sparc: Implement FPADDS, FPSUBS, Richard Henderson, 2024/03/02
- [PATCH 21/41] target/sparc: Implement FPADD64 FPSUB64, Richard Henderson, 2024/03/02
- [PATCH 23/41] target/sparc: Implement FPCMPEQ8, FPCMPNE8, FPCMPULE8, FPCMPUGT8, Richard Henderson, 2024/03/02
- [PATCH 25/41] target/sparc: Implement LDXEFSR, Richard Henderson, 2024/03/02
- [PATCH 24/41] target/sparc: Implement FSLL, FSRL, FSRA, FSLAS, Richard Henderson, 2024/03/02
- [PATCH 26/41] target/sparc: Implement LZCNT,
Richard Henderson <=
- [PATCH 27/41] target/sparc: Implement MOVsTOw, MOVdTOx, MOVwTOs, MOVxTOd, Richard Henderson, 2024/03/02
- [PATCH 28/41] target/sparc: Implement PDISTN, Richard Henderson, 2024/03/02
- [PATCH 29/41] target/sparc: Implement UMULXHI, Richard Henderson, 2024/03/02
- [PATCH 31/41] target/sparc: Enable VIS3 feature bit, Richard Henderson, 2024/03/02
- [PATCH 30/41] target/sparc: Implement XMULX, Richard Henderson, 2024/03/02
- [PATCH 33/41] target/sparc: Add feature bit for VIS4, Richard Henderson, 2024/03/02
- [PATCH 35/41] target/sparc: Implement 8-bit FPADD, FPADDS, and FPADDUS, Richard Henderson, 2024/03/02
- [PATCH 36/41] target/sparc: Implement VIS4 comparisons, Richard Henderson, 2024/03/02
- [PATCH 34/41] target/sparc: Implement FALIGNDATAi, Richard Henderson, 2024/03/02
- [PATCH 37/41] target/sparc: Implement FPMIN, FPMAX, Richard Henderson, 2024/03/02
- Prev by Date:
[PATCH 24/41] target/sparc: Implement FSLL, FSRL, FSRA, FSLAS
- Next by Date:
[PATCH 27/41] target/sparc: Implement MOVsTOw, MOVdTOx, MOVwTOs, MOVxTOd
- Previous by thread:
[PATCH 24/41] target/sparc: Implement FSLL, FSRL, FSRA, FSLAS
- Next by thread:
[PATCH 27/41] target/sparc: Implement MOVsTOw, MOVdTOx, MOVwTOs, MOVxTOd
- Index(es):