Fixes assembling with binutil as >= 2.41
Unified · Split
| @@ -35,12 +35,20 @@ · 34 unmodified lines | ||
| 35 | 35 | static av_always_inline av_const int MULL(int a, int b, unsigned shift) |
| 36 | 36 | { |
| 37 | 37 | int rt, dummy; |
| 38 | + if (__builtin_constant_p(shift)) | |
| 38 | 39 | __asm__ ( |
| 39 | 40 | "imull %3 \n\t" |
| 40 | 41 | "shrdl %4, %%edx, %%eax \n\t" |
| 41 | 42 | :"=a"(rt), "=d"(dummy) |
| 42 | − :"a"(a), "rm"(b), "ci"((uint8_t)shift) | |
| 43 | + :"a"(a), "rm"(b), "i"(shift & 0x1F) | |
| 43 | 44 | ); |
| 45 | + else | |
| 46 | + __asm__ ( | |
| 47 | + "imull %3 \n\t" | |
| 48 | + "shrdl %4, %%edx, %%eax \n\t" | |
| 49 | + :"=a"(rt), "=d"(dummy) | |
| 50 | + :"a"(a), "rm"(b), "c"((uint8_t)shift) | |
| 51 | + ); | |
| 44 | 52 | return rt; |
| 45 | 53 | } |
| 46 | 54 | |
| @@ -113,19 +121,31 @@ __asm__ volatile(\ · 66 unmodified lines | ||
| 113 | 121 | // avoid +32 for shift optimization (gcc should do that ...) |
| 114 | 122 | #define NEG_SSR32 NEG_SSR32 |
| 115 | 123 | static inline int32_t NEG_SSR32( int32_t a, int8_t s){ |
| 124 | + if (__builtin_constant_p(s)) | |
| 116 | 125 | __asm__ ("sarl %1, %0\n\t" |
| 117 | 126 | : "+r" (a) |
| 118 | − : "ic" ((uint8_t)(-s)) | |
| 127 | + : "i" (-s & 0x1F) | |
| 119 | 128 | ); |
| 129 | + else | |
| 130 | + __asm__ ("sarl %1, %0\n\t" | |
| 131 | + : "+r" (a) | |
| 132 | + : "c" ((uint8_t)(-s)) | |
| 133 | + ); | |
| 120 | 134 | return a; |
| 121 | 135 | } |
| 122 | 136 | |
| 123 | 137 | #define NEG_USR32 NEG_USR32 |
| 124 | 138 | static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ |
| 139 | + if (__builtin_constant_p(s)) | |
| 125 | 140 | __asm__ ("shrl %1, %0\n\t" |
| 126 | 141 | : "+r" (a) |
| 127 | − : "ic" ((uint8_t)(-s)) | |
| 142 | + : "i" (-s & 0x1F) | |
| 128 | 143 | ); |
| 144 | + else | |
| 145 | + __asm__ ("shrl %1, %0\n\t" | |
| 146 | + : "+r" (a) | |
| 147 | + : "c" ((uint8_t)(-s)) | |
| 148 | + ); | |
| 129 | 149 | return a; |
| 130 | 150 | } |
| 131 | 151 | |