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

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).