When trying to overload operators for __m128 and __m128d types. For example,
the following code:


#include <xmmintrin.h>
#include <stddef.h>

inline __m128 operator + (const __m128 A, const __m128 B)
{
        return _mm_add_ps(A, B);
}

int main()
{
        float a[4];
        float b[4];

        for(size_t i = 0; i < 4; i++)
        {
                a[i] = 2 * i;
                b[i] = 2 * i;
        }
        __m128 sseA, sseB;
        sseA = _mm_loadu_ps(a);
        sseB = _mm_loadu_ps(b);
        __m128 sseSum = sseA + sseB;
        return 0;
}

Generates 
error: 'float __vector__ operator+(float __vector__, float __vector__)' must
have an argument of class or enumerated type

Compiler options: -O3 -msse

Both ICL (windows and Linux) and MSVC accept this code and compile it
correctly.


-- 
           Summary: g++ does not allow overloading operators for sse types
                    (__m128, __m128d)
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mr dot nuke dot me at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43122

Reply via email to