[FFmpeg-devel] [PATCH] Simplify some declarations of aligned arrays
Sun Aug 30 03:40:36 CEST 2009
On Sat, Aug 29, 2009 at 12:37:04AM +0100, M?ns Rullg?rd wrote:
> Michael Niedermayer <michaelni at gmx.at> writes:
> > On Fri, Aug 28, 2009 at 09:32:26AM +0100, Mans Rullgard wrote:
> >> If DECLARE_ALIGNED_16 works on uint64_t it will work smaller types too.
> > but if it doesnt work on either, uint64_t will possibly at least provide
> > 8 byte alignment
> Not necessarily. On many machines, 4-byte alignment is sufficient for
> > and has a 50% chance to provide 16bytes, this may have a performance
> > advantage but either way, i dont think this messy code has been
> > added without it being needed for some gcc version (just my
> > oppinion, i didnt investigat the history of this at all)
> All compilers I'm aware of support alignment of locals in one the
> following three ways:
> 1. You always get what you ask for. These are rare.
> 2. You get what you ask for up to the required stack alignment. This
> is 16 bytes on PPC-ELF, 8 bytes on ARM. GCC often maintains a 16-byte
> aligned stack even when not required by ABI, in which case local
> variables can be reliably aligned to 16 bytes.
> 3. No alignment specifiers whatsoever are supported.
> Arguments for cleaning this up as in my patch:
> - The mess helps only with compilers in the third category, and then
> only if we're lucky.
yes, also even if the code only achives 8 byte alignment, thats still
usefull, for example MMX code benefits speedwise from 8byte alignment
> - A lot of code elsewhere in FFmpeg does it the clean way, and that
> seems to cause no more problems.
> - I have unfinished patches to make aligned stack variables reliable
> with any compiler.
Once we have better code, iam of course in favor to drop this mess
IMHO we survived these few lines so long, it wont kill us if they
stay until there is a better replacement.
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
More information about the ffmpeg-devel