|
|
5544c1 |
From 7c3e573b364a65d4abce5266c376f4e77624b039 Mon Sep 17 00:00:00 2001
|
|
|
5544c1 |
From: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
5544c1 |
Date: Fri, 21 Sep 2012 18:20:26 +0200
|
|
|
5544c1 |
Subject: [PATCH] tcg/mips: implement deposit op on MIPS32R2
|
|
|
5544c1 |
|
|
|
5544c1 |
deposit operations can be optimized on MIPS32 Release 2 using the INS
|
|
|
5544c1 |
instruction.
|
|
|
5544c1 |
|
|
|
5544c1 |
Reviewed-by: Richard Henderson <rth@twiddle.net>
|
|
|
5544c1 |
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
5544c1 |
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
|
|
|
5544c1 |
---
|
|
|
5544c1 |
tcg/mips/tcg-target.c | 8 ++++++++
|
|
|
5544c1 |
tcg/mips/tcg-target.h | 3 ++-
|
|
|
5544c1 |
2 files changed, 10 insertions(+), 1 deletion(-)
|
|
|
5544c1 |
|
|
|
5544c1 |
diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
|
|
|
5544c1 |
index 592e42a..b2e1056 100644
|
|
|
5544c1 |
--- a/tcg/mips/tcg-target.c
|
|
|
5544c1 |
+++ b/tcg/mips/tcg-target.c
|
|
|
5544c1 |
@@ -328,6 +328,7 @@ enum {
|
|
|
5544c1 |
OPC_BGEZ = OPC_REGIMM | (0x01 << 16),
|
|
|
5544c1 |
|
|
|
5544c1 |
OPC_SPECIAL3 = 0x1f << 26,
|
|
|
5544c1 |
+ OPC_INS = OPC_SPECIAL3 | 0x004,
|
|
|
5544c1 |
OPC_WSBH = OPC_SPECIAL3 | 0x0a0,
|
|
|
5544c1 |
OPC_SEB = OPC_SPECIAL3 | 0x420,
|
|
|
5544c1 |
OPC_SEH = OPC_SPECIAL3 | 0x620,
|
|
|
5544c1 |
@@ -1455,6 +1456,11 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
|
|
|
5544c1 |
tcg_out_ext16s(s, args[0], args[1]);
|
|
|
5544c1 |
break;
|
|
|
5544c1 |
|
|
|
5544c1 |
+ case INDEX_op_deposit_i32:
|
|
|
5544c1 |
+ tcg_out_opc_imm(s, OPC_INS, args[0], args[2],
|
|
|
5544c1 |
+ ((args[3] + args[4] - 1) << 11) | (args[3] << 6));
|
|
|
5544c1 |
+ break;
|
|
|
5544c1 |
+
|
|
|
5544c1 |
case INDEX_op_brcond_i32:
|
|
|
5544c1 |
tcg_out_brcond(s, args[2], args[0], args[1], args[3]);
|
|
|
5544c1 |
break;
|
|
|
5544c1 |
@@ -1550,6 +1556,8 @@ static const TCGTargetOpDef mips_op_defs[] = {
|
|
|
5544c1 |
{ INDEX_op_ext8s_i32, { "r", "rZ" } },
|
|
|
5544c1 |
{ INDEX_op_ext16s_i32, { "r", "rZ" } },
|
|
|
5544c1 |
|
|
|
5544c1 |
+ { INDEX_op_deposit_i32, { "r", "0", "rZ" } },
|
|
|
5544c1 |
+
|
|
|
5544c1 |
{ INDEX_op_brcond_i32, { "rZ", "rZ" } },
|
|
|
5544c1 |
{ INDEX_op_setcond_i32, { "r", "rZ", "rZ" } },
|
|
|
5544c1 |
{ INDEX_op_setcond2_i32, { "r", "rZ", "rZ", "rZ", "rZ" } },
|
|
|
5544c1 |
diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h
|
|
|
5544c1 |
index 470314c..897a737 100644
|
|
|
5544c1 |
--- a/tcg/mips/tcg-target.h
|
|
|
5544c1 |
+++ b/tcg/mips/tcg-target.h
|
|
|
5544c1 |
@@ -86,7 +86,6 @@ typedef enum {
|
|
|
5544c1 |
#define TCG_TARGET_HAS_orc_i32 0
|
|
|
5544c1 |
#define TCG_TARGET_HAS_eqv_i32 0
|
|
|
5544c1 |
#define TCG_TARGET_HAS_nand_i32 0
|
|
|
5544c1 |
-#define TCG_TARGET_HAS_deposit_i32 0
|
|
|
5544c1 |
#define TCG_TARGET_HAS_movcond_i32 0
|
|
|
5544c1 |
|
|
|
5544c1 |
/* optional instructions only implemented on MIPS32R2 */
|
|
|
5544c1 |
@@ -94,10 +93,12 @@ typedef enum {
|
|
|
5544c1 |
#define TCG_TARGET_HAS_bswap16_i32 1
|
|
|
5544c1 |
#define TCG_TARGET_HAS_bswap32_i32 1
|
|
|
5544c1 |
#define TCG_TARGET_HAS_rot_i32 1
|
|
|
5544c1 |
+#define TCG_TARGET_HAS_deposit_i32 1
|
|
|
5544c1 |
#else
|
|
|
5544c1 |
#define TCG_TARGET_HAS_bswap16_i32 0
|
|
|
5544c1 |
#define TCG_TARGET_HAS_bswap32_i32 0
|
|
|
5544c1 |
#define TCG_TARGET_HAS_rot_i32 0
|
|
|
5544c1 |
+#define TCG_TARGET_HAS_deposit_i32 0
|
|
|
5544c1 |
#endif
|
|
|
5544c1 |
|
|
|
5544c1 |
/* optional instructions automatically implemented */
|
|
|
5544c1 |
--
|
|
|
5544c1 |
1.7.12.1
|
|
|
5544c1 |
|