[x264-devel] gcc stack alignment
Jason Garrett-Glaser
darkshikari at gmail.com
Fri Dec 19 14:48:08 CET 2008
On Fri, Dec 19, 2008 at 12:03 AM, aaron <aaron_ppus at fmad.co.jp> wrote:
> Hi,
>
> Found a kind of interesting but wrt to stack aligned variables. so in
>
> encoder/slicetype.c : x264_slicetype_mb_cost() line 194
> (x264-snapshot-20081207-2245)
>
> it declares
>
> DECLARE_ALLIGNED_16( uint8_t edge[33]);
>
> with gcc 4.3.1 edge ends up being on an 8B boundary, and thus the SSE2 asm
>
> predict_8x8_ddl_sse2:
> movdqa xmm3, [r1+16]
>
> will fault, non 128b aligned address.
>
> My understanding was gcc could not gaurentee the alignment of variables
> on the stack? it would only gaurentee the alignment of static/globals
> variables?
>
> Quick fix is either
>
> 1) move edge[] to be a static var
>
> 2) use movdqu & take the perf hit.
or use x264_stack_align like one is supposed to and suffer no penalty at all.
Dark Shikari
More information about the x264-devel
mailing list