ARM: add mov32 macro
[libav.git] / libavcodec / arm / asm.S
CommitLineData
c72ab301
MR
1/*
2 * Copyright (c) 2008 Mans Rullgard <mans@mansr.com>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
172a39d1
MR
21#include "config.h"
22
e21a8921 23#ifdef __ELF__
341f394f
MR
24# define ELF
25#else
26# define ELF @
e21a8921 27#endif
341f394f 28
480cb7ed 29.macro require8 val=1
341f394f 30ELF .eabi_attribute 24, \val
480cb7ed 31.endm
c72ab301 32
480cb7ed 33.macro preserve8 val=1
341f394f 34ELF .eabi_attribute 25, \val
480cb7ed 35.endm
c72ab301 36
480cb7ed
MR
37.macro function name, export=0
38 .macro endfunc
18c31f6f 39ELF .size \name, . - \name
a7e7d40c
MR
40 .endfunc
41 .purgem endfunc
480cb7ed
MR
42 .endm
43 .if \export
e654b7c2
MR
44 .global EXTERN_ASM\name
45EXTERN_ASM\name:
480cb7ed 46 .endif
341f394f 47ELF .type \name, %function
c72ab301
MR
48 .func \name
49\name:
480cb7ed 50.endm
172a39d1 51
a4edc5a9
MR
52.macro mov32 rd, val
53#if HAVE_ARMV6T2
54 movw \rd, #(\val) & 0xffff
55 .if (\val) >> 16
56 movt \rd, #(\val) >> 16
57 .endif
58#else
59 ldr \rd, =\val
60#endif
61.endm
62
480cb7ed 63.macro movrel rd, val
3e6015cc 64#if HAVE_ARMV6T2 && !CONFIG_PIC
172a39d1
MR
65 movw \rd, #:lower16:\val
66 movt \rd, #:upper16:\val
67#else
68 ldr \rd, =\val
69#endif
480cb7ed 70.endm
ce742de2
MR
71
72#if HAVE_VFP_ARGS
73 .eabi_attribute 28, 1
74# define VFP
75# define NOVFP @
76#else
77# define VFP @
78# define NOVFP
79#endif
e654b7c2
MR
80
81#define GLUE(a, b) a ## b
82#define JOIN(a, b) GLUE(a, b)
83#define X(s) JOIN(EXTERN_ASM, s)