Lines 35-46
Link Here
|
35 |
static av_always_inline av_const int MULL(int a, int b, unsigned shift) |
35 |
static av_always_inline av_const int MULL(int a, int b, unsigned shift) |
36 |
{ |
36 |
{ |
37 |
int rt, dummy; |
37 |
int rt, dummy; |
|
|
38 |
if (__builtin_constant_p(shift)) |
38 |
__asm__ ( |
39 |
__asm__ ( |
39 |
"imull %3 \n\t" |
40 |
"imull %3 \n\t" |
40 |
"shrdl %4, %%edx, %%eax \n\t" |
41 |
"shrdl %4, %%edx, %%eax \n\t" |
41 |
:"=a"(rt), "=d"(dummy) |
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 |
return rt; |
52 |
return rt; |
45 |
} |
53 |
} |
46 |
|
54 |
|
Lines 113-131
__asm__ volatile(\
Link Here
|
113 |
// avoid +32 for shift optimization (gcc should do that ...) |
121 |
// avoid +32 for shift optimization (gcc should do that ...) |
114 |
#define NEG_SSR32 NEG_SSR32 |
122 |
#define NEG_SSR32 NEG_SSR32 |
115 |
static inline int32_t NEG_SSR32( int32_t a, int8_t s){ |
123 |
static inline int32_t NEG_SSR32( int32_t a, int8_t s){ |
|
|
124 |
if (__builtin_constant_p(s)) |
116 |
__asm__ ("sarl %1, %0\n\t" |
125 |
__asm__ ("sarl %1, %0\n\t" |
117 |
: "+r" (a) |
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 |
return a; |
134 |
return a; |
121 |
} |
135 |
} |
122 |
|
136 |
|
123 |
#define NEG_USR32 NEG_USR32 |
137 |
#define NEG_USR32 NEG_USR32 |
124 |
static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ |
138 |
static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ |
|
|
139 |
if (__builtin_constant_p(s)) |
125 |
__asm__ ("shrl %1, %0\n\t" |
140 |
__asm__ ("shrl %1, %0\n\t" |
126 |
: "+r" (a) |
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 |
return a; |
149 |
return a; |
130 |
} |
150 |
} |
131 |
|
151 |
|