Loren Merritt <[email protected]> writes: > On Mon, 20 Jun 2011, Måns Rullgård wrote: >> "Ronald S. Bultje" <[email protected]> writes: >>> On Mon, Jun 20, 2011 at 5:55 AM, Mans Rullgard <[email protected]> wrote: >>> >>>> Signed-off-by: Mans Rullgard <[email protected]> >>>> --- >>>> libavcodec/x86/h264_i386.h | 65 >>>> +++++++++++++++++++++++--------------------- >>>> 1 files changed, 34 insertions(+), 31 deletions(-) >>>> >>>> diff --git a/libavcodec/x86/h264_i386.h b/libavcodec/x86/h264_i386.h >>>> index b303347..d38b18e 100644 >>>> --- a/libavcodec/x86/h264_i386.h >>>> +++ b/libavcodec/x86/h264_i386.h >>>> @@ -45,25 +45,26 @@ static int decode_significance_x86(CABACContext *c, >>>> int max_coeff, >>>> int bit; >>>> x86_reg coeff_count; >>>> int low; >>>> + int range; >>>> __asm__ volatile( >>>> - "movl %a10(%5), %%esi \n\t" >>>> - "movl %a11(%5), %3 \n\t" >>>> + "movl %a11(%6), %5 \n\t" >>>> + "movl %a12(%6), %3 \n\t" >>> [..] >>>> + "movl %5, %a11(%6) \n\t" >>>> + "movl %3, %a12(%6) \n\t" >>>> + :"=&r"(coeff_count),"+m"(last), "+m"(index), "=&r"(low), >>>> "=&r"(bit), >>>> + "=&r"(range) >>> >>> Patch OK. >>> >>> Having said that, the above code very much smells like stuff that gcc >>> might just get right, so why not change it to a r/w register instead >>> of w-only, and do the assignments outside the inline assembly? The >>> code may actually become readable then. >> >> It's worth a try. > > gcc 4.3 through 4.5 get it... almost right. No extra instructions, but > they do use larger than necessary opcodes. > > before: > lea rbp, [rbx+0x3cbc0] > ... > mov edx, [rbp+0x4] > mov eax, [rbp] > > after: > lea rbp, [rbx+0x3cbc0] > ... > mov edx, [rbp+0x4] > mov eax, [rbx+0x3cbc0]
Does this have any measurable effect on performance? > > From 66caceca6ac2ada82c91bb0e796e557fdc06f1b0 Mon Sep 17 00:00:00 2001 > From: Loren Merritt <[email protected]> > Date: Sat, 25 Jun 2011 11:49:44 +0000 > Subject: [PATCH] x86: h264: remove hardcoded load/stores in > decode_significance[_8x8]_x86 > > --- > libavcodec/x86/h264_i386.h | 32 +++++++------------------------- > 1 files changed, 7 insertions(+), 25 deletions(-) Patch looks OK, so push if you think it's safe. -- Måns Rullgård [email protected] _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
