[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 39/76] target/microblaze: Convert dec_pattern to decodetree
From: |
Richard Henderson |
Subject: |
[PATCH v2 39/76] target/microblaze: Convert dec_pattern to decodetree |
Date: |
Fri, 28 Aug 2020 07:18:52 -0700 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/microblaze/insns.decode | 4 ++
target/microblaze/translate.c | 67 +++++++++-------------------------
2 files changed, 22 insertions(+), 49 deletions(-)
diff --git a/target/microblaze/insns.decode b/target/microblaze/insns.decode
index a611cc83a7..16519f05dc 100644
--- a/target/microblaze/insns.decode
+++ b/target/microblaze/insns.decode
@@ -44,6 +44,10 @@ addikc 001110 ..... ..... ................
@typeb
cmp 000101 ..... ..... ..... 000 0000 0001 @typea
cmpu 000101 ..... ..... ..... 000 0000 0011 @typea
+pcmpbf 100000 ..... ..... ..... 100 0000 0000 @typea
+pcmpeq 100010 ..... ..... ..... 100 0000 0000 @typea
+pcmpne 100011 ..... ..... ..... 100 0000 0000 @typea
+
rsub 000001 ..... ..... ..... 000 0000 0000 @typea
rsubc 000011 ..... ..... ..... 000 0000 0000 @typea
rsubk 000101 ..... ..... ..... 000 0000 0000 @typea
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
index 8da477457d..7ebf0e1e7d 100644
--- a/target/microblaze/translate.c
+++ b/target/microblaze/translate.c
@@ -279,6 +279,10 @@ static bool do_typeb_val(DisasContext *dc, arg_typeb *arg,
bool side_effects,
static bool trans_##NAME(DisasContext *dc, arg_typea *a) \
{ return do_typea(dc, a, SE, FN); }
+#define DO_TYPEA_CFG(NAME, CFG, SE, FN) \
+ static bool trans_##NAME(DisasContext *dc, arg_typea *a) \
+ { return dc->cpu->cfg.CFG && do_typea(dc, a, SE, FN); }
+
#define DO_TYPEBI(NAME, SE, FNI) \
static bool trans_##NAME(DisasContext *dc, arg_typeb *a) \
{ return do_typeb_imm(dc, a, SE, FNI); }
@@ -350,6 +354,20 @@ static void gen_cmpu(TCGv_i32 out, TCGv_i32 ina, TCGv_i32
inb)
DO_TYPEA(cmp, false, gen_cmp)
DO_TYPEA(cmpu, false, gen_cmpu)
+static void gen_pcmpeq(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb)
+{
+ tcg_gen_setcond_i32(TCG_COND_EQ, out, ina, inb);
+}
+
+static void gen_pcmpne(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb)
+{
+ tcg_gen_setcond_i32(TCG_COND_NE, out, ina, inb);
+}
+
+DO_TYPEA_CFG(pcmpbf, use_pcmp_instr, false, gen_helper_pcmpbf)
+DO_TYPEA_CFG(pcmpeq, use_pcmp_instr, false, gen_pcmpeq)
+DO_TYPEA_CFG(pcmpne, use_pcmp_instr, false, gen_pcmpne)
+
/* No input carry, but output carry. */
static void gen_rsub(TCGv_i32 out, TCGv_i32 ina, TCGv_i32 inb)
{
@@ -413,49 +431,10 @@ static bool trans_zero(DisasContext *dc, arg_zero *arg)
return false;
}
-static void dec_pattern(DisasContext *dc)
-{
- unsigned int mode;
-
- if (trap_illegal(dc, !dc->cpu->cfg.use_pcmp_instr)) {
- return;
- }
-
- mode = dc->opcode & 3;
- switch (mode) {
- case 0:
- /* pcmpbf. */
- if (dc->rd)
- gen_helper_pcmpbf(cpu_R[dc->rd], cpu_R[dc->ra], cpu_R[dc->rb]);
- break;
- case 2:
- if (dc->rd) {
- tcg_gen_setcond_i32(TCG_COND_EQ, cpu_R[dc->rd],
- cpu_R[dc->ra], cpu_R[dc->rb]);
- }
- break;
- case 3:
- if (dc->rd) {
- tcg_gen_setcond_i32(TCG_COND_NE, cpu_R[dc->rd],
- cpu_R[dc->ra], cpu_R[dc->rb]);
- }
- break;
- default:
- cpu_abort(CPU(dc->cpu),
- "unsupported pattern insn opcode=%x\n", dc->opcode);
- break;
- }
-}
-
static void dec_and(DisasContext *dc)
{
unsigned int not;
- if (!dc->type_b && (dc->imm & (1 << 10))) {
- dec_pattern(dc);
- return;
- }
-
not = dc->opcode & (1 << 1);
if (!dc->rd)
@@ -469,22 +448,12 @@ static void dec_and(DisasContext *dc)
static void dec_or(DisasContext *dc)
{
- if (!dc->type_b && (dc->imm & (1 << 10))) {
- dec_pattern(dc);
- return;
- }
-
if (dc->rd)
tcg_gen_or_i32(cpu_R[dc->rd], cpu_R[dc->ra], *(dec_alu_op_b(dc)));
}
static void dec_xor(DisasContext *dc)
{
- if (!dc->type_b && (dc->imm & (1 << 10))) {
- dec_pattern(dc);
- return;
- }
-
if (dc->rd)
tcg_gen_xor_i32(cpu_R[dc->rd], cpu_R[dc->ra], *(dec_alu_op_b(dc)));
}
--
2.25.1
- [PATCH v2 30/76] target/microblaze: Remove SIM_COMPAT, (continued)
- [PATCH v2 30/76] target/microblaze: Remove SIM_COMPAT, Richard Henderson, 2020/08/28
- [PATCH v2 28/76] target/microblaze: Convert to DisasContextBase, Richard Henderson, 2020/08/28
- [PATCH v2 31/76] target/microblaze: Remove DISAS_GNU, Richard Henderson, 2020/08/28
- [PATCH v2 33/76] target/microblaze: Remove LOG_DIS, Richard Henderson, 2020/08/28
- [PATCH v2 32/76] target/microblaze: Remove empty D macros, Richard Henderson, 2020/08/28
- [PATCH v2 35/76] target/microblaze: Add decodetree infrastructure, Richard Henderson, 2020/08/28
- [PATCH v2 37/76] target/microblaze: Convert dec_sub to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 38/76] target/microblaze: Implement cmp and cmpu inline, Richard Henderson, 2020/08/28
- [PATCH v2 36/76] target/microblaze: Convert dec_add to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 34/76] target/microblaze: Ensure imm constant is always available, Richard Henderson, 2020/08/28
- [PATCH v2 39/76] target/microblaze: Convert dec_pattern to decodetree,
Richard Henderson <=
- [PATCH v2 40/76] target/microblaze: Convert dec_and, dec_or, dec_xor to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 42/76] target/microblaze: Convert dec_div to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 41/76] target/microblaze: Convert dec_mul to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 45/76] target/microblaze: Convert dec_barrel to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 43/76] target/microblaze: Unwind properly when raising divide-by-zero, Richard Henderson, 2020/08/28
- [PATCH v2 44/76] target/microblaze: Convert dec_bit to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 46/76] target/microblaze: Convert dec_imm to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 47/76] target/microblaze: Convert dec_fpu to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 49/76] target/microblaze: Mark fpu helpers TCG_CALL_NO_WG, Richard Henderson, 2020/08/28
- [PATCH v2 48/76] target/microblaze: Fix cpu unwind for fpu exceptions, Richard Henderson, 2020/08/28