[Webkit-unassigned] [Bug 74048] A function of vector multiply with SSE optimization is needed in VectorMath.cpp

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Dec 9 10:06:28 PST 2011

```https://bugs.webkit.org/show_bug.cgi?id=74048

--- Comment #2 from Raymond Toy <rtoy at chromium.org>  2011-12-09 10:06:28 PST ---
(From update of attachment 118323)
View in context: https://bugs.webkit.org/attachment.cgi?id=118323&action=review

Please include a Changelog entry too.

> Source/WebCore/platform/audio/VectorMath.cpp:231
>

Add comment saying vmmul performs an element-by-element multiply of two vectors, with user-specified strides for the sources and destination.

> Source/WebCore/platform/audio/VectorMath.cpp:232
> +void vmmul(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess)

Why is it named vmmul instead of vmul?  What does the extra m mean?

> Source/WebCore/platform/audio/VectorMath.cpp:237
> +        int n = framesToProcess;

Since this is common to both SSE and non-SSE, move it to the top?  Also, why do we need the extra variable n?  Can't we use framesToProcess?

> Source/WebCore/platform/audio/VectorMath.cpp:265
> +                destP += 4;

As mentioned in another patch, it might be useful to add a macro to encapsulate the very similar code here and the branches below.  Something like

dest = __mm_mul_ps(pSource1, pSource2); \
_mm_##dstore##_ps(destP, dest); \
source1P += 4; \
source2P += 4; \
destP += 4\

Then use it: