[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 04/15] target/riscv: rvb: logic-with-negate
From: |
frank . chang |
Subject: |
[RFC 04/15] target/riscv: rvb: logic-with-negate |
Date: |
Wed, 18 Nov 2020 16:29:42 +0800 |
From: Kito Cheng <kito.cheng@sifive.com>
Signed-off-by: Kito Cheng <kito.cheng@sifive.com>
---
target/riscv/insn32.decode | 4 +++
target/riscv/insn_trans/trans_rvb.c.inc | 18 ++++++++++++++
target/riscv/translate.c | 33 +++++++++++++++++++++++++
3 files changed, 55 insertions(+)
diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode
index 9e70a85d6f0..29a3d4c6ebc 100644
--- a/target/riscv/insn32.decode
+++ b/target/riscv/insn32.decode
@@ -598,3 +598,7 @@ vsetvl 1000000 ..... ..... 111 ..... 1010111 @r
clz 011000000000 ..... 001 ..... 0010011 @r2
ctz 011000000001 ..... 001 ..... 0010011 @r2
pcnt 011000000010 ..... 001 ..... 0010011 @r2
+
+andn 0100000 .......... 111 ..... 0110011 @r
+orn 0100000 .......... 110 ..... 0110011 @r
+xnor 0100000 .......... 100 ..... 0110011 @r
diff --git a/target/riscv/insn_trans/trans_rvb.c.inc
b/target/riscv/insn_trans/trans_rvb.c.inc
index 6f1054e3908..be25431e990 100644
--- a/target/riscv/insn_trans/trans_rvb.c.inc
+++ b/target/riscv/insn_trans/trans_rvb.c.inc
@@ -35,6 +35,24 @@ static bool trans_pcnt(DisasContext *ctx, arg_pcnt *a)
return gen_unary(ctx, a, &tcg_gen_ctpop_tl);
}
+static bool trans_andn(DisasContext *ctx, arg_andn *a)
+{
+ REQUIRE_EXT(ctx, RVB);
+ return gen_arith(ctx, a, &gen_andn);
+}
+
+static bool trans_orn(DisasContext *ctx, arg_orn *a)
+{
+ REQUIRE_EXT(ctx, RVB);
+ return gen_arith(ctx, a, &gen_orn);
+}
+
+static bool trans_xnor(DisasContext *ctx, arg_xnor *a)
+{
+ REQUIRE_EXT(ctx, RVB);
+ return gen_arith(ctx, a, &gen_xnor);
+}
+
/* RV64-only instructions */
#ifdef TARGET_RISCV64
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
index 97e5899750e..254a9dca8c2 100644
--- a/target/riscv/translate.c
+++ b/target/riscv/translate.c
@@ -710,6 +710,39 @@ static bool gen_arith_div_uw(DisasContext *ctx, arg_r *a,
#endif
+static void gen_andn(TCGv ret, TCGv arg1, TCGv arg2)
+{
+ TCGv t;
+ t = tcg_temp_new();
+
+ tcg_gen_not_tl(t, arg2);
+ tcg_gen_and_tl(ret, arg1, t);
+
+ tcg_temp_free(t);
+}
+
+static void gen_orn(TCGv ret, TCGv arg1, TCGv arg2)
+{
+ TCGv t;
+ t = tcg_temp_new();
+
+ tcg_gen_not_tl(t, arg2);
+ tcg_gen_or_tl(ret, arg1, t);
+
+ tcg_temp_free(t);
+}
+
+static void gen_xnor(TCGv ret, TCGv arg1, TCGv arg2)
+{
+ TCGv t;
+ t = tcg_temp_new();
+
+ tcg_gen_not_tl(t, arg2);
+ tcg_gen_xor_tl(ret, arg1, t);
+
+ tcg_temp_free(t);
+}
+
#ifdef TARGET_RISCV64
static bool gen_cxzw(DisasContext *ctx, arg_r2 *a,
--
2.17.1
- [RFC 00/15] support subsets of bitmanip extension, frank . chang, 2020/11/18
- [RFC 01/15] target/riscv: reformat @sh format encoding for B-extension, frank . chang, 2020/11/18
- [RFC 02/15] target/riscv: rvb: count leading/trailing zeros, frank . chang, 2020/11/18
- [RFC 03/15] target/riscv: rvb: count bits set, frank . chang, 2020/11/18
- [RFC 04/15] target/riscv: rvb: logic-with-negate,
frank . chang <=
- [RFC 05/15] target/riscv: rvb: pack two words into one register, frank . chang, 2020/11/18
- [RFC 06/15] target/riscv: rvb: min/max instructions, frank . chang, 2020/11/18
- [RFC 07/15] target/riscv: rvb: sign-extend instructions, frank . chang, 2020/11/18
- [RFC 08/15] target/riscv: rvb: single-bit instructions, frank . chang, 2020/11/18