]> git.proxmox.com Git - qemu.git/commitdiff
microblaze: Add support for the clz insn
authorEdgar E. Iglesias <edgar.iglesias@gmail.com>
Tue, 10 Jan 2012 09:17:21 +0000 (10:17 +0100)
committerEdgar E. Iglesias <edgar.iglesias@gmail.com>
Thu, 12 Jan 2012 12:54:16 +0000 (13:54 +0100)
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
target-microblaze/helper.h
target-microblaze/op_helper.c
target-microblaze/translate.c

index b92aa34d05b800cfe0bbc3606502d50b12c094ff..a8d75c0bf04f5ae9893d8e6f09c288a9a245423e 100644 (file)
@@ -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_FLAGS_1(clz, TCG_CALL_PURE | TCG_CALL_CONST, i32, i32)
 
 DEF_HELPER_2(divs, i32, i32, i32)
 DEF_HELPER_2(divu, i32, i32, i32)
index 7433cec2911a4753c6cbf9a5b25257cf39e0325f..d99c5643759d65687cbad3433cd0268495c286f8 100644 (file)
@@ -165,6 +165,11 @@ uint32_t helper_cmpu(uint32_t a, uint32_t b)
     return t;
 }
 
+uint32_t helper_clz(uint32_t t0)
+{
+    return clz32(t0);
+}
+
 uint32_t helper_carry(uint32_t a, uint32_t b, uint32_t cf)
 {
     uint32_t ncf;
index d7f513d34da3da868023b9c764dec41ceb72247f..f4e6f3011b23503ebc66d23bf46665875cd623f4 100644 (file)
@@ -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);