]> git.sesse.net Git - ffmpeg/blob - libavcodec/ppc/asm.S
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / ppc / asm.S
1 /*
2  * Copyright (c) 2009 Loren Merritt
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 #define GLUE(a, b) a ## b
24 #define JOIN(a, b) GLUE(a, b)
25 #define X(s) JOIN(EXTERN_ASM, s)
26
27 #if ARCH_PPC64
28
29 #define PTR  .quad
30 #define lp   ld
31 #define lpx  ldx
32 #define stp  std
33 #define stpu stdu
34 #define PS   8
35 #define L(s) JOIN(., s)
36
37 .macro extfunc name
38     .global X(\name)
39     .section .opd, "aw"
40 X(\name):
41     .quad L(\name), .TOC.@tocbase, 0
42     .previous
43     .type X(\name), STT_FUNC
44 L(\name):
45 .endm
46
47 .macro movrel rd, sym
48     ld      \rd, \sym@got(r2)
49 .endm
50
51 #else /* ARCH_PPC64 */
52
53 #define PTR  .int
54 #define lp   lwz
55 #define lpx  lwzx
56 #define stp  stw
57 #define stpu stwu
58 #define PS   4
59 #define L(s) s
60
61 .macro extfunc name
62     .global X(\name)
63     .type   X(\name), STT_FUNC
64 X(\name):
65 \name:
66 .endm
67
68 .macro movrel rd, sym
69 #if CONFIG_PIC
70     bcl             20, 31, lab_pic_\@
71 lab_pic_\@:
72     mflr    \rd
73     addis   \rd, \rd, (\sym - lab_pic_\@)@ha
74     addi    \rd, \rd, (\sym - lab_pic_\@)@l
75 #else
76     lis     \rd, \sym@ha
77     la      \rd, \sym@l(\rd)
78 #endif
79 .endm
80
81 #endif /* ARCH_PPC64 */
82
83 #if HAVE_IBM_ASM
84
85 .macro DEFINE_REG n
86     .equiv r\n, \n
87     .equiv f\n, \n
88     .equiv v\n, \n
89 .endm
90
91 DEFINE_REG 0
92 DEFINE_REG 1
93 DEFINE_REG 2
94 DEFINE_REG 3
95 DEFINE_REG 4
96 DEFINE_REG 5
97 DEFINE_REG 6
98 DEFINE_REG 7
99 DEFINE_REG 8
100 DEFINE_REG 9
101 DEFINE_REG 10
102 DEFINE_REG 11
103 DEFINE_REG 12
104 DEFINE_REG 13
105 DEFINE_REG 14
106 DEFINE_REG 15
107 DEFINE_REG 16
108 DEFINE_REG 17
109 DEFINE_REG 18
110 DEFINE_REG 19
111 DEFINE_REG 20
112 DEFINE_REG 21
113 DEFINE_REG 22
114 DEFINE_REG 23
115 DEFINE_REG 24
116 DEFINE_REG 25
117 DEFINE_REG 26
118 DEFINE_REG 27
119 DEFINE_REG 28
120 DEFINE_REG 29
121 DEFINE_REG 30
122 DEFINE_REG 31
123
124 #endif /* HAVE_IBM_ASM */