[FFmpeg-devel] [PATCH] arm: Skip certain inline assembly functions if built without optimizations
Martin Storsjö
martin at martin.st
Fri Aug 26 11:34:49 EEST 2022
These inline assembly functions rely on being inlined into the
caller, so that the parameter "int p" can be a known assembly time
constant, instead of a variable parameter.
__OPTIMIZE__ is a built-in define which is set by both GCC and Clang
(the two main compilers supporting our inline assembly) when
optimizations are enabled.
This fixes building for arm targets with optimizations disabled.
---
With older GCC versions, the inline assembly in libavcodec/arm/aac.h
also might need to be disabled, but it does build successfully
with optimizations disabled with modern LLVM and GCC, so not touching
it immediately as part of this patch.
---
libavutil/arm/intmath.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavutil/arm/intmath.h b/libavutil/arm/intmath.h
index 5311a7d52b..67a8e72dc0 100644
--- a/libavutil/arm/intmath.h
+++ b/libavutil/arm/intmath.h
@@ -62,6 +62,7 @@ static av_always_inline av_const int av_clip_int16_arm(int a)
return x;
}
+#ifdef __OPTIMIZE__
#define av_clip_intp2 av_clip_intp2_arm
static av_always_inline av_const int av_clip_intp2_arm(int a, int p)
{
@@ -77,6 +78,7 @@ static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p)
__asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p));
return x;
}
+#endif
#define av_sat_add32 av_sat_add32_arm
static av_always_inline int av_sat_add32_arm(int a, int b)
--
2.25.1
More information about the ffmpeg-devel
mailing list