mathops: fix MULL() when the compiler does not inline the function.

Message ID 1300235983-25661-1-git-send-email-justin.ruggles@gmail.com
State Superseded
Headers show

Commit Message

Justin Ruggles March 16, 2011, 12:39 a.m.
If the function is not inlined, an immmediate cannot be used for the
shift parameter, so the %cl register must be used instead.

This fixes compilation for x86-32 using gcc with --disable-optimizations.
---
 libavcodec/x86/mathops.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Comments

Justin Ruggles March 16, 2011, 12:50 a.m. | #1
On 03/15/2011 08:39 PM, Justin Ruggles wrote:

> 
> If the function is not inlined, an immmediate cannot be used for the
> shift parameter, so the %cl register must be used instead.
> 
> This fixes compilation for x86-32 using gcc with --disable-optimizations.
> ---
>  libavcodec/x86/mathops.h |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)


I found a better way. new patch coming soon after testing it.

-Justin

Patch

diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
index b183027..f382dfe 100644
--- a/libavcodec/x86/mathops.h
+++ b/libavcodec/x86/mathops.h
@@ -32,10 +32,10 @@  static av_always_inline av_const int MULL(int a, int b, unsigned shift)
 {
     int rt, dummy;
     __asm__ (
-        "imull %3               \n\t"
-        "shrdl %4, %%edx, %%eax \n\t"
+        "imull %4               \n\t"
+        "shrdl %2, %%edx, %%eax \n\t"
         :"=a"(rt), "=d"(dummy)
-        :"a"(a), "rm"(b), "i"(shift)
+        :"%%ecx"((uint8_t)shift), "a"(a), "rm"(b)
     );
     return rt;
 }