linux-mips
[Top] [All Lists]

[PATCH 04/15] MIPS: introduce _EXT assembler macro

To: <linux-mips@linux-mips.org>
Subject: [PATCH 04/15] MIPS: introduce _EXT assembler macro
From: Paul Burton <paul.burton@imgtec.com>
Date: Wed, 15 Jan 2014 10:31:49 +0000
Cc: Paul Burton <paul.burton@imgtec.com>
In-reply-to: <1389781920-31151-1-git-send-email-paul.burton@imgtec.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1389781920-31151-1-git-send-email-paul.burton@imgtec.com>
Sender: linux-mips-bounce@linux-mips.org
This patch adds a simple macro to wrap the ext instruction which was
introduced with MIPSR2, and fall back to a shift & and pair for
pre-MIPSR2 CPUs. This will be used in a subsequent patch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
 arch/mips/include/asm/asmmacro.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h
index 6c8342a..1d2c9c2 100644
--- a/arch/mips/include/asm/asmmacro.h
+++ b/arch/mips/include/asm/asmmacro.h
@@ -62,6 +62,17 @@
        .endm
 #endif /* CONFIG_MIPS_MT_SMTC */
 
+#ifdef CONFIG_CPU_MIPSR2
+       .macro  _EXT    rd, rs, p, s
+       ext     \rd, \rs, \p, \s
+       .endm
+#else /* !CONFIG_CPU_MIPSR2 */
+       .macro  _EXT    rd, rs, p, s
+       srl     \rd, \rs, \p
+       andi    \rd, \rd, (1 << \s) - 1
+       .endm
+#endif /* !CONFIG_CPU_MIPSR2 */
+
 /*
  * Temporary until all gas have MT ASE support
  */
-- 
1.8.4.2



<Prev in Thread] Current Thread [Next in Thread>