MIPS: Add microMIPS MSA support.
This patch adds support for the microMIPS implementation of the MSA instructions. Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com> Reviewed-by: Paul Burton <Paul.Burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/6763/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
8e9ecbc5e2
commit
d96cc3d1ec
|
@ -249,13 +249,35 @@
|
||||||
.set pop
|
.set pop
|
||||||
.endm
|
.endm
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#ifdef CONFIG_CPU_MICROMIPS
|
||||||
|
#define CFC_MSA_INSN 0x587e0056
|
||||||
|
#define CTC_MSA_INSN 0x583e0816
|
||||||
|
#define LDD_MSA_INSN 0x58000837
|
||||||
|
#define STD_MSA_INSN 0x5800083f
|
||||||
|
#define COPY_UW_MSA_INSN 0x58f00056
|
||||||
|
#define COPY_UD_MSA_INSN 0x58f80056
|
||||||
|
#define INSERT_W_MSA_INSN 0x59300816
|
||||||
|
#define INSERT_D_MSA_INSN 0x59380816
|
||||||
|
#else
|
||||||
|
#define CFC_MSA_INSN 0x787e0059
|
||||||
|
#define CTC_MSA_INSN 0x783e0819
|
||||||
|
#define LDD_MSA_INSN 0x78000823
|
||||||
|
#define STD_MSA_INSN 0x78000827
|
||||||
|
#define COPY_UW_MSA_INSN 0x78f00059
|
||||||
|
#define COPY_UD_MSA_INSN 0x78f80059
|
||||||
|
#define INSERT_W_MSA_INSN 0x79300819
|
||||||
|
#define INSERT_D_MSA_INSN 0x79380819
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Temporary until all toolchains in use include MSA support.
|
* Temporary until all toolchains in use include MSA support.
|
||||||
*/
|
*/
|
||||||
.macro cfcmsa rd, cs
|
.macro cfcmsa rd, cs
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
.word 0x787e0059 | (\cs << 11)
|
.insn
|
||||||
|
.word CFC_MSA_INSN | (\cs << 11)
|
||||||
move \rd, $1
|
move \rd, $1
|
||||||
.set pop
|
.set pop
|
||||||
.endm
|
.endm
|
||||||
|
@ -264,7 +286,7 @@
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
move $1, \rs
|
move $1, \rs
|
||||||
.word 0x783e0819 | (\cd << 6)
|
.word CTC_MSA_INSN | (\cd << 6)
|
||||||
.set pop
|
.set pop
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ -272,7 +294,7 @@
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
add $1, \base, \off
|
add $1, \base, \off
|
||||||
.word 0x78000823 | (\wd << 6)
|
.word LDD_MSA_INSN | (\wd << 6)
|
||||||
.set pop
|
.set pop
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ -280,14 +302,15 @@
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
add $1, \base, \off
|
add $1, \base, \off
|
||||||
.word 0x78000827 | (\wd << 6)
|
.word STD_MSA_INSN | (\wd << 6)
|
||||||
.set pop
|
.set pop
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro copy_u_w rd, ws, n
|
.macro copy_u_w rd, ws, n
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
.word 0x78f00059 | (\n << 16) | (\ws << 11)
|
.insn
|
||||||
|
.word COPY_UW_MSA_INSN | (\n << 16) | (\ws << 11)
|
||||||
/* move triggers an assembler bug... */
|
/* move triggers an assembler bug... */
|
||||||
or \rd, $1, zero
|
or \rd, $1, zero
|
||||||
.set pop
|
.set pop
|
||||||
|
@ -296,7 +319,8 @@
|
||||||
.macro copy_u_d rd, ws, n
|
.macro copy_u_d rd, ws, n
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
.word 0x78f80059 | (\n << 16) | (\ws << 11)
|
.insn
|
||||||
|
.word COPY_UD_MSA_INSN | (\n << 16) | (\ws << 11)
|
||||||
/* move triggers an assembler bug... */
|
/* move triggers an assembler bug... */
|
||||||
or \rd, $1, zero
|
or \rd, $1, zero
|
||||||
.set pop
|
.set pop
|
||||||
|
@ -307,7 +331,7 @@
|
||||||
.set noat
|
.set noat
|
||||||
/* move triggers an assembler bug... */
|
/* move triggers an assembler bug... */
|
||||||
or $1, \rs, zero
|
or $1, \rs, zero
|
||||||
.word 0x79300819 | (\n << 16) | (\wd << 6)
|
.word INSERT_W_MSA_INSN | (\n << 16) | (\wd << 6)
|
||||||
.set pop
|
.set pop
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ -316,7 +340,7 @@
|
||||||
.set noat
|
.set noat
|
||||||
/* move triggers an assembler bug... */
|
/* move triggers an assembler bug... */
|
||||||
or $1, \rs, zero
|
or $1, \rs, zero
|
||||||
.word 0x79380819 | (\n << 16) | (\wd << 6)
|
.word INSERT_D_MSA_INSN | (\n << 16) | (\wd << 6)
|
||||||
.set pop
|
.set pop
|
||||||
.endm
|
.endm
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -96,6 +96,13 @@ static inline void write_msa_##name(unsigned int val) \
|
||||||
* allow compilation with toolchains that do not support MSA. Once all
|
* allow compilation with toolchains that do not support MSA. Once all
|
||||||
* toolchains in use support MSA these can be removed.
|
* toolchains in use support MSA these can be removed.
|
||||||
*/
|
*/
|
||||||
|
#ifdef CONFIG_CPU_MICROMIPS
|
||||||
|
#define CFC_MSA_INSN 0x587e0056
|
||||||
|
#define CTC_MSA_INSN 0x583e0816
|
||||||
|
#else
|
||||||
|
#define CFC_MSA_INSN 0x787e0059
|
||||||
|
#define CTC_MSA_INSN 0x783e0819
|
||||||
|
#endif
|
||||||
|
|
||||||
#define __BUILD_MSA_CTL_REG(name, cs) \
|
#define __BUILD_MSA_CTL_REG(name, cs) \
|
||||||
static inline unsigned int read_msa_##name(void) \
|
static inline unsigned int read_msa_##name(void) \
|
||||||
|
@ -104,7 +111,8 @@ static inline unsigned int read_msa_##name(void) \
|
||||||
__asm__ __volatile__( \
|
__asm__ __volatile__( \
|
||||||
" .set push\n" \
|
" .set push\n" \
|
||||||
" .set noat\n" \
|
" .set noat\n" \
|
||||||
" .word 0x787e0059 | (" #cs " << 11)\n" \
|
" .insn\n" \
|
||||||
|
" .word #CFC_MSA_INSN | (" #cs " << 11)\n" \
|
||||||
" move %0, $1\n" \
|
" move %0, $1\n" \
|
||||||
" .set pop\n" \
|
" .set pop\n" \
|
||||||
: "=r"(reg)); \
|
: "=r"(reg)); \
|
||||||
|
@ -117,7 +125,8 @@ static inline void write_msa_##name(unsigned int val) \
|
||||||
" .set push\n" \
|
" .set push\n" \
|
||||||
" .set noat\n" \
|
" .set noat\n" \
|
||||||
" move $1, %0\n" \
|
" move $1, %0\n" \
|
||||||
" .word 0x783e0819 | (" #cs " << 6)\n" \
|
" .insn\n" \
|
||||||
|
" .word #CTC_MSA_INSN | (" #cs " << 6)\n" \
|
||||||
" .set pop\n" \
|
" .set pop\n" \
|
||||||
: : "r"(val)); \
|
: : "r"(val)); \
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue