aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2010-07-01 23:21:27 +0000
committerMåns Rullgård <mans@mansr.com>2010-07-01 23:21:27 +0000
commit2f0c136e1f584a0d6c7826376ce4809a39ec81c9 (patch)
tree97bb19d15dd88f05413b8f9be724c62ee9602ca7
parentea59f489b0c13df34b3b27063d539daa8655755e (diff)
downloadffmpeg-2f0c136e1f584a0d6c7826376ce4809a39ec81c9.tar.gz
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
-rwxr-xr-xconfigure2
-rw-r--r--libavcodec/ppc/asm.S64
-rw-r--r--libavcodec/ppc/regs.h37
3 files changed, 103 insertions, 0 deletions
diff --git a/configure b/configure
index 400d835c38..c9fb27886e 100755
--- a/configure
+++ b/configure
@@ -989,6 +989,7 @@ HAVE_LIST="
GetProcessTimes
getrusage
struct_rusage_ru_maxrss
+ ibm_asm
inet_aton
inline_asm
isatty
@@ -2340,6 +2341,7 @@ elif enabled ppc; then
enable local_aligned_8 local_aligned_16
check_asm dcbzl '"dcbzl 0, 1"'
+ check_asm ibm_asm '"add 0, 0, 0"'
check_asm ppc4xx '"maclhw r10, r11, r12"'
check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
diff --git a/libavcodec/ppc/asm.S b/libavcodec/ppc/asm.S
new file mode 100644
index 0000000000..abf63b1fd1
--- /dev/null
+++ b/libavcodec/ppc/asm.S
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2009 Loren Merritt
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+
+#if HAVE_IBM_ASM
+
+.macro DEFINE_REG n
+ .equiv r\n, \n
+ .equiv f\n, \n
+ .equiv v\n, \n
+.endm
+
+DEFINE_REG 0
+DEFINE_REG 1
+DEFINE_REG 2
+DEFINE_REG 3
+DEFINE_REG 4
+DEFINE_REG 5
+DEFINE_REG 6
+DEFINE_REG 7
+DEFINE_REG 8
+DEFINE_REG 9
+DEFINE_REG 10
+DEFINE_REG 11
+DEFINE_REG 12
+DEFINE_REG 13
+DEFINE_REG 14
+DEFINE_REG 15
+DEFINE_REG 16
+DEFINE_REG 17
+DEFINE_REG 18
+DEFINE_REG 19
+DEFINE_REG 20
+DEFINE_REG 21
+DEFINE_REG 22
+DEFINE_REG 23
+DEFINE_REG 24
+DEFINE_REG 25
+DEFINE_REG 26
+DEFINE_REG 27
+DEFINE_REG 28
+DEFINE_REG 29
+DEFINE_REG 30
+DEFINE_REG 31
+
+#endif /* HAVE_IBM_ASM */
diff --git a/libavcodec/ppc/regs.h b/libavcodec/ppc/regs.h
new file mode 100644
index 0000000000..63861f28fb
--- /dev/null
+++ b/libavcodec/ppc/regs.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010 Mans Rullgard
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_PPC_REGS_H
+#define AVCODEC_PPC_REGS_H
+
+#include "libavutil/avutil.h"
+#include "config.h"
+
+#if HAVE_IBM_ASM
+# define r(n) AV_TOSTRING(n)
+# define f(n) AV_TOSTRING(n)
+# define v(n) AV_TOSTRING(n)
+#else
+# define r(n) AV_TOSTRING(r ## n)
+# define f(n) AV_TOSTRING(f ## n)
+# define v(n) AV_TOSTRING(v ## n)
+#endif
+
+#endif /* AVCODEC_PPC_REGS_H */