[Qemu-devel] [PATCH v5 14/76] target/mips: Add gen_op_addr_addi()

Aleksandar Markovic posted 76 patches 7 years, 3 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v5 14/76] target/mips: Add gen_op_addr_addi()
Posted by Aleksandar Markovic 7 years, 3 months ago
From: Stefan Markovic <smarkovic@wavecomp.com>

Add gen_op_addr_addi(). This function will be used in emulation of
some nanoMIPS instructions.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
---
 target/mips/translate.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/target/mips/translate.c b/target/mips/translate.c
index 5ceeec7..384135a 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -1733,6 +1733,18 @@ static inline void gen_op_addr_add (DisasContext *ctx, TCGv ret, TCGv arg0, TCGv
 #endif
 }
 
+static inline void gen_op_addr_addi(DisasContext *ctx, TCGv ret, TCGv base,
+                                    target_long ofs)
+{
+    tcg_gen_addi_tl(ret, base, ofs);
+
+#if defined(TARGET_MIPS64)
+    if (ctx->hflags & MIPS_HFLAG_AWRAP) {
+        tcg_gen_ext32s_i64(ret, ret);
+    }
+#endif
+}
+
 /* Addresses computation (translation time) */
 static target_long addr_add(DisasContext *ctx, target_long base,
                             target_long offset)
-- 
2.7.4


Re: [Qemu-devel] [PATCH v5 14/76] target/mips: Add gen_op_addr_addi()
Posted by Richard Henderson 7 years, 3 months ago
On 07/30/2018 12:11 PM, Aleksandar Markovic wrote:
> From: Stefan Markovic <smarkovic@wavecomp.com>
> 
> Add gen_op_addr_addi(). This function will be used in emulation of
> some nanoMIPS instructions.
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
> ---
>  target/mips/translate.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

For your general mips to-do list, there are lots of places in
the existing code that can be cleaned up to make use of this
new function.


r~