Imported Debian version 2.4.3~trusty1
[deb_ffmpeg.git] / ffmpeg / libavutil / aarch64 / asm.S
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
21 #include "config.h"
22
23 #ifdef __ELF__
24 # define ELF
25 #else
26 # define ELF #
27 #endif
28
29 #if HAVE_AS_FUNC
30 # define FUNC
31 #else
32 # define FUNC #
33 #endif
34
35 .macro function name, export=0, align=2
36 .macro endfunc
37 ELF .size \name, . - \name
38 FUNC .endfunc
39 .purgem endfunc
40 .endm
41 .text
42 .align \align
43 .if \export
44 .global EXTERN_ASM\name
45 ELF .type EXTERN_ASM\name, %function
46 FUNC .func EXTERN_ASM\name
47 EXTERN_ASM\name:
48 .else
49 ELF .type \name, %function
50 FUNC .func \name
51 \name:
52 .endif
53 .endm
54
55 .macro const name, align=2
56 .macro endconst
57 ELF .size \name, . - \name
58 .purgem endconst
59 .endm
60 #ifndef __MACH__
61 .section .rodata
62 #else
63 .const_data
64 #endif
65 .align \align
66 \name:
67 .endm
68
69 .macro movrel rd, val
70 #if CONFIG_PIC && defined(__APPLE__)
71 adrp \rd, \val@PAGE
72 add \rd, \rd, \val@PAGEOFF
73 #elif CONFIG_PIC
74 adrp \rd, \val
75 add \rd, \rd, :lo12:\val
76 #else
77 ldr \rd, =\val
78 #endif
79 .endm
80
81 #define GLUE(a, b) a ## b
82 #define JOIN(a, b) GLUE(a, b)
83 #define X(s) JOIN(EXTERN_ASM, s)