[FFmpeg-devel] [PATCH] bswap: add macros to byteswap constants
Michael Niedermayer
michaelni
Thu Apr 29 16:21:33 CEST 2010
On Thu, Apr 29, 2010 at 03:15:59PM +0100, M?ns Rullg?rd wrote:
> Michael Niedermayer <michaelni at gmx.at> writes:
>
> > On Thu, Apr 29, 2010 at 02:26:50PM +0100, Mans Rullgard wrote:
> >> The normal byteswap functions might use inline asm which is suboptimal
> >> with constants (and cannot be used in static initialisers), so special
> >> macros for constants only is needed.
> >>
> >> We should not rely on the gcc __builtin_constant_p() test since it is
> >> not always available.
> >
> > if its not available then this kind of optimization is not possible
>
> I intended these to be used where the value is a constant expression,
> e.g. bswap(0x1234). This would be useful for building constant tables
> that depend on the byte order.
>
> > adding even more complexity, ifdefery, and burden to support partial
> > optimizations in extreemly primitive compilers is imho not a good idea.
>
> Not all non-gcc compilers are extremely primitive. In fact, many of
> them are far superior.
they can optimize constant asm() away at compiletime ?
>
> > If one wants optimized
> > code a compiler with the (optimization relevant) feature set of gcc is
> > imho the minimum requirement.
> > thats besides that this patch is just a brick of a huge wall that would
>
> Look who's talking.
>
> > be needed for this hack, you would need to duplicate every use of le/be
> > code as well. The bitstream readers is just the next step, and then all
> > uses of the bitstream code would have to be reviewed if the values are
> > compiletime constant or not. Thats huge amounts of work for a primitive
> > compiler. id much rather completely drop support for such compilers
>
> You (deliberately?) misunderstood the purpose of this patch.
i didnt reject this patch, thats just a rejection of me maintaining
any hacks to support "constant" optimizations in compilers that dont
support an equivalent of __builtin_constant_p and neither can handle
const/pure attributes with asm
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100429/70b92ef2/attachment.pgp>
More information about the ffmpeg-devel
mailing list