[PATCH] MIPS: Add microMIPS MSA support.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven J. Hill" <Steven.Hill@xxxxxxxxxx>

This patch adds support for the microMIPS implementation
of the MSA instructions.

Signed-off-by: Steven J. Hill <Steven.Hill@xxxxxxxxxx>
Reviewed-by: Paul Burton <Paul.Burton@xxxxxxxxxx>
---
 arch/mips/include/asm/asmmacro.h | 35 +++++++++++++++++++++++++++++++++++
 arch/mips/include/asm/msa.h      | 18 ++++++++++++++----
 2 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h
index b464b8b..30d1ac3 100644
--- a/arch/mips/include/asm/asmmacro.h
+++ b/arch/mips/include/asm/asmmacro.h
@@ -273,7 +273,12 @@
 	.macro	cfcmsa	rd, cs
 	.set	push
 	.set	noat
+#ifdef CONFIG_CPU_MICROMIPS
+	.insn
+	.word	0x587e0056 | (\cs << 11)
+#else
 	.word	0x787e0059 | (\cs << 11)
+#endif
 	move	\rd, $1
 	.set	pop
 	.endm
@@ -282,7 +287,11 @@
 	.set	push
 	.set	noat
 	move	$1, \rs
+#ifdef CONFIG_CPU_MICROMIPS
+	.word	0x583e0816 | (\cd << 6)
+#else
 	.word	0x783e0819 | (\cd << 6)
+#endif
 	.set	pop
 	.endm
 
@@ -290,7 +299,11 @@
 	.set	push
 	.set	noat
 	add	$1, \base, \off
+#ifdef CONFIG_CPU_MICROMIPS
+	.word	0x5800083f | (\wd << 6)
+#else
 	.word	0x78000823 | (\wd << 6)
+#endif
 	.set	pop
 	.endm
 
@@ -298,14 +311,23 @@
 	.set	push
 	.set	noat
 	add	$1, \base, \off
+#ifdef CONFIG_CPU_MICROMIPS
+	.word	0x5800083f | (\wd << 6)
+#else
 	.word	0x78000827 | (\wd << 6)
+#endif
 	.set	pop
 	.endm
 
 	.macro	copy_u_w	rd, ws, n
 	.set	push
 	.set	noat
+#ifdef CONFIG_CPU_MICROMIPS
+	.insn
+	.word	0x58f00056 | (\n << 16) | (\ws << 11)
+#else
 	.word	0x78f00059 | (\n << 16) | (\ws << 11)
+#endif
 	/* move triggers an assembler bug... */
 	or	\rd, $1, zero
 	.set	pop
@@ -314,7 +336,12 @@
 	.macro	copy_u_d	rd, ws, n
 	.set	push
 	.set	noat
+#ifdef CONFIG_CPU_MICROMIPS
+	.insn
+	.word	0x58f80056 | (\n << 16) | (\ws << 11)
+#else
 	.word	0x78f80059 | (\n << 16) | (\ws << 11)
+#endif
 	/* move triggers an assembler bug... */
 	or	\rd, $1, zero
 	.set	pop
@@ -325,7 +352,11 @@
 	.set	noat
 	/* move triggers an assembler bug... */
 	or	$1, \rs, zero
+#ifdef CONFIG_CPU_MICROMIPS
+	.word	0x59300816 | (\n << 16) | (\wd << 6)
+#else
 	.word	0x79300819 | (\n << 16) | (\wd << 6)
+#endif
 	.set	pop
 	.endm
 
@@ -334,7 +365,11 @@
 	.set	noat
 	/* move triggers an assembler bug... */
 	or	$1, \rs, zero
+#ifdef CONFIG_CPU_MICROMIPS
+	.word	0x59380816 | (\n << 16) | (\wd << 6)
+#else
 	.word	0x79380819 | (\n << 16) | (\wd << 6)
+#endif
 	.set	pop
 	.endm
 #endif
diff --git a/arch/mips/include/asm/msa.h b/arch/mips/include/asm/msa.h
index a2aba6c..fd76b3b 100644
--- a/arch/mips/include/asm/msa.h
+++ b/arch/mips/include/asm/msa.h
@@ -96,6 +96,13 @@ static inline void write_msa_##name(unsigned int val)		\
  * allow compilation with toolchains that do not support MSA. Once all
  * toolchains in use support MSA these can be removed.
  */
+#ifdef CONFIG_CPU_MICROMIPS
+#define CFCMSA_INSN	0x587e0056
+#define CTCMSA_INSN	0x583e0816
+#else
+#define CFCMSA_INSN	0x787e0059
+#define CTCMSA_INSN	0x783e0819
+#endif
 
 #define __BUILD_MSA_CTL_REG(name, cs)				\
 static inline unsigned int read_msa_##name(void)		\
@@ -104,10 +111,12 @@ static inline unsigned int read_msa_##name(void)		\
 	__asm__ __volatile__(					\
 	"	.set	push\n"					\
 	"	.set	noat\n"					\
-	"	.word	0x787e0059 | (" #cs " << 11)\n"		\
+	"	.insn\n"					\
+	"	.word	%1 | (" #cs " << 11)\n"			\
 	"	move	%0, $1\n"				\
 	"	.set	pop\n"					\
-	: "=r"(reg));						\
+	: "=r"(reg)						\
+	: "i"(CFCMSA_INSN));					\
 	return reg;						\
 }								\
 								\
@@ -117,9 +126,10 @@ static inline void write_msa_##name(unsigned int val)		\
 	"	.set	push\n"					\
 	"	.set	noat\n"					\
 	"	move	$1, %0\n"				\
-	"	.word	0x783e0819 | (" #cs " << 6)\n"		\
+	"	.insn\n"					\
+	"	.word	%1 | (" #cs " << 6)\n"			\
 	"	.set	pop\n"					\
-	: : "r"(val));						\
+	: : "r"(val), "i"(CTCMSA_INSN));			\
 }
 
 #endif /* !TOOLCHAIN_SUPPORTS_MSA */
-- 
1.8.3.2



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux