From 9829a81bcd3e9ef26c4bbc2959bfb65159dbd314 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 2 Aug 2012 22:53:47 +0100 Subject: ARM: vp56: allow inline asm to build with clang The clang integrated assembler does not support pre-UAL syntax, while gcc requires pre-UAL syntax for ARM code. A patch[1] for clang to support the old syntax as well has been ignored since January. This patch chooses the syntax appropriate for each compiler, allowing both to build the code. Notably, this change allows building for iphone with the latest Apple Xcode update. [1] http://llvm.org/bugs/show_bug.cgi?id=11855 Signed-off-by: Mans Rullgard --- libavcodec/arm/vp56_arith.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'libavcodec/arm') diff --git a/libavcodec/arm/vp56_arith.h b/libavcodec/arm/vp56_arith.h index ef30ffe897..d1a8837000 100644 --- a/libavcodec/arm/vp56_arith.h +++ b/libavcodec/arm/vp56_arith.h @@ -29,6 +29,14 @@ # define T(x) #endif +#if CONFIG_THUMB || defined __clang__ +# define L(x) +# define U(x) x +#else +# define L(x) x +# define U(x) +#endif + #if HAVE_ARMV6 && HAVE_INLINE_ASM #define vp56_rac_get_prob vp56_rac_get_prob_armv6 @@ -42,8 +50,8 @@ static inline int vp56_rac_get_prob_armv6(VP56RangeCoder *c, int pr) __asm__ ("adds %3, %3, %0 \n" "itt cs \n" "cmpcs %7, %4 \n" - A("ldrcsh %2, [%4], #2 \n") - T("ldrhcs %2, [%4], #2 \n") + L("ldrcsh %2, [%4], #2 \n") + U("ldrhcs %2, [%4], #2 \n") "rsb %0, %6, #256 \n" "smlabb %0, %5, %6, %0 \n" T("itttt cs \n") @@ -80,8 +88,8 @@ static inline int vp56_rac_get_prob_branchy_armv6(VP56RangeCoder *c, int pr) __asm__ ("adds %3, %3, %0 \n" "itt cs \n" "cmpcs %7, %4 \n" - A("ldrcsh %2, [%4], #2 \n") - T("ldrhcs %2, [%4], #2 \n") + L("ldrcsh %2, [%4], #2 \n") + U("ldrhcs %2, [%4], #2 \n") "rsb %0, %6, #256 \n" "smlabb %0, %5, %6, %0 \n" T("itttt cs \n") -- cgit v1.2.3 From e6cd698955c87b78534a5a897d595d7315103689 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Thu, 2 Aug 2012 23:18:08 +0100 Subject: ARMv6: vp8: fix stack allocation with Apple's assembler In the GNU assembler, a relational expression, bizarrely, has the value -1 if true, whereas in Apple's it is +1. This patch makes sure the correct expression is used in both cases. Signed-off-by: Mans Rullgard --- libavcodec/arm/vp8dsp_armv6.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libavcodec/arm') diff --git a/libavcodec/arm/vp8dsp_armv6.S b/libavcodec/arm/vp8dsp_armv6.S index a26a2a9813..40be926f9f 100644 --- a/libavcodec/arm/vp8dsp_armv6.S +++ b/libavcodec/arm/vp8dsp_armv6.S @@ -1226,7 +1226,13 @@ vp8_mc_1 bilin, 8, v vp8_mc_1 bilin, 4, h vp8_mc_1 bilin, 4, v -#define TMPSIZE \size * (8 - 8*(\size > 4) + \ytaps - 1) +/* True relational expressions have the value -1 in the GNU assembler, + +1 in Apple's. */ +#ifdef __APPLE__ +# define TMPSIZE \size * (8 + 8*(\size > 4) + \ytaps - 1) +#else +# define TMPSIZE \size * (8 - 8*(\size > 4) + \ytaps - 1) +#endif .macro vp8_mc_hv name, size, h, v, ytaps function ff_put_vp8_\name\size\()_\h\v\()_armv6, export=1 -- cgit v1.2.3