[FFmpeg-devel] Intrinsics (and NEON in particular)

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Sep 3 20:23:36 CEST 2014

On Wed, Sep 03, 2014 at 02:06:39PM +0200, Pascal Massimino wrote:
> On Wed, Sep 3, 2014 at 9:16 AM, Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> wrote:
> > > strange. I exclusively used intrinsics for libwebp (x86, but also
> > > neon/aarch64) and was pretty
> > > pleased with the result (say <2% perf loss, but 10x easier maintenance
> > and
> > > friendliness to non-guru contributors).
> >
> > I guess you never used uint16x8x2 and similar types then, because almost
> > any access to them seems to go via the stack.
> > See the last file of
> > http://lists-archives.com/mplayer-dev-eng/38036-add-neon-optimizations-to-some-critical-audio-functions.html
> > , it spilled the data to stack twice per loop iteration.
> >
> indeed, i just tried to compile the patch (gcc 4.8.3) and the output is
> rather bad.
> It's likely related to the poor support of post-incremented instructions.
> I've noticed
> that in several occasions.
> But on the bright side, things seems to be moving in the right direction,

I'd sure hope that. But for me, if I can't rely on intrinsics working
(and considering such a trivial example I find it hard to argue you
can), I'd say you have to learn the raw asm anyway.
So why should I learn intrinsics on top of that, and then
risk having to rewrite it if the compiler doesn't get it?
Even worse if you're all done an it works fine to you but then
e.g. a compiler in use by someone/something important doesn't
get it.
Now considering it works for you I might have a bit of
a one-sided experience, but if a technology manages to
consistently disappoint for about a decade (?) "moving in
the right direction" kind of doesn't cut it anymore for me,
I'll rather go with "I'll adopt it after everyone else".
Btw. Turbo Pascal managed to do assembler integrated in source
code in a usable, convenient way without any such issues
around 1994 I believe. Though admittedly it sure didn't manage
a lot of other things today's compilers do.

More information about the ffmpeg-devel mailing list