On 8/26/2022 5:34 AM, Martin Storsjö wrote:
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.

You could instead use av_builtin_constant_p() to check this at compile time. See how it's used for av_mod_uintp2_bmi2() in libavutil/x86/intmath.h

---
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)
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to