]> git.sesse.net Git - ffmpeg/blob - libavutil/aarch64/asm.S
Merge commit 'f9157463dbcd2db8fe9504197c0c04d0d7d04f31'
[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 .macro  function name, export=0, align=2
30     .macro endfunc
31 ELF     .size   \name, . - \name
32         .endfunc
33         .purgem endfunc
34     .endm
35         .text
36         .align          \align
37     .if \export
38         .global EXTERN_ASM\name
39 ELF     .type   EXTERN_ASM\name, %function
40         .func   EXTERN_ASM\name
41 EXTERN_ASM\name:
42     .else
43 ELF     .type   \name, %function
44         .func   \name
45 \name:
46     .endif
47 .endm
48
49 .macro  const   name, align=2
50     .macro endconst
51 ELF     .size   \name, . - \name
52         .purgem endconst
53     .endm
54         .section        .rodata
55         .align          \align
56 \name:
57 .endm
58
59 .macro  movrel rd, val
60 #if CONFIG_PIC
61         adrp            \rd, #:pg_hi21:\val
62         add             \rd, \rd, #:lo12:\val
63 #else
64         ldr             \rd, =\val
65 #endif
66 .endm
67
68 #define GLUE(a, b) a ## b
69 #define JOIN(a, b) GLUE(a, b)
70 #define X(s) JOIN(EXTERN_ASM, s)