Skip to content

Commit 1d68808

Browse files
paulburtonralfbaechle
authored andcommitted
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>
1 parent 6d9727a commit 1d68808

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/mips/include/asm/asmmacro.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,17 @@
169169
fpu_restore_16even \thread \tmp
170170
.endm
171171

172+
#ifdef CONFIG_CPU_MIPSR2
173+
.macro _EXT rd, rs, p, s
174+
ext \rd, \rs, \p, \s
175+
.endm
176+
#else /* !CONFIG_CPU_MIPSR2 */
177+
.macro _EXT rd, rs, p, s
178+
srl \rd, \rs, \p
179+
andi \rd, \rd, (1 << \s) - 1
180+
.endm
181+
#endif /* !CONFIG_CPU_MIPSR2 */
182+
172183
/*
173184
* Temporary until all gas have MT ASE support
174185
*/

0 commit comments

Comments
 (0)