public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* generic simd and c++
@ 2002-07-30 17:34 Andrew Pinski
  2002-07-31 15:37 ` Aldy Hernandez
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Pinski @ 2002-07-30 17:34 UTC (permalink / raw)
  To: gcc

Does generic simd works in c++?
When I try it I get the following error:
findPeaks.cc:47: error: invalid operands of types `vector int' 
and `vector int'
    to binary `operator-'

Thanks,
Andrew Pinski

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: generic simd and c++
  2002-07-30 17:34 generic simd and c++ Andrew Pinski
@ 2002-07-31 15:37 ` Aldy Hernandez
  2002-07-31 17:21   ` Andrew Pinski
  0 siblings, 1 reply; 6+ messages in thread
From: Aldy Hernandez @ 2002-07-31 15:37 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc

>>>>> "Andrew" == Andrew Pinski <pinskia@physics.uc.edu> writes:

 > Does generic simd works in c++?
 > When I try it I get the following error:
 > findPeaks.cc:47: error: invalid operands of types `vector int' and
 > `vector int'
 >     to binary `operator-'

vector doesn't exist as a keyword.  You're going to have to define a
macro defining it as we did for altivec:

        #define vector __attribute__((vector_size(16)))

This will give you 128 bit vectors.  Use 8 for 64-bit vectors, etc.

however, try to use something else but vector, since this will cause
conflicts with C++ libraries.

Aldy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: generic simd and c++
  2002-07-31 15:37 ` Aldy Hernandez
@ 2002-07-31 17:21   ` Andrew Pinski
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Pinski @ 2002-07-31 17:21 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: Andrew Pinski, gcc

no this is not the problem, if you copy gcc/testsuite/gcc.c-torture/execute/simd-1.c to simd.cc and add #include <stdlib.h> to the top of the file and try to compile it, you will get the same error as I reported.

Thanks,
Andrew Pinski

I will be filling a bug report soon for some of simd problems with -O1 and -msse also.


> 
> >>>>> "Andrew" == Andrew Pinski <pinskia@physics.uc.edu> writes:
> 
>  > Does generic simd works in c++?
>  > When I try it I get the following error:
>  > findPeaks.cc:47: error: invalid operands of types `vector int' and
>  > `vector int'
>  >     to binary `operator-'
> 
> vector doesn't exist as a keyword.  You're going to have to define a
> macro defining it as we did for altivec:
> 
>         #define vector __attribute__((vector_size(16)))
> 
> This will give you 128 bit vectors.  Use 8 for 64-bit vectors, etc.
> 
> however, try to use something else but vector, since this will cause
> conflicts with C++ libraries.
> 
> Aldy
> 
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: generic simd and c++
  2002-07-31 22:08 ` Daniel Egger
@ 2002-07-31 23:14   ` Gabriel Dos Reis
  0 siblings, 0 replies; 6+ messages in thread
From: Gabriel Dos Reis @ 2002-07-31 23:14 UTC (permalink / raw)
  To: Daniel Egger; +Cc: bkoz, GCC Developer Mailinglist

Daniel Egger <degger@fhm.edu> writes:

| [1  <text/plain>]
| Am Mit, 2002-07-31 um 21.59 schrieb Benjamin Kosnik:
| 
| > Somebody should just make a template specialization of std::vector that
| > uses the simd extensions. See <vector> and perhaps the vector<bool>
| > specialization already in place if you're curious.
| 
| I'm curious how you think this might work. What should the template
| parameter be? SIMD instructions are somewhat different from typical
| containter operations and would require special methods while some 
| operations a vector specialisation needs would be hardly implementable
| and probably not make much sense.
| 
| Maybe I'm just thinking in the wrong direction so please show me the
| way.... :)

Actually, I thought the Altivec vector workd Aldy did may be extended
to support valarray<>.  I didn't reallywork hard; but I think it is
doable.  For fixed sized valarray<>.

-- Gaby

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: generic simd and c++
  2002-07-31 18:06 Benjamin Kosnik
@ 2002-07-31 22:08 ` Daniel Egger
  2002-07-31 23:14   ` Gabriel Dos Reis
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Egger @ 2002-07-31 22:08 UTC (permalink / raw)
  To: bkoz; +Cc: GCC Developer Mailinglist

[-- Attachment #1: Type: text/plain, Size: 687 bytes --]

Am Mit, 2002-07-31 um 21.59 schrieb Benjamin Kosnik:

> Somebody should just make a template specialization of std::vector that
> uses the simd extensions. See <vector> and perhaps the vector<bool>
> specialization already in place if you're curious.

I'm curious how you think this might work. What should the template
parameter be? SIMD instructions are somewhat different from typical
containter operations and would require special methods while some 
operations a vector specialisation needs would be hardly implementable
and probably not make much sense.

Maybe I'm just thinking in the wrong direction so please show me the
way.... :)

-- 
Servus,
       Daniel

[-- Attachment #2: Dies ist ein digital signierter Nachrichtenteil --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: generic simd and c++
@ 2002-07-31 18:06 Benjamin Kosnik
  2002-07-31 22:08 ` Daniel Egger
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Kosnik @ 2002-07-31 18:06 UTC (permalink / raw)
  To: gcc; +Cc: aldyh, pinskia

Somebody should just make a template specialization of std::vector that
uses the simd extensions. See <vector> and perhaps the vector<bool>
specialization already in place if you're curious.

That would rule.

Such a specialization could easily be shipped with libstdc++ as a file
in the "include/ext" directory, once copyright assignments were taken
care of.

-benjamin

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-07-31 23:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-30 17:34 generic simd and c++ Andrew Pinski
2002-07-31 15:37 ` Aldy Hernandez
2002-07-31 17:21   ` Andrew Pinski
2002-07-31 18:06 Benjamin Kosnik
2002-07-31 22:08 ` Daniel Egger
2002-07-31 23:14   ` Gabriel Dos Reis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).