[FFmpeg-devel] [PATCH] h264: assembly version of get_cabac for x86_64 with PIC
Michael Niedermayer
michaelni at gmx.at
Tue Apr 17 11:35:38 CEST 2012
On Mon, Apr 16, 2012 at 03:50:09PM +0200, Roland Scheidegger wrote:
> Am 16.04.2012 14:06, schrieb Michael Niedermayer:
> > On Mon, Apr 16, 2012 at 12:55:20PM +0200, Roland Scheidegger wrote:
> >> Am 15.04.2012 10:19, schrieb Michael Niedermayer:
> >>> On Sat, Apr 14, 2012 at 01:50:21AM +0200, Roland Scheidegger wrote:
> >>> [...]
> >>>
> >>>> +#ifdef BROKEN_RELOCATIONS
> >>>> + BRANCHLESS_GET_CABAC("%4", "%q4", "(%1)", "%3", "%w3",
> >>>> + "%5", "%q5", "%k0", "%b0",
> >>>> + "%a11(%6)", "%a12(%6)", "%13")
> >>>> +#else
> >>>> BRANCHLESS_GET_CABAC("%4", "(%1)", "%3", "%w3",
> >>>> "%5", "%k0", "%b0",
> >>>> "%a11(%6)", "%a12(%6)")
> >>>> +#endif
> >>>>
> >>>> "test $1, %4 \n\t"
> >>>> " jz 4f \n\t"
> >>>> "add %10, %1 \n\t"
> >>>>
> >>>> +#ifdef BROKEN_RELOCATIONS
> >>>> + BRANCHLESS_GET_CABAC("%4", "%q4", "(%1)", "%3", "%w3",
> >>>> + "%5", "%q5", "%k0", "%b0",
> >>>> + "%a11(%6)", "%a12(%6)", "%13")
> >>>> +#else
> >>>> BRANCHLESS_GET_CABAC("%4", "(%1)", "%3", "%w3",
> >>>> "%5", "%k0", "%b0",
> >>>> "%a11(%6)", "%a12(%6)")
> >>>> +#endif
> >>>>
> >>>> "sub %10, %1 \n\t"
> >>>> "mov %2, %0 \n\t"
> >>>
> >>> these 2 ifdefs can be avoided by making the macro arguments between
> >>> the 2 variants match
> >>
> >> Of course but then you have unnecessary arguments for the non-pic case.
> >> In particular also one reg more. I don't think that's a good idea -
> >> didn't test if it even compiles on x86 due to register pressure.
> >
> > iam talking about the macro arguments, not the asm arguments.
> > The code would be identical after the C preprocessor so no way there
> > could be any issue with anything, you have same C source to the
> > C compiler and same asm to the assembler and binary identical object
> > files except line numbers / debug symbols
> >
> Maybe I'm missing some macro-foo (which I'm bad at) but I still don't
> see how that should look like, since the macro arguments directly come
> from the operand specification of the inline assembly. Or do you suggest
> passing in some fake immediate (which will be unused) there or something
> similar instead of a reg if we don't need the pic version?
not sure if fake immediate is matching what i meant, but let me provide
an example, i should have done that previously already
instead of
#if this
#define THAT(a,b,c,d)
...
#else
#define THAT(a,c)
...
#endif
asm(
...
#if this
THAT(a,b,c,d)
#else
THAT(a,c)
#endif
...
)
one can do:
#if this
#define THAT(a,b,c,d)
...
#else
#define THAT(a,b,c,d)
... //no code here uses b or d
#endif
asm(
...
THAT(a,b,c,d)
...
) // the b and d arguments dont exist in the second case
also keep in mind that code like this:
#define this(a,b,c,d) return a
main(){
this(0, not exist, "realy not", [{;:/ haha);
}
is perfectly valid, no need for the arguments here to exist of make
any sense as long as they arent used
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120417/5f0f25dc/attachment.asc>
More information about the ffmpeg-devel
mailing list