From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: qemu-devel@nongnu.org, edgar.iglesias@gmail.com
Subject: [Qemu-devel] [PATCH] microblaze: Add support for the clz insn
Date: Tue, 10 Jan 2012 11:27:24 +0100 [thread overview]
Message-ID: <1326191247-14880-1-git-send-email-edgar.iglesias@gmail.com> (raw)
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
target-microblaze/helper.h | 1 +
target-microblaze/op_helper.c | 11 +++++++++++
target-microblaze/translate.c | 11 +++++++++++
3 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/target-microblaze/helper.h b/target-microblaze/helper.h
index b92aa34..420ff3b 100644
--- a/target-microblaze/helper.h
+++ b/target-microblaze/helper.h
@@ -5,6 +5,7 @@ DEF_HELPER_0(debug, void)
DEF_HELPER_FLAGS_3(carry, TCG_CALL_PURE | TCG_CALL_CONST, i32, i32, i32, i32)
DEF_HELPER_2(cmp, i32, i32, i32)
DEF_HELPER_2(cmpu, i32, i32, i32)
+DEF_HELPER_1(clz, i32, i32)
DEF_HELPER_2(divs, i32, i32, i32)
DEF_HELPER_2(divu, i32, i32, i32)
diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c
index 7433cec..fe38b7b 100644
--- a/target-microblaze/op_helper.c
+++ b/target-microblaze/op_helper.c
@@ -165,6 +165,17 @@ uint32_t helper_cmpu(uint32_t a, uint32_t b)
return t;
}
+uint32_t helper_clz(uint32_t t0)
+{
+ if (t0 == 0) {
+ return 32;
+ }
+ if (t0 == ~0) {
+ return 0;
+ }
+ return clz32(t0);
+}
+
uint32_t helper_carry(uint32_t a, uint32_t b, uint32_t cf)
{
uint32_t ncf;
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index d7f513d..f4e6f30 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -809,6 +809,17 @@ static void dec_bit(DisasContext *dc)
return;
}
break;
+ case 0xe0:
+ if ((dc->tb_flags & MSR_EE_FLAG)
+ && (dc->env->pvr.regs[2] & PVR2_ILL_OPCODE_EXC_MASK)
+ && !((dc->env->pvr.regs[2] & PVR2_USE_PCMP_INSTR))) {
+ tcg_gen_movi_tl(cpu_SR[SR_ESR], ESR_EC_ILLEGAL_OP);
+ t_gen_raise_exception(dc, EXCP_HW_EXCP);
+ }
+ if (dc->env->pvr.regs[2] & PVR2_USE_PCMP_INSTR) {
+ gen_helper_clz(cpu_R[dc->rd], cpu_R[dc->ra]);
+ }
+ break;
default:
cpu_abort(dc->env, "unknown bit oc=%x op=%x rd=%d ra=%d rb=%d\n",
dc->pc, op, dc->rd, dc->ra, dc->rb);
--
1.7.3.4
next reply other threads:[~2012-01-10 10:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-10 10:27 Edgar E. Iglesias [this message]
2012-01-10 10:27 ` [Qemu-devel] [PATCH] microblaze: Emulate the hw stackprotector Edgar E. Iglesias
2012-01-10 10:27 ` [Qemu-devel] [PATCH] microblaze: Break the tb at memory barriers Edgar E. Iglesias
2012-01-10 10:27 ` [Qemu-devel] [PATCH] etraxfs-dma: Model metadata and eop Edgar E. Iglesias
2012-01-10 15:16 ` Edgar E. Iglesias
2012-01-10 15:37 ` [Qemu-devel] [PATCH] microblaze: Add support for the clz insn Peter Maydell
2012-01-10 15:41 ` Edgar E. Iglesias
2012-01-10 23:19 ` Richard Henderson
2012-01-10 23:20 ` Edgar E. Iglesias
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326191247-14880-1-git-send-email-edgar.iglesias@gmail.com \
--to=edgar.iglesias@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).