2006-09-10 14:02:42 +00:00
|
|
|
/*
|
|
|
|
* copyright (c) 2002 Leon van Stuivenberg
|
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2006-09-10 14:02:42 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2006-10-07 15:30:46 +00:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2006-09-10 14:02:42 +00:00
|
|
|
*
|
2006-10-07 15:30:46 +00:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2006-09-10 14:02:42 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2006-10-07 15:30:46 +00:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2006-09-10 14:02:42 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2008-08-31 07:39:47 +00:00
|
|
|
#ifndef AVCODEC_PS2_MMI_H
|
|
|
|
#define AVCODEC_PS2_MMI_H
|
2002-09-23 08:44:24 +00:00
|
|
|
|
|
|
|
#define align16 __attribute__ ((aligned (16)))
|
|
|
|
|
|
|
|
/*
|
|
|
|
#define r0 $zero
|
2005-12-22 01:10:11 +00:00
|
|
|
#define r1 $at //assembler!
|
|
|
|
#define r2 $v0 //return
|
|
|
|
#define r3 $v1 //return
|
|
|
|
#define r4 $a0 //arg
|
|
|
|
#define r5 $a1 //arg
|
|
|
|
#define r6 $a2 //arg
|
|
|
|
#define r7 $a3 //arg
|
|
|
|
#define r8 $t0 //temp
|
|
|
|
#define r9 $t1 //temp
|
|
|
|
#define r10 $t2 //temp
|
|
|
|
#define r11 $t3 //temp
|
|
|
|
#define r12 $t4 //temp
|
|
|
|
#define r13 $t5 //temp
|
|
|
|
#define r14 $t6 //temp
|
|
|
|
#define r15 $t7 //temp
|
|
|
|
#define r16 $s0 //saved temp
|
|
|
|
#define r17 $s1 //saved temp
|
|
|
|
#define r18 $s2 //saved temp
|
|
|
|
#define r19 $s3 //saved temp
|
|
|
|
#define r20 $s4 //saved temp
|
|
|
|
#define r21 $s5 //saved temp
|
|
|
|
#define r22 $s6 //saved temp
|
|
|
|
#define r23 $s7 //saved temp
|
|
|
|
#define r24 $t8 //temp
|
|
|
|
#define r25 $t9 //temp
|
|
|
|
#define r26 $k0 //kernel
|
|
|
|
#define r27 $k1 //kernel
|
|
|
|
#define r28 $gp //global ptr
|
|
|
|
#define r29 $sp //stack ptr
|
|
|
|
#define r30 $fp //frame ptr
|
|
|
|
#define r31 $ra //return addr
|
2002-09-23 08:44:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define lq(base, off, reg) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("lq " #reg ", %0("#base ")" : : "i" (off) )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define lq2(mem, reg) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("lq " #reg ", %0" : : "r" (mem))
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define sq(reg, off, base) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("sq " #reg ", %0("#base ")" : : "i" (off) )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2002-10-03 20:57:19 +00:00
|
|
|
/*
|
2005-12-22 01:10:11 +00:00
|
|
|
#define ld(base, off, reg) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("ld " #reg ", " #off "("#base ")")
|
2002-10-03 20:57:19 +00:00
|
|
|
*/
|
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define ld3(base, off, reg) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile (".word %0" : : "i" ( 0xdc000000 | (base<<21) | (reg<<16) | (off)))
|
2002-10-03 20:57:19 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define ldr3(base, off, reg) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile (".word %0" : : "i" ( 0x6c000000 | (base<<21) | (reg<<16) | (off)))
|
2002-10-03 20:57:19 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define ldl3(base, off, reg) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile (".word %0" : : "i" ( 0x68000000 | (base<<21) | (reg<<16) | (off)))
|
2002-10-03 20:57:19 +00:00
|
|
|
|
2002-09-23 08:44:24 +00:00
|
|
|
/*
|
2005-12-22 01:10:11 +00:00
|
|
|
#define sd(reg, off, base) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("sd " #reg ", " #off "("#base ")")
|
2002-09-23 08:44:24 +00:00
|
|
|
*/
|
|
|
|
//seems assembler has bug encoding mnemonic 'sd', so DIY
|
2005-12-22 01:10:11 +00:00
|
|
|
#define sd3(reg, off, base) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile (".word %0" : : "i" ( 0xfc000000 | (base<<21) | (reg<<16) | (off)))
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define sw(reg, off, base) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("sw " #reg ", " #off "("#base ")")
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define sq2(reg, mem) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("sq " #reg ", %0" : : "m" (*(mem)))
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pinth(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pinth " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define phmadh(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("phmadh " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pcpyud(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pcpyud " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pcpyld(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pcpyld " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pcpyh(rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pcpyh " #rd ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define paddw(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("paddw " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pextlw(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pextlw " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pextuw(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pextuw " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pextlh(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pextlh " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pextuh(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pextuh " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define psubw(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("psubw " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define psraw(rt, sa, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("psraw " #rd ", " #rt ", %0" : : "i"(sa) )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define ppach(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("ppach " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define ppacb(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("ppacb " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define prevh(rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("prevh " #rd ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pmulth(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pmulth " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pmaxh(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pmaxh " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pminh(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pminh " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pinteh(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pinteh " #rd ", " #rs ", " #rt )
|
2002-10-03 20:57:19 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define paddh(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("paddh " #rd ", " #rs ", " #rt )
|
2002-10-03 20:57:19 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define psubh(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("psubh " #rd ", " #rs ", " #rt )
|
2002-10-03 20:57:19 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define psrah(rt, sa, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("psrah " #rd ", " #rt ", %0" : : "i"(sa) )
|
2002-10-03 20:57:19 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pmfhl_uw(rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pmfhl.uw " #rd)
|
2002-10-03 20:57:19 +00:00
|
|
|
|
2005-12-22 01:10:11 +00:00
|
|
|
#define pextlb(rs, rt, rd) \
|
2008-10-16 13:34:09 +00:00
|
|
|
__asm__ volatile ("pextlb " #rd ", " #rs ", " #rt )
|
2002-09-23 08:44:24 +00:00
|
|
|
|
2008-08-31 07:39:47 +00:00
|
|
|
#endif /* AVCODEC_PS2_MMI_H */
|