2008-10-27 01:25:06 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* 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
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2008-12-30 04:13:52 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-07-27 14:53:44 +02:00
|
|
|
#ifdef __ELF__
|
2009-07-28 00:55:55 +02:00
|
|
|
# define ELF
|
|
|
|
#else
|
|
|
|
# define ELF @
|
2011-06-14 12:29:48 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if CONFIG_THUMB
|
|
|
|
# define A @
|
|
|
|
# define T
|
|
|
|
#else
|
|
|
|
# define A
|
|
|
|
# define T @
|
2009-07-27 14:53:44 +02:00
|
|
|
#endif
|
2009-07-28 00:55:55 +02:00
|
|
|
|
2011-11-15 02:15:52 +01:00
|
|
|
#if HAVE_NEON
|
|
|
|
.arch armv7-a
|
|
|
|
#elif HAVE_ARMV6T2
|
|
|
|
.arch armv6t2
|
|
|
|
#elif HAVE_ARMV6
|
|
|
|
.arch armv6
|
|
|
|
#elif HAVE_ARMV5TE
|
|
|
|
.arch armv5te
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAVE_NEON
|
|
|
|
.fpu neon
|
|
|
|
#elif HAVE_ARMVFP
|
|
|
|
.fpu vfp
|
|
|
|
#endif
|
|
|
|
|
2011-05-29 15:22:52 +02:00
|
|
|
.syntax unified
|
2011-06-14 12:29:48 +02:00
|
|
|
T .thumb
|
2011-05-29 15:22:52 +02:00
|
|
|
|
2010-06-29 16:48:41 +02:00
|
|
|
.macro require8 val=1
|
2009-07-28 00:55:55 +02:00
|
|
|
ELF .eabi_attribute 24, \val
|
2010-06-29 16:48:41 +02:00
|
|
|
.endm
|
2008-10-27 01:25:06 +01:00
|
|
|
|
2010-06-29 16:48:41 +02:00
|
|
|
.macro preserve8 val=1
|
2009-07-28 00:55:55 +02:00
|
|
|
ELF .eabi_attribute 25, \val
|
2010-06-29 16:48:41 +02:00
|
|
|
.endm
|
2008-10-27 01:25:06 +01:00
|
|
|
|
2010-06-29 16:48:41 +02:00
|
|
|
.macro function name, export=0
|
|
|
|
.macro endfunc
|
2010-03-10 22:39:58 +01:00
|
|
|
ELF .size \name, . - \name
|
2010-03-09 17:17:56 +01:00
|
|
|
.endfunc
|
|
|
|
.purgem endfunc
|
2010-06-29 16:48:41 +02:00
|
|
|
.endm
|
2010-07-07 22:09:41 +02:00
|
|
|
.text
|
2010-06-29 16:48:41 +02:00
|
|
|
.if \export
|
2009-10-02 10:42:00 +02:00
|
|
|
.global EXTERN_ASM\name
|
|
|
|
EXTERN_ASM\name:
|
2010-06-29 16:48:41 +02:00
|
|
|
.endif
|
2009-07-28 00:55:55 +02:00
|
|
|
ELF .type \name, %function
|
2008-10-27 01:25:06 +01:00
|
|
|
.func \name
|
|
|
|
\name:
|
2010-06-29 16:48:41 +02:00
|
|
|
.endm
|
2008-12-30 04:13:52 +01:00
|
|
|
|
2011-01-26 23:26:51 +01:00
|
|
|
.macro const name, align=2
|
|
|
|
.macro endconst
|
|
|
|
ELF .size \name, . - \name
|
|
|
|
.purgem endconst
|
|
|
|
.endm
|
|
|
|
.section .rodata
|
|
|
|
.align \align
|
|
|
|
\name:
|
|
|
|
.endm
|
|
|
|
|
2010-06-29 16:48:45 +02:00
|
|
|
.macro mov32 rd, val
|
|
|
|
#if HAVE_ARMV6T2
|
|
|
|
movw \rd, #(\val) & 0xffff
|
|
|
|
.if (\val) >> 16
|
|
|
|
movt \rd, #(\val) >> 16
|
|
|
|
.endif
|
|
|
|
#else
|
|
|
|
ldr \rd, =\val
|
|
|
|
#endif
|
|
|
|
.endm
|
|
|
|
|
2010-06-29 16:48:41 +02:00
|
|
|
.macro movrel rd, val
|
2010-09-20 23:50:46 +02:00
|
|
|
#if HAVE_ARMV6T2 && !CONFIG_PIC && !defined(__APPLE__)
|
2008-12-30 04:13:52 +01:00
|
|
|
movw \rd, #:lower16:\val
|
|
|
|
movt \rd, #:upper16:\val
|
|
|
|
#else
|
|
|
|
ldr \rd, =\val
|
|
|
|
#endif
|
2010-06-29 16:48:41 +02:00
|
|
|
.endm
|
2009-07-21 00:30:24 +02:00
|
|
|
|
2011-06-14 12:29:48 +02:00
|
|
|
.macro ldr_pre rt, rn, rm:vararg
|
|
|
|
A ldr \rt, [\rn, \rm]!
|
|
|
|
T add \rn, \rn, \rm
|
|
|
|
T ldr \rt, [\rn]
|
|
|
|
.endm
|
|
|
|
|
2011-12-08 05:26:12 +01:00
|
|
|
.macro ldr_dpre rt, rn, rm:vararg
|
|
|
|
A ldr \rt, [\rn, -\rm]!
|
|
|
|
T sub \rn, \rn, \rm
|
|
|
|
T ldr \rt, [\rn]
|
2011-08-24 22:58:37 +02:00
|
|
|
.endm
|
|
|
|
|
2011-12-15 17:24:43 +01:00
|
|
|
.macro ldr_dpren rt, rn, rm:vararg
|
|
|
|
A ldr \rt, [\rn, -\rm]
|
|
|
|
T sub \rt, \rn, \rm
|
|
|
|
T ldr \rt, [\rt]
|
|
|
|
.endm
|
|
|
|
|
2011-06-14 12:29:48 +02:00
|
|
|
.macro ldr_post rt, rn, rm:vararg
|
|
|
|
A ldr \rt, [\rn], \rm
|
|
|
|
T ldr \rt, [\rn]
|
|
|
|
T add \rn, \rn, \rm
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro ldrd_reg rt, rt2, rn, rm
|
|
|
|
A ldrd \rt, \rt2, [\rn, \rm]
|
|
|
|
T add \rt, \rn, \rm
|
|
|
|
T ldrd \rt, \rt2, [\rt]
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro ldrd_post rt, rt2, rn, rm
|
|
|
|
A ldrd \rt, \rt2, [\rn], \rm
|
|
|
|
T ldrd \rt, \rt2, [\rn]
|
|
|
|
T add \rn, \rn, \rm
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro ldrh_pre rt, rn, rm
|
|
|
|
A ldrh \rt, [\rn, \rm]!
|
|
|
|
T add \rn, \rn, \rm
|
|
|
|
T ldrh \rt, [\rn]
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro ldrh_dpre rt, rn, rm
|
|
|
|
A ldrh \rt, [\rn, -\rm]!
|
|
|
|
T sub \rn, \rn, \rm
|
|
|
|
T ldrh \rt, [\rn]
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro ldrh_post rt, rn, rm
|
|
|
|
A ldrh \rt, [\rn], \rm
|
|
|
|
T ldrh \rt, [\rn]
|
|
|
|
T add \rn, \rn, \rm
|
|
|
|
.endm
|
|
|
|
|
2011-08-24 22:58:37 +02:00
|
|
|
.macro ldrb_post rt, rn, rm
|
|
|
|
A ldrb \rt, [\rn], \rm
|
|
|
|
T ldrb \rt, [\rn]
|
|
|
|
T add \rn, \rn, \rm
|
|
|
|
.endm
|
|
|
|
|
2011-06-14 12:29:48 +02:00
|
|
|
.macro str_post rt, rn, rm:vararg
|
|
|
|
A str \rt, [\rn], \rm
|
|
|
|
T str \rt, [\rn]
|
|
|
|
T add \rn, \rn, \rm
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro strb_post rt, rn, rm:vararg
|
|
|
|
A strb \rt, [\rn], \rm
|
|
|
|
T strb \rt, [\rn]
|
|
|
|
T add \rn, \rn, \rm
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro strd_post rt, rt2, rn, rm
|
|
|
|
A strd \rt, \rt2, [\rn], \rm
|
|
|
|
T strd \rt, \rt2, [\rn]
|
|
|
|
T add \rn, \rn, \rm
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro strh_pre rt, rn, rm
|
|
|
|
A strh \rt, [\rn, \rm]!
|
|
|
|
T add \rn, \rn, \rm
|
|
|
|
T strh \rt, [\rn]
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro strh_dpre rt, rn, rm
|
|
|
|
A strh \rt, [\rn, -\rm]!
|
|
|
|
T sub \rn, \rn, \rm
|
|
|
|
T strh \rt, [\rn]
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro strh_post rt, rn, rm
|
|
|
|
A strh \rt, [\rn], \rm
|
|
|
|
T strh \rt, [\rn]
|
|
|
|
T add \rn, \rn, \rm
|
|
|
|
.endm
|
|
|
|
|
|
|
|
.macro strh_dpost rt, rn, rm
|
|
|
|
A strh \rt, [\rn], -\rm
|
|
|
|
T strh \rt, [\rn]
|
|
|
|
T sub \rn, \rn, \rm
|
|
|
|
.endm
|
|
|
|
|
2009-07-21 00:30:24 +02:00
|
|
|
#if HAVE_VFP_ARGS
|
|
|
|
.eabi_attribute 28, 1
|
|
|
|
# define VFP
|
|
|
|
# define NOVFP @
|
|
|
|
#else
|
|
|
|
# define VFP @
|
|
|
|
# define NOVFP
|
|
|
|
#endif
|
2009-10-02 10:42:00 +02:00
|
|
|
|
|
|
|
#define GLUE(a, b) a ## b
|
|
|
|
#define JOIN(a, b) GLUE(a, b)
|
|
|
|
#define X(s) JOIN(EXTERN_ASM, s)
|