qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] target/mips: Support Toshiba specific three-ope


From: Fredrik Noring
Subject: Re: [Qemu-devel] [PATCH] target/mips: Support Toshiba specific three-operand MADD and MADDU
Date: Mon, 15 Oct 2018 17:36:10 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

Hi Philippe,

> That's true it is not reachable, it lacks the INSN_R3900 definition,
> used by the R3900 mips_def_t.
> 
> I'll stop bothering with this until the code is reachable (my branch posted).

I would be happy if your patch could be merged soon. Adding the following
five lines to it would make both MADD and MADDU immediately reachable and
testable, at least for the R5900 to begin with:

--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -22768,6 +22768,11 @@ static void decode_opc_special2_legacy(CPUMIPSState 
*env, DisasContext *ctx)
     switch (op1) {
     case OPC_MADD: /* Multiply and add/sub */
     case OPC_MADDU:
+        if (ctx->insn_flags & INSN_R5900) {
+            gen_mul_txx9(ctx, op1, 0, rd, rs, rt);
+            break;
+        }
+        /* Fallthrough */
     case OPC_MSUB:
     case OPC_MSUBU:
         check_insn(ctx, ISA_MIPS32);

> To be able to use the 64-bit result we need to use tcg_gen_mul_i64().

tcg_gen_muls2_i32 produces a 64-bit result in two 32-bit registers, and
tcg_gen_add2_i32 seems to correspond to adding such registers. And then
tcg_gen_ext_i32_tl could be used to extend the results to 64 bits. Look
at the cases for MULT and MULTU, since they are very similar.

Fredrik



reply via email to

[Prev in Thread] Current Thread [Next in Thread]