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 { \ ...@@ -1314,229 +1314,58 @@ do { \
: "r" (val), "i" (mask)); \ : "r" (val), "i" (mask)); \
} while (0) } while (0)
#define mfhi0() \ #define _dsp_mfxxx(ins) \
({ \ ({ \
unsigned long __treg; \ unsigned long __treg; \
\ \
__asm__ __volatile__( \ __asm__ __volatile__( \
" .set push \n" \ " .set push \n" \
" .set noat \n" \ " .set noat \n" \
" # mfhi %0, $ac0 \n" \ " .word (0x00000810 | %1) \n" \
" .word 0x00000810 \n" \
" move %0, $1 \n" \ " move %0, $1 \n" \
" .set pop \n" \ " .set pop \n" \
: "=r" (__treg)); \ : "=r" (__treg) \
__treg; \ : "i" (ins)); \
})
#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; \ __treg; \
}) })
#define mthi0(x) \ #define _dsp_mtxxx(val, ins) \
do { \
__asm__ __volatile__( \
" .set push \n" \
" .set noat \n" \
" move $1, %0 \n" \
" # mthi $1, $ac0 \n" \
" .word 0x00200011 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
#define mthi1(x) \
do { \ do { \
__asm__ __volatile__( \ __asm__ __volatile__( \
" .set push \n" \ " .set push \n" \
" .set noat \n" \ " .set noat \n" \
" move $1, %0 \n" \ " move $1, %0 \n" \
" # mthi $1, $ac1 \n" \ " .word (0x00200011 | %1) \n" \
" .word 0x00200811 \n" \
" .set pop \n" \ " .set pop \n" \
: \ : \
: "r" (x)); \ : "r" (val), "i" (ins)); \
} while (0) } while (0)
#define mthi2(x) \ #define _dsp_mflo(reg) _dsp_mfxxx((reg << 21) | 0x0002)
do { \ #define _dsp_mfhi(reg) _dsp_mfxxx((reg << 21) | 0x0000)
__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 mthi3(x) \ #define _dsp_mtlo(val, reg) _dsp_mtxxx(val, ((reg << 11) | 0x0002))
do { \ #define _dsp_mthi(val, reg) _dsp_mtxxx(val, ((reg << 11) | 0x0000))
__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 mtlo0(x) \ #define mflo0() _dsp_mflo(0)
do { \ #define mflo1() _dsp_mflo(1)
__asm__ __volatile__( \ #define mflo2() _dsp_mflo(2)
" .set push \n" \ #define mflo3() _dsp_mflo(3)
" .set noat \n" \
" move $1, %0 \n" \
" # mtlo $1, $ac0 \n" \
" .word 0x00200013 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
#define mtlo1(x) \ #define mfhi0() _dsp_mfhi(0)
do { \ #define mfhi1() _dsp_mfhi(1)
__asm__ __volatile__( \ #define mfhi2() _dsp_mfhi(2)
" .set push \n" \ #define mfhi3() _dsp_mfhi(3)
" .set noat \n" \
" move $1, %0 \n" \
" # mtlo $1, $ac1 \n" \
" .word 0x00200813 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
#define mtlo2(x) \ #define mtlo0(x) _dsp_mtlo(x, 0)
do { \ #define mtlo1(x) _dsp_mtlo(x, 1)
__asm__ __volatile__( \ #define mtlo2(x) _dsp_mtlo(x, 2)
" .set push \n" \ #define mtlo3(x) _dsp_mtlo(x, 3)
" .set noat \n" \
" move $1, %0 \n" \
" # mtlo $1, $ac2 \n" \
" .word 0x00201013 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
#define mtlo3(x) \ #define mthi0(x) _dsp_mthi(x, 0)
do { \ #define mthi1(x) _dsp_mthi(x, 1)
__asm__ __volatile__( \ #define mthi2(x) _dsp_mthi(x, 2)
" .set push \n" \ #define mthi3(x) _dsp_mthi(x, 3)
" .set noat \n" \
" move $1, %0 \n" \
" # mtlo $1, $ac3 \n" \
" .word 0x00201813 \n" \
" .set pop \n" \
: \
: "r" (x)); \
} while (0)
#endif /* CONFIG_CPU_MICROMIPS */ #endif /* CONFIG_CPU_MICROMIPS */
#endif #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