[Webkit-unassigned] [Bug 73182] Need SSE optimization for functions vfmul and vadd

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 29 22:43:20 PST 2011


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





--- Comment #15 from xingnan.wang at intel.com  2011-11-29 22:43:20 PST ---
BTW, I use reinterpret_cast and const_cast not static_cast to instead the C-style cast because the static_cast is not suitable and causes invalid errors.

third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp: In function ‘void WebCore::VectorMath::vsmul(const float*, int, const float*, float*, int, size_t)’:
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:77:36: error: expected ‘(’ before ‘sourceP’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:77:46: error: invalid operands of types ‘const float*’ and ‘int’ to binary ‘operator&’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:77:58: error: expected ‘)’ before ‘{’ token
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:92:68: error: expected ‘(’ before ‘sourceP’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:92:75: error: invalid static_cast from type ‘const float*’ to type ‘float*’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:92:76: error: expected ‘)’ before ‘;’ token
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:95:36: error: expected ‘(’ before ‘destP’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:95:44: error: invalid operands of types ‘float*’ and ‘int’ to binary ‘operator&’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:95:50: error: expected ‘)’ before ‘{’ token
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:86:16: error: unused variable ‘pScale’ [-Werror=unused-variable]
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:88:18: error: unused variable ‘pDest’ [-Werror=unused-variable]
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:89:16: error: unused variable ‘dest’ [-Werror=unused-variable]
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp: In function ‘void WebCore::VectorMath::vadd(const float*, int, const float*, int, float*, int, size_t)’:
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:137:36: error: expected ‘(’ before ‘source1P’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:137:47: error: invalid operands of types ‘const float*’ and ‘int’ to binary ‘operator&’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:137:59: error: expected ‘)’ before ‘{’ token
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:150:52: error: expected ‘(’ before ‘source2P’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:150:63: error: invalid operands of types ‘const float*’ and ‘int’ to binary ‘operator&’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:150:68: error: expected ‘)’ before ‘;’ token
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:151:49: error: expected ‘(’ before ‘destP’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:151:57: error: invalid operands of types ‘float*’ and ‘int’ to binary ‘operator&’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:151:62: error: expected ‘)’ before ‘;’ token
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:155:73: error: expected ‘(’ before ‘source1P’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:155:81: error: invalid static_cast from type ‘const float*’ to type ‘float*’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:155:82: error: expected ‘)’ before ‘;’ token
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:156:73: error: expected ‘(’ before ‘source2P’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:156:81: error: invalid static_cast from type ‘const float*’ to type ‘float*’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:156:82: error: expected ‘)’ before ‘;’ token
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:167:73: error: expected ‘(’ before ‘source1P’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:167:81: error: invalid static_cast from type ‘const float*’ to type ‘float*’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:167:82: error: expected ‘)’ before ‘;’ token
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:168:73: error: expected ‘(’ before ‘source2P’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:168:81: error: invalid static_cast from type ‘const float*’ to type ‘float*’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:168:82: error: expected ‘)’ before ‘;’ token
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:179:73: error: expected ‘(’ before ‘source1P’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:179:81: error: invalid static_cast from type ‘const float*’ to type ‘float*’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:179:82: error: expected ‘)’ before ‘;’ token
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:190:73: error: expected ‘(’ before ‘source1P’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:190:81: error: invalid static_cast from type ‘const float*’ to type ‘float*’
third_party/WebKit/Source/WebCore/platform/audio/VectorMath.cpp:190:82: error: expected ‘)’ before ‘;’ token


(In reply to comment #14)
> (In reply to comment #10)
> > (From update of attachment 116909 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=116909&action=review
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:76
> > > +        // If the sourceP address does not 16-byte align, the first several frames(at most three) should be processed seperately.
> > 
> > Missing space before (.
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:77
> > > +        while ((((size_t)sourceP & 0x0F) != 0) && n) {
> > 
> > Please use static_cast instead of C-style cast.
(size_t)sourceP --> reinterpret_cast<size_t>(sourceP)
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:87
> > > +        __m128 *pSource, *pDest;
> > 
> > We prefer one declaration per line and the * goes next to the type.
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:91
> > > +            pSource = reinterpret_cast<__m128*>((float*)sourceP);
> > 
> > Please use static_cast instead of C-style cast.
(float*)sourceP --> const_cast<float*>sourceP
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:93
> > > +            // There is less than 1% performance enhancement when pulling the if statement out of the loop, so leave it here.
> > 
> > It is not clear why you wouldn't want the 1% performance gain here.
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:94
> > > +            if (((size_t)destP & 0x0F) != 0) {
> > 
> > Please use static_cast instead of C-style cast.
(size_t)destP --> reinterpret_cast<size_t>(destP)
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:136
> > > +        while ((((size_t)source1P & 0x0F) != 0) && n) {
> > 
> > Please use static_cast instead of C-style cast.
(size_t)source1P --> reinterpret_cast<size_t>(source1P)
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:147
> > > +        __m128 * pSource1, *pSource2, *pDest;
> > > +        __m128 source2, dest;
> > 
> > We prefer one declaration per line and the * goes next to the type.
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:150
> > > +        bool source2Aligned = !((size_t)source2P & 0x0F);
> > > +        bool destAligned = !((size_t)destP & 0x0F);
> > 
> > Please use static_cast instead of C-style cast.
(size_t)source2P --> reinterpret_cast<size_t>(source2P)
(size_t)destP --> reinterpret_cast<size_t>(destP)
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:155
> > > +                pSource1 = reinterpret_cast<__m128*>((float*)source1P);
> > > +                pSource2 = reinterpret_cast<__m128*>((float*)source2P);
> > 
> > Please use static_cast instead of C-style cast.
(float*)source1P --> const_cast<float*>source1P
(float*)source2P --> const_cast<float*>source2P
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:167
> > > +                pSource1 = reinterpret_cast<__m128*>((float*)source1P);
> > > +                pSource2 = reinterpret_cast<__m128*>((float*)source2P);
> > 
> > Please use static_cast instead of C-style cast.
(float*)source1P --> const_cast<float*>source1P
(float*)source2P --> const_cast<float*>source2P
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:178
> > > +                pSource1 = reinterpret_cast<__m128*>((float*)source1P);
> > 
> > Please use static_cast instead of C-style cast.
(float*)source1P --> const_cast<float*>source1P
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:188
> > > +        } else if (!source2Aligned && !destAligned) // both source2 and dest not aligned 
> > > +        {
> > 
> > { should go on the previous line.
> > 
> > > Source/WebCore/platform/audio/VectorMath.cpp:191
> > > +                source2 = _mm_loadu_ps(source2P);
> > 
> > Please use static_cast instead of C-style cast.
> 
> Hi Sam, 
>     Thanks to your review and we update the patch by your comments.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list