help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vector extension operator+ not allowed in g++?


From: Rade Kutil
Subject: Re: Vector extension operator+ not allowed in g++?
Date: 14 Jun 2005 16:51:17 GMT

Oh, just realized that there is also a gnu.g++.help.  Therefore
fullquote, crosspost und followup to gnu.g++.help.

Larry I Smith wrote:
> Rade Kutil wrote:
>> I have a C-code that uses the vector extensions in the following way:
>> 
>>   typedef int v4sf __attribute__ ((mode(V4SF)));
>>   v4sf a, c;
>>   float *pointer;
>>   a = __builtin_ia32_loadaps (pointer);
>>   c = a + a;
>> 
>> Now I use this code in C++ with gcc and I would get the error
>> 
>>   error: invalid operands of types `vector float' and `vector 
>>    float' to binary `operator+'
>> 
>> in the line c = a + a.  The gcc docs don't say anything that this
>> would not be allowed in C++.  Why do I get the error?
>> 
>> 
>> Rade
> 
> More info please.  What are the compile switches?
> Using GCC version:
> 
>   gcc (GCC) 3.3.5 20050117 (prerelease) (SUSE Linux)
> 
> Both of these compile commands fail with errors:
> 
>   Compile a C program:
>     gcc -o x  x.c
>       c2.c:8: error: incompatible types in assignment
> 
>   Compile a C++ program:
>     g++ -o x  x.cpp
>       c2.cpp:8: error: `__builtin_ia32_loadaps' undeclared
>                 (first use this function)
>       c2.cpp:9: error: invalid operands of types `vector float'
>                 and `vector float' to binary `operator+'
> 
> 
> Where both 'x.c' and 'x.cpp' contain:
> 
>   typedef int v4sf __attribute__ ((mode(V4SF)));
> 
>   int main()
>   {
>       v4sf a, c;
>       float *pointer;
>       a = __builtin_ia32_loadaps (pointer);  /* line 8 */
>       c = a + a;                             /* line 9 */
> 
>       return 0;
>   }

Of course we need -msse and gcc 3.3 or higher.  I am using gcc 3.3.5.


Rade


reply via email to

[Prev in Thread] Current Thread [Next in Thread]