[Bug c++/43122] g++ does not allow overloading operators for sse types (__m128, __m128d)

2012-09-05 Thread nenakhov.sergey at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43122

SergeyN nenakhov.sergey at gmail dot com changed:

   What|Removed |Added

 CC||nenakhov.sergey at gmail
   ||dot com

--- Comment #6 from SergeyN nenakhov.sergey at gmail dot com 2012-09-05 
07:42:49 UTC ---
well, I get similiar error when I try to overload operators , =, ==, etc

error: ‘__m256d operator(__m256d, __m256d)’ must have an argument of class or
enumerated type.


[Bug c++/43122] g++ does not allow overloading operators for sse types (__m128, __m128d)

2012-09-05 Thread glisse at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43122

--- Comment #7 from Marc Glisse glisse at gcc dot gnu.org 2012-09-05 09:32:11 
UTC ---
http://gcc.gnu.org/ml/gcc-patches/2012-08/msg02098.html


[Bug c++/43122] g++ does not allow overloading operators for sse types (__m128, __m128d)

2012-09-05 Thread nenakhov.sergey at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43122

--- Comment #8 from SergeyN nenakhov.sergey at gmail dot com 2012-09-05 
09:42:58 UTC ---
(In reply to comment #7)
 http://gcc.gnu.org/ml/gcc-patches/2012-08/msg02098.html

That's nice, but I would really prefer to define my own comparison operator,
because the actual comparison instruction for __m256 and __m256d types has a
way to control handling of nans, which wouldn't be allowed by a built-in
comparison operator.


[Bug c++/43122] g++ does not allow overloading operators for sse types (__m128, __m128d)

2012-09-05 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43122

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #9 from Jakub Jelinek jakub at gcc dot gnu.org 2012-09-05 
12:13:55 UTC ---
Then put it into a class and add overloaded comparison operators for the
wrapper class.  That is the same thing as with float/double, you can't overload
float/double comparison operator either.


[Bug c++/43122] g++ does not allow overloading operators for sse types (__m128, __m128d)

2012-09-05 Thread nenakhov.sergey at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43122

--- Comment #10 from SergeyN nenakhov.sergey at gmail dot com 2012-09-05 
12:24:49 UTC ---
(In reply to comment #9)
 Then put it into a class and add overloaded comparison operators for the
 wrapper class.  That is the same thing as with float/double, you can't 
 overload
 float/double comparison operator either.


Well, I'll of course find a way to workaround this issue by either using a
class, or using a separate function like cmp_less or something like that. 
The point of this thread is that operator overloading for vector types doesn't
not work in gcc, and not how to work around that (which I'm sure people have no
problem doing given that the problem was reported 2 years ago).

Sergey.


[Bug c++/43122] g++ does not allow overloading operators for sse types (__m128, __m128d)

2010-02-19 Thread paolo dot carlini at oracle dot com


-- 

paolo dot carlini at oracle dot com changed:

   What|Removed |Added

   Severity|blocker |normal


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



[Bug c++/43122] g++ does not allow overloading operators for sse types (__m128, __m128d)

2010-02-19 Thread pinskia at gmail dot com


--- Comment #1 from pinskia at gmail dot com  2010-02-19 16:05 ---
Subject: Re:   New: g++ does not allow overloading operators for sse types
(__m128, __m128d)

Well there is already a builtin operator+ for vector types with the  
generic vector support.

Sent from my iPhone

On Feb 19, 2010, at 7:50 AM, mr dot nuke dot me at gmail dot com
gcc-bugzi...@gcc.gnu.org 
  wrote:

 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



-- 


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



[Bug c++/43122] g++ does not allow overloading operators for sse types (__m128, __m128d)

2010-02-19 Thread mr dot nuke dot me at gmail dot com


--- Comment #2 from mr dot nuke dot me at gmail dot com  2010-02-19 18:34 
---
I'm assuming you are referring to fvec.h and F32vec4. While I will apply this
workaround (one of many many workarounds to get fancy C++ code to work with
g++) it still doesn't solve the underlying problem, and affects portability
performance-wise, something lethal for HPC code.

Alex


-- 


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



[Bug c++/43122] g++ does not allow overloading operators for sse types (__m128, __m128d)

2010-02-19 Thread rguenth at gcc dot gnu dot org


--- Comment #4 from rguenth at gcc dot gnu dot org  2010-02-19 18:51 ---
FYI, this is 15.3/6.  __m128 isn't a class nor an enumeration.  Maybe it is
for the other compilers as implementation detail.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

  Component|target  |c++


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



[Bug c++/43122] g++ does not allow overloading operators for sse types (__m128, __m128d)

2010-02-19 Thread mr dot nuke dot me at gmail dot com


--- Comment #5 from mr dot nuke dot me at gmail dot com  2010-02-19 19:15 
---

 Which means there is already an operator+ defined which is done using the
 generic GNU vector support.  If you remove your definition of operator+, it
 works without it.
 

I could have sworn I saw 
error: no operator + matches these operands.
when I removed the operator definition (in a larger code base though).
The error I saw also has the message:
operand types are: __m128 + const __m128

I cannot reproduce this on the small test case I posted. I'm working on a repro
case.

Alex


-- 


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