linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* AltiVec on Linux
@ 2000-03-08 18:59 Greg Allen
  2000-03-08 20:26 ` jrosenau
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Greg Allen @ 2000-03-08 18:59 UTC (permalink / raw)
  To: linuxppc-dev


So I've been playing with Motorola's new "AltiVec" compiler, and here are
some observataions I thought I might share:

It's not a "Linux" compiler -- it's strictly a cross-compiler. It creates
the toolset "powerpc-eabisim-*". The binaries that it generates do not run
on Linux.

The included gdb has a simulator that can run these binaries.

It is possible to generate a library with powerpc-eabisim-gcc (lib*.a) and
then link to it with native gcc and get an executable. However, libc
function calls are problematic -- Linux is glibc based and
powerpc-eabisim-gcc is newlib based. e.g. "printf" called from the
powerpc-eabisim-gcc causes link errors with native gcc.

Motorola chose to "extend the C language" for the AltiVec API. They added a
new modifier "vector":

    vector float a, b, c;
    c = vec_add(a,b);

To make powerpc-eabisim-gcc recognize "vector", you compile with "-fvec".

Unfortunately, powerpc-eabisim-g++ doesn't recognize "vector" at all.
That's right, boys and girls, NO C++ SUPPORT WITH ALTIVEC!

So we have to patch g++ the same way gcc was patched -- to extend the C++
language for AltiVec.

When I saw that Motorola was "changing C" for AltiVec, I thought it was a
mistake. Now I'm certain.

What's wrong with:
    typedef float[4] vector_float;
    vector_float a, b, c;
    c = vec_add(a,b);

That works fine with VIS and MMX (in integer modes).

</rant>

In any case, the AltiVec package gives a few hints on what needs to be done
to make a LinuxPPC native compiler. We're not there yet.

I guess I'll be looking into that, too...

-Greg
----------------------------------------------------------------------
| Gregory E. Allen, MSEE Research Engineer <gallen@arlut.utexas.edu> |
|    Advanced Technology Laboratory, Sonar Development Division      |
|  Applied Research Laboratories: The University of Texas at Austin  |
----------------------------------------------------------------------

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: AltiVec on Linux
  2000-03-08 18:59 AltiVec on Linux Greg Allen
@ 2000-03-08 20:26 ` jrosenau
  2000-03-09  9:42 ` Adrian Cox
  2000-03-22 18:46 ` Troy Benjegerdes
  2 siblings, 0 replies; 4+ messages in thread
From: jrosenau @ 2000-03-08 20:26 UTC (permalink / raw)
  To: linuxppc-dev


So on Wed, Mar 08, 2000 at 12:59:29PM -0600, Greg Allen was all like,

>Unfortunately, powerpc-eabisim-g++ doesn't recognize "vector" at all.
>That's right, boys and girls, NO C++ SUPPORT WITH ALTIVEC!
>
>So we have to patch g++ the same way gcc was patched -- to extend the C++
>language for AltiVec.

But vector is already a type in the STL, so it can't be supported in g++
without breaking that.  I guess you could overload all sorts of neat
stuff, but it really does sound like a hack.  Why not create a standard
library that would handle MMX, 3Dnow!, Altivec, whatever?  If there's a
standard interface to those, we should encourage Motorola to make
altivec work the same way.

Josh

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: AltiVec on Linux
  2000-03-08 18:59 AltiVec on Linux Greg Allen
  2000-03-08 20:26 ` jrosenau
@ 2000-03-09  9:42 ` Adrian Cox
  2000-03-22 18:46 ` Troy Benjegerdes
  2 siblings, 0 replies; 4+ messages in thread
From: Adrian Cox @ 2000-03-09  9:42 UTC (permalink / raw)
  To: Greg Allen; +Cc: linuxppc-dev


Greg Allen wrote:

> It's not a "Linux" compiler -- it's strictly a cross-compiler. It creates
> the toolset "powerpc-eabisim-*". The binaries that it generates do not run
> on Linux.

Take the compiler patches, apply to the compiler source for LinuxPPC,
configure, make. This should work, though I've only done it on Debian.

> Unfortunately, powerpc-eabisim-g++ doesn't recognize "vector" at all.
> That's right, boys and girls, NO C++ SUPPORT WITH ALTIVEC!

For C++ use the keyword __vector.

This is documented in the Altivec Programming Interface Manual, which
can be found at:
http://www.altivec.org/tech_specifications/altivec_pim.pdf

It's not pretty, but it is in the manual.

- Adrian Cox, AG Electronics

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: AltiVec on Linux
  2000-03-08 18:59 AltiVec on Linux Greg Allen
  2000-03-08 20:26 ` jrosenau
  2000-03-09  9:42 ` Adrian Cox
@ 2000-03-22 18:46 ` Troy Benjegerdes
  2 siblings, 0 replies; 4+ messages in thread
From: Troy Benjegerdes @ 2000-03-22 18:46 UTC (permalink / raw)
  To: Greg Allen; +Cc: linuxppc-dev


See altivec.org, and check the tools page. There are PPC rpms of a native
compiler.

(Let me know if you want the sources)

On Wed, 8 Mar 2000, Greg Allen wrote:

>
> So I've been playing with Motorola's new "AltiVec" compiler, and here are
> some observataions I thought I might share:
>
> It's not a "Linux" compiler -- it's strictly a cross-compiler. It creates
> the toolset "powerpc-eabisim-*". The binaries that it generates do not run
> on Linux.
>

--------------------------------------------------------------------------
Troy Benjegerdes          troy@blacklablinux.com            hozer@drgw.net

Somone asked my why I work on this free (http://www.fsf.org/philosophy/)
software stuff and not get a real job. Charles Shultz had the best answer:

"Why do musicians compose symphonies and poets write poems? They do it
because life wouldn't have any meaning for them if they didn't. That's why
I draw cartoons. It's my life." -- Charles Shultz


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2000-03-22 18:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-03-08 18:59 AltiVec on Linux Greg Allen
2000-03-08 20:26 ` jrosenau
2000-03-09  9:42 ` Adrian Cox
2000-03-22 18:46 ` Troy Benjegerdes

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 NNTP newsgroup(s).