[Bug c++/15208] New: Vector extensions don't work in C++ and cannot be implemented using operator overloading

ahu at ds9a dot nl gcc-bugzilla@gcc.gnu.org
Thu Apr 29 19:40:00 GMT 2004


Vector extensions which work great in C don't compile with g++:
typedef int v4sf __attribute__ ((mode(V4SF)));

int main()
{
  v4sf a, b;
  a=a+b;
  return 0;
}

This works in C, but gives the following in C++:
intrinsics.cc:7: error: invalid operands of types `vector float' and `vector 
   float' to binary `operator+'

Furthermore, v4sf operator+(const v4sf& a, const v4sf& b){} yields:
intrinsics.cc:9: error: `vector float operator+(vector float&, vector float&)' 
   must have an argument of class or enumerated type

Tricking the compiler by generating a class containing a v4sf yields inefficient
code, which defeats the cause for using SIMD.

The workaround is to use the SIMD built-ins directly.

-- 
           Summary: Vector extensions don't work in C++ and cannot be
                    implemented using operator overloading
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ahu at ds9a dot nl
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: irrelevant
  GCC host triplet: irrelevant
GCC target triplet: irrelevant


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



More information about the Gcc-bugs mailing list