summaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/asmmacro.h
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2014-01-15 10:31:49 +0000
committerRalf Baechle <ralf@linux-mips.org>2014-03-06 21:25:22 +0100
commit1d68808748afe21ac35bedc2726043bea33a1c0d (patch)
tree974825b032e342da5754e78a3f7f77b65ec0fe1e /arch/mips/include/asm/asmmacro.h
parent6d9727a7a58e11c09d28a67345d9a186fcbbdd8f (diff)
downloadlinux-1d68808748afe21ac35bedc2726043bea33a1c0d.tar.bz2
MIPS: Introduce _EXT assembler macro
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> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/6358/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include/asm/asmmacro.h')
-rw-r--r--arch/mips/include/asm/asmmacro.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h
index 3220c93ea981..ef066b17a650 100644
--- a/arch/mips/include/asm/asmmacro.h
+++ b/arch/mips/include/asm/asmmacro.h
@@ -169,6 +169,17 @@
fpu_restore_16even \thread \tmp
.endm
+#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
*/