[FFmpeg-devel] Inline ASM vs. Intrinsics

Zuxy Meng zuxy.meng
Fri May 11 04:09:22 CEST 2007


2007/5/9, Thorsten Jordan <tjordan at macrosystem.de>:
> Hello developers,
> i am wondering what do you think about the MMX/SSE intrinsics that can
> be used at least with gcc (and maybe also with intels compiler).
> My question is if they are not used because of performance or if they
> are a big NoNo because of some other reason.
> I know that by using inline asm one has most control over what is going
> on. However with intrinsics the code is sometimes shorter and easier to
> read, although recent compilers are rather good in code generation. The
> intrinsics have one big advantage: you can use the very same code f?r
> x86-32 and x86-64 and on the latter the 8 extra registers are used
> automatically.

I agree, and since gcc knows more about what intrinsics do than inline
assembly, gcc may optimize better with different march/mtune settings.

However, gcc's register allocation algorithm sometimes does stupid
things, spilling registers when unnecessary. So, even if you write
everything in intrinsics, you should use 'gcc -S'  to double check.

> So i am just curious what do you think, if you like, add some comments.
> Thanks!

Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6

More information about the ffmpeg-devel mailing list