|
|
5544c1 |
From 66588d01b8cb710d746c249a34f31f7f353bc697 Mon Sep 17 00:00:00 2001
|
|
|
5544c1 |
From: Aurelien Jarno <aurelien@aurel32.net>
|
|
|
5544c1 |
Date: Sat, 22 Sep 2012 23:08:38 +0200
|
|
|
5544c1 |
Subject: [PATCH] tcg/mips: fix MIPS32(R2) detection
|
|
|
5544c1 |
|
|
|
5544c1 |
Fix the MIPS32(R2) cpu detection so that it also works with
|
|
|
5544c1 |
-march=octeon. Thanks to Andrew Pinski for the hint.
|
|
|
5544c1 |
|
|
|
5544c1 |
Cc: Andrew Pinski <apinski@cavium.com>
|
|
|
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 | 10 +++++-----
|
|
|
5544c1 |
tcg/mips/tcg-target.h | 8 ++++----
|
|
|
5544c1 |
2 files changed, 9 insertions(+), 9 deletions(-)
|
|
|
5544c1 |
|
|
|
5544c1 |
diff --git a/tcg/mips/tcg-target.c b/tcg/mips/tcg-target.c
|
|
|
5544c1 |
index c272b38..e9a1ffb 100644
|
|
|
5544c1 |
--- a/tcg/mips/tcg-target.c
|
|
|
5544c1 |
+++ b/tcg/mips/tcg-target.c
|
|
|
5544c1 |
@@ -425,7 +425,7 @@ static inline void tcg_out_movi(TCGContext *s, TCGType type,
|
|
|
5544c1 |
|
|
|
5544c1 |
static inline void tcg_out_bswap16(TCGContext *s, TCGReg ret, TCGReg arg)
|
|
|
5544c1 |
{
|
|
|
5544c1 |
-#ifdef _MIPS_ARCH_MIPS32R2
|
|
|
5544c1 |
+#if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
|
|
|
5544c1 |
tcg_out_opc_reg(s, OPC_WSBH, ret, 0, arg);
|
|
|
5544c1 |
#else
|
|
|
5544c1 |
/* ret and arg can't be register at */
|
|
|
5544c1 |
@@ -442,7 +442,7 @@ static inline void tcg_out_bswap16(TCGContext *s, TCGReg ret, TCGReg arg)
|
|
|
5544c1 |
|
|
|
5544c1 |
static inline void tcg_out_bswap16s(TCGContext *s, TCGReg ret, TCGReg arg)
|
|
|
5544c1 |
{
|
|
|
5544c1 |
-#ifdef _MIPS_ARCH_MIPS32R2
|
|
|
5544c1 |
+#if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
|
|
|
5544c1 |
tcg_out_opc_reg(s, OPC_WSBH, ret, 0, arg);
|
|
|
5544c1 |
tcg_out_opc_reg(s, OPC_SEH, ret, 0, ret);
|
|
|
5544c1 |
#else
|
|
|
5544c1 |
@@ -460,7 +460,7 @@ static inline void tcg_out_bswap16s(TCGContext *s, TCGReg ret, TCGReg arg)
|
|
|
5544c1 |
|
|
|
5544c1 |
static inline void tcg_out_bswap32(TCGContext *s, TCGReg ret, TCGReg arg)
|
|
|
5544c1 |
{
|
|
|
5544c1 |
-#ifdef _MIPS_ARCH_MIPS32R2
|
|
|
5544c1 |
+#if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
|
|
|
5544c1 |
tcg_out_opc_reg(s, OPC_WSBH, ret, 0, arg);
|
|
|
5544c1 |
tcg_out_opc_sa(s, OPC_ROTR, ret, ret, 16);
|
|
|
5544c1 |
#else
|
|
|
5544c1 |
@@ -486,7 +486,7 @@ static inline void tcg_out_bswap32(TCGContext *s, TCGReg ret, TCGReg arg)
|
|
|
5544c1 |
|
|
|
5544c1 |
static inline void tcg_out_ext8s(TCGContext *s, TCGReg ret, TCGReg arg)
|
|
|
5544c1 |
{
|
|
|
5544c1 |
-#ifdef _MIPS_ARCH_MIPS32R2
|
|
|
5544c1 |
+#if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
|
|
|
5544c1 |
tcg_out_opc_reg(s, OPC_SEB, ret, 0, arg);
|
|
|
5544c1 |
#else
|
|
|
5544c1 |
tcg_out_opc_sa(s, OPC_SLL, ret, arg, 24);
|
|
|
5544c1 |
@@ -496,7 +496,7 @@ static inline void tcg_out_ext8s(TCGContext *s, TCGReg ret, TCGReg arg)
|
|
|
5544c1 |
|
|
|
5544c1 |
static inline void tcg_out_ext16s(TCGContext *s, TCGReg ret, TCGReg arg)
|
|
|
5544c1 |
{
|
|
|
5544c1 |
-#ifdef _MIPS_ARCH_MIPS32R2
|
|
|
5544c1 |
+#if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
|
|
|
5544c1 |
tcg_out_opc_reg(s, OPC_SEH, ret, 0, arg);
|
|
|
5544c1 |
#else
|
|
|
5544c1 |
tcg_out_opc_sa(s, OPC_SLL, ret, arg, 16);
|
|
|
5544c1 |
diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h
|
|
|
5544c1 |
index d147e70..7020d65 100644
|
|
|
5544c1 |
--- a/tcg/mips/tcg-target.h
|
|
|
5544c1 |
+++ b/tcg/mips/tcg-target.h
|
|
|
5544c1 |
@@ -88,16 +88,16 @@ typedef enum {
|
|
|
5544c1 |
#define TCG_TARGET_HAS_nand_i32 0
|
|
|
5544c1 |
|
|
|
5544c1 |
/* optional instructions only implemented on MIPS4, MIPS32 and Loongson 2 */
|
|
|
5544c1 |
-#if defined(_MIPS_ARCH_MIPS4) || defined(_MIPS_ARCH_MIPS32) || \
|
|
|
5544c1 |
- defined(_MIPS_ARCH_MIPS32R2) || defined(_MIPS_ARCH_LOONGSON2E) || \
|
|
|
5544c1 |
- defined(_MIPS_ARCH_LOONGSON2F)
|
|
|
5544c1 |
+#if (defined(__mips_isa_rev) && (__mips_isa_rev >= 1)) || \
|
|
|
5544c1 |
+ defined(_MIPS_ARCH_LOONGSON2E) || defined(_MIPS_ARCH_LOONGSON2F) || \
|
|
|
5544c1 |
+ defined(_MIPS_ARCH_MIPS4)
|
|
|
5544c1 |
#define TCG_TARGET_HAS_movcond_i32 1
|
|
|
5544c1 |
#else
|
|
|
5544c1 |
#define TCG_TARGET_HAS_movcond_i32 0
|
|
|
5544c1 |
#endif
|
|
|
5544c1 |
|
|
|
5544c1 |
/* optional instructions only implemented on MIPS32R2 */
|
|
|
5544c1 |
-#ifdef _MIPS_ARCH_MIPS32R2
|
|
|
5544c1 |
+#if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
|
|
|
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 |
--
|
|
|
5544c1 |
1.7.12.1
|
|
|
5544c1 |
|