File avidemux3.patch of Package avidemux3 (Revision 76193af429bb3696c6f43275c49be8f3)
Currently displaying revision 76193af429bb3696c6f43275c49be8f3 , Show latest
77
1
--- /dev/null
2
+++ b/avidemux_core/ffmpeg_package/patches/upstream/avcodec-x86-mathops-clip-constants-used-with-shift-i.patch
3
4
+From effadce6c756247ea8bae32dc13bb3e6f464f0eb Mon Sep 17 00:00:00 2001
5
+From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
6
+Date: Sun, 16 Jul 2023 18:18:02 +0300
7
+Subject: avcodec/x86/mathops: clip constants used with shift instructions
8
+ within inline assembly
9
+
10
+Fixes assembling with binutil as >= 2.41
11
+
12
+Signed-off-by: James Almer <jamrial@gmail.com>
13
+---
14
+ libavcodec/x86/mathops.h | 26 +++++++++++++++++++++++---
15
+ 1 file changed, 23 insertions(+), 3 deletions(-)
16
+
17
+diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
18
+index 6298f5ed19..ca7e2dffc1 100644
19
+--- a/libavcodec/x86/mathops.h
20
++++ b/libavcodec/x86/mathops.h
21
+@@ -35,12 +35,20 @@
22
+ static av_always_inline av_const int MULL(int a, int b, unsigned shift)
23
+ {
24
+ int rt, dummy;
25
++ if (__builtin_constant_p(shift))
26
+ __asm__ (
27
+ "imull %3 \n\t"
28
+ "shrdl %4, %%edx, %%eax \n\t"
29
+ :"=a"(rt), "=d"(dummy)
30
+- :"a"(a), "rm"(b), "ci"((uint8_t)shift)
31
++ :"a"(a), "rm"(b), "i"(shift & 0x1F)
32
+ );
33
++ else
34
++ __asm__ (
35
++ "imull %3 \n\t"
36
++ "shrdl %4, %%edx, %%eax \n\t"
37
++ :"=a"(rt), "=d"(dummy)
38
++ :"a"(a), "rm"(b), "c"((uint8_t)shift)
39
++ );
40
+ return rt;
41
+ }
42
+
43
+@@ -113,19 +121,31 @@ __asm__ volatile(\
44
+ // avoid +32 for shift optimization (gcc should do that ...)
45
+ #define NEG_SSR32 NEG_SSR32
46
+ static inline int32_t NEG_SSR32( int32_t a, int8_t s){
47
++ if (__builtin_constant_p(s))
48
+ __asm__ ("sarl %1, %0\n\t"
49
+ : "+r" (a)
50
+- : "ic" ((uint8_t)(-s))
51
++ : "i" (-s & 0x1F)
52
+ );
53
++ else
54
++ __asm__ ("sarl %1, %0\n\t"
55
++ : "+r" (a)
56
++ : "c" ((uint8_t)(-s))
57
++ );
58
+ return a;
59
+ }
60
+
61
+ #define NEG_USR32 NEG_USR32
62
+ static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
63
++ if (__builtin_constant_p(s))
64
+ __asm__ ("shrl %1, %0\n\t"
65
+ : "+r" (a)
66
+- : "ic" ((uint8_t)(-s))
67
++ : "i" (-s & 0x1F)
68
+ );
69
++ else
70
++ __asm__ ("shrl %1, %0\n\t"
71
++ : "+r" (a)
72
++ : "c" ((uint8_t)(-s))
73
++ );
74
+ return a;
75
+ }
76
+
77