[Ffmpeg-devel] Mac OS X Intel last part: balign directives

John Dalgliesh johnd
Sat Aug 12 02:59:14 CEST 2006


On Fri, 11 Aug 2006, Michael Niedermayer wrote:
>
> Hi
>
> On Fri, Aug 11, 2006 at 04:00:14PM +1000, John Dalgliesh wrote:
>> Determines whether .align's arg is power-of-two or not, then defines
>> ASMALIGN appropriately in config.h. Changes all .baligns to ASMALIGNs.
>>
>> Notes:
>> - doesn't bother with .balign or .p2align; may as well use the standard
>> .align directive (once we know what it does) if we're going to the trouble
>> of testing for stuff.
>> - ASMALIGN's arg is ZEROBITS, i.e. num of low bits in addr to make zero. I
>> wanted a general ASMALIGN macro, and 1<< is easier than log2/cntlzw/bsr.
>>
>> Tested on linux and OS X, no regressions broken, .o's are identical. On
>> linux despite indications I could see in gas source, .align is NPOT. On OS
>> X it is POT.
>>
>> Comments?
>
> iam ok with the patch

Excellent.

> but i have the feeling that the configure part will
> need amendment as old gas had the habit of assembling anything no matter
> if the instructions existed or not, so i wouldnt be surprised if some gas
> versions would accept .align 3 even though they arent using 3 as exponent

Possibly. The oldest (mainline) gas I can easily find is from 1996, and it 
does check that the arg is a power of two. I doubt we will find another 
little gem like Apple's that can 1) assemble code where alignment provides 
some benefit* (so uses ASMASLIGN) and 2) doesn't check arg is POT if 
provided as NPOT.

Nevertheless it'd be a good idea to wait a week or so before porting 
anything to MPlayer's configure or elsewhere.


{P^/

*: of course code alignment with cache slots and use of (newer) SIMD 
instructions are orthogonal optimisation techniques, but those caring 
about the former will likely already be using the latter. This is 
certainly the case in ffmpeg anyway.




More information about the ffmpeg-devel mailing list