Browse code

Check whether IBM or Apple PPC assembler syntax is used

This checks which assembler syntax is supported and defines macros
for register names accordingly.

Originally committed as revision 23952 to svn://svn.ffmpeg.org/ffmpeg/trunk

Måns Rullgård authored on 2010/07/02 08:21:27
Showing 3 changed files
... ...
@@ -989,6 +989,7 @@ HAVE_LIST="
989 989
     GetProcessTimes
990 990
     getrusage
991 991
     struct_rusage_ru_maxrss
992
+    ibm_asm
992 993
     inet_aton
993 994
     inline_asm
994 995
     isatty
... ...
@@ -2340,6 +2341,7 @@ elif enabled ppc; then
2340 2340
     enable local_aligned_8 local_aligned_16
2341 2341
 
2342 2342
     check_asm dcbzl     '"dcbzl 0, 1"'
2343
+    check_asm ibm_asm   '"add 0, 0, 0"'
2343 2344
     check_asm ppc4xx    '"maclhw r10, r11, r12"'
2344 2345
     check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
2345 2346
 
2346 2347
new file mode 100644
... ...
@@ -0,0 +1,64 @@
0
+/*
1
+ * Copyright (c) 2009 Loren Merritt
2
+ *
3
+ * This file is part of FFmpeg.
4
+ *
5
+ * FFmpeg is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * FFmpeg is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with FFmpeg; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+#include "config.h"
21
+
22
+#if HAVE_IBM_ASM
23
+
24
+.macro DEFINE_REG n
25
+    .equiv r\n, \n
26
+    .equiv f\n, \n
27
+    .equiv v\n, \n
28
+.endm
29
+
30
+DEFINE_REG 0
31
+DEFINE_REG 1
32
+DEFINE_REG 2
33
+DEFINE_REG 3
34
+DEFINE_REG 4
35
+DEFINE_REG 5
36
+DEFINE_REG 6
37
+DEFINE_REG 7
38
+DEFINE_REG 8
39
+DEFINE_REG 9
40
+DEFINE_REG 10
41
+DEFINE_REG 11
42
+DEFINE_REG 12
43
+DEFINE_REG 13
44
+DEFINE_REG 14
45
+DEFINE_REG 15
46
+DEFINE_REG 16
47
+DEFINE_REG 17
48
+DEFINE_REG 18
49
+DEFINE_REG 19
50
+DEFINE_REG 20
51
+DEFINE_REG 21
52
+DEFINE_REG 22
53
+DEFINE_REG 23
54
+DEFINE_REG 24
55
+DEFINE_REG 25
56
+DEFINE_REG 26
57
+DEFINE_REG 27
58
+DEFINE_REG 28
59
+DEFINE_REG 29
60
+DEFINE_REG 30
61
+DEFINE_REG 31
62
+
63
+#endif /* HAVE_IBM_ASM */
0 64
new file mode 100644
... ...
@@ -0,0 +1,37 @@
0
+/*
1
+ * Copyright (c) 2010 Mans Rullgard
2
+ *
3
+ * This file is part of FFmpeg.
4
+ *
5
+ * FFmpeg is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * FFmpeg is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with FFmpeg; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+#ifndef AVCODEC_PPC_REGS_H
21
+#define AVCODEC_PPC_REGS_H
22
+
23
+#include "libavutil/avutil.h"
24
+#include "config.h"
25
+
26
+#if HAVE_IBM_ASM
27
+#   define r(n) AV_TOSTRING(n)
28
+#   define f(n) AV_TOSTRING(n)
29
+#   define v(n) AV_TOSTRING(n)
30
+#else
31
+#   define r(n) AV_TOSTRING(r ## n)
32
+#   define f(n) AV_TOSTRING(f ## n)
33
+#   define v(n) AV_TOSTRING(v ## n)
34
+#endif
35
+
36
+#endif /* AVCODEC_PPC_REGS_H */