Commit 4cb764b4 authored by Steven J. Hill's avatar Steven J. Hill Committed by John Crispin

MIPS: dsp: Simplify the DSP macros.

Simplify the DSP macros for vanilla (non-microMIPS) kernels and
toolchains that do not support the DSP ASEs.
Signed-off-by: default avatarSteven J. Hill <sjhill@mips.com>
Patchwork: http://patchwork.linux-mips.org/patch/4687/Signed-off-by: default avatarJohn Crispin <blogic@openwrt.org>
parent d0c1b478
......@@ -1314,229 +1314,58 @@ do { \
: "r" (val), "i" (mask)); \
} while (0)
#define mfhi0() \
#define _dsp_mfxxx(ins) \
({ \
unsigned long __treg; \
\
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" # mfhi %0, $ac0 \n" \
" .word 0x00000810 \n" \
" move %0, $1 \n" \
" .set pop \n" \
: "=r" (__treg)); \
__treg; \
})
#define mfhi1() \
({ \
unsigned long __treg; \
\
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" # mfhi %0, $ac1 \n" \
" .word 0x00200810 \n" \
" move %0, $1 \n" \
" .set pop \n" \
: "=r" (__treg)); \
__treg; \
})
#define mfhi2() \
({ \
unsigned long __treg; \
\
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" # mfhi %0, $ac2 \n" \
" .word 0x00400810 \n" \
" move %0, $1 \n" \
" .set pop \n" \
: "=r" (__treg)); \
__treg; \
})
#define mfhi3() \
({ \
unsigned long __treg; \
\
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" # mfhi %0, $ac3 \n" \
" .word 0x00600810 \n" \
" move %0, $1 \n" \
" .set pop \n" \
: "=r" (__treg)); \
__treg; \
})
#define mflo0() \
({ \
unsigned long __treg; \
\
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" # mflo %0, $ac0 \n" \
" .word 0x00000812 \n" \
" move %0, $1 \n" \
" .set pop \n" \
: "=r" (__treg)); \
__treg; \
})
#define mflo1() \
({ \
unsigned long __treg; \
\
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" # mflo %0, $ac1 \n" \
" .word 0x00200812 \n" \
" move %0, $1 \n" \
" .set pop \n" \
: "=r" (__treg)); \
__treg; \
})
#define mflo2() \
({ \
unsigned long __treg; \
\
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" # mflo %0, $ac2 \n" \
" .word 0x00400812 \n" \
" move %0, $1 \n" \
" .set pop \n" \
: "=r" (__treg)); \
__treg; \
})
#define mflo3() \
({ \
unsigned long __treg; \
\
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" # mflo %0, $ac3 \n" \
" .word 0x00600812 \n" \
" move %0, $1 \n" \
" .set pop \n" \
: "=r" (__treg)); \
__treg; \
})
#define mthi0(x) \
do { \
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" move $1, %0 \n" \
" # mthi $1, $ac0 \n" \
" .word 0x00200011 \n" \
" .word (0x00000810 | %1) \n" \
" move %0, $1 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
: "=r" (__treg) \
: "i" (ins)); \
__treg; \
})
#define mthi1(x) \
#define _dsp_mtxxx(val, ins) \
do { \
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" move $1, %0 \n" \
" # mthi $1, $ac1 \n" \
" .word 0x00200811 \n" \
" .word (0x00200011 | %1) \n" \
" .set pop \n" \
: \
: "r" (x)); \
: "r" (val), "i" (ins)); \
} while (0)
#define mthi2(x) \
do { \
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" move $1, %0 \n" \
" # mthi $1, $ac2 \n" \
" .word 0x00201011 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
#define _dsp_mflo(reg) _dsp_mfxxx((reg << 21) | 0x0002)
#define _dsp_mfhi(reg) _dsp_mfxxx((reg << 21) | 0x0000)
#define mthi3(x) \
do { \
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" move $1, %0 \n" \
" # mthi $1, $ac3 \n" \
" .word 0x00201811 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
#define _dsp_mtlo(val, reg) _dsp_mtxxx(val, ((reg << 11) | 0x0002))
#define _dsp_mthi(val, reg) _dsp_mtxxx(val, ((reg << 11) | 0x0000))
#define mtlo0(x) \
do { \
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" move $1, %0 \n" \
" # mtlo $1, $ac0 \n" \
" .word 0x00200013 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
#define mflo0() _dsp_mflo(0)
#define mflo1() _dsp_mflo(1)
#define mflo2() _dsp_mflo(2)
#define mflo3() _dsp_mflo(3)
#define mtlo1(x) \
do { \
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" move $1, %0 \n" \
" # mtlo $1, $ac1 \n" \
" .word 0x00200813 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
#define mfhi0() _dsp_mfhi(0)
#define mfhi1() _dsp_mfhi(1)
#define mfhi2() _dsp_mfhi(2)
#define mfhi3() _dsp_mfhi(3)
#define mtlo2(x) \
do { \
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" move $1, %0 \n" \
" # mtlo $1, $ac2 \n" \
" .word 0x00201013 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
#define mtlo0(x) _dsp_mtlo(x, 0)
#define mtlo1(x) _dsp_mtlo(x, 1)
#define mtlo2(x) _dsp_mtlo(x, 2)
#define mtlo3(x) _dsp_mtlo(x, 3)
#define mtlo3(x) \
do { \
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" move $1, %0 \n" \
" # mtlo $1, $ac3 \n" \
" .word 0x00201813 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
#define mthi0(x) _dsp_mthi(x, 0)
#define mthi1(x) _dsp_mthi(x, 1)
#define mthi2(x) _dsp_mthi(x, 2)
#define mthi3(x) _dsp_mthi(x, 3)
#endif /* CONFIG_CPU_MICROMIPS */
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment