public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* altivec support in gcc
@ 2003-04-08 10:10 Michel LESPINASSE
  2003-04-09 16:57 ` Aldy Hernandez
  0 siblings, 1 reply; 14+ messages in thread
From: Michel LESPINASSE @ 2003-04-08 10:10 UTC (permalink / raw)
  To: gcc

Hi,

I have a few questions about the altivec support in gcc...

First, is there any reason why altivec.h defines the second argument
in vec_ld as being a vector pointer instead of a const vector pointer ?
This is causing me no ends of trouble.

Second, I have not tried gcc 3.3 yet, but gcc 3.2 has a lot of trouble
compiling the following construct... it does compile it eventually,
but it requires hundreds of megabytes of virtual memory for doing
it...

(This code is meant as a shortcut for calculating (A+B+C+D+2)>>2, for
a vector of 16 unsigned char values. This is used in the motion
compensation loop of an mpeg2 decoder.)

    ones = vec_splat_u8 (1);
    avg0 = vec_avg (A, B);
    xor0 = vec_xor (A, B);
    avg1 = vec_avg (C, D);
    xor1 = vec_xor (C, D);
    tmp = vec_and (vec_and (ones, vec_or (xor0, xor1)),
                   vec_xor (avg0, avg1));
    out = vec_sub (vec_avg (avg0, avg1), tmp);

Initially I had only one out= assignment, i.e. I had put the tmp
expression in place of the tmp variable in the current out
assignment. I could not even get that code to compile, it made gcc
inflate to over 700 MB. After splitting it as shown above, the code
does compile fine, but GCC still inflates to over 300 MB compiling it.

This is on a debian/sid system, the gcc -v version indicates:
gcc -v
Reading specs from /usr/lib/gcc-lib/powerpc-linux/3.2.3/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc powerpc-linux
Thread model: posix
gcc version 3.2.3 20030316 (Debian prerelease)

It's probably not a critical bug as it can be worked around by
splitting expressions in smaller pieces, but I thought it should be
signaled as it makes some code extremely slow to compile. For
information, the same code used to compile just fine with apple's old
altivec-patched gcc 2.95.x compiler.

Hope this helps,

-- 
Michel "Walken" LESPINASSE
"In this time of war against Osama bin Laden and the oppressive
Taliban regime, we are thankful that OUR leader isn't the spoiled son
of a powerful politician from a wealthy oil family who is supported by
religious fundamentalists, operates through clandestine organizations,
has no respect for the democratic electoral process, bombs innocents,
and uses war to deny people their civil liberties." --The Boondocks

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: AltiVec support in GCC
@ 2000-02-18 18:47 Mike Stump
  2000-02-19 15:03 ` Geoff Keating
  0 siblings, 1 reply; 14+ messages in thread
From: Mike Stump @ 2000-02-18 18:47 UTC (permalink / raw)
  To: shebs; +Cc: gcc, kumar

> Date: Fri, 18 Feb 2000 18:04:50 -0800
> From: Stan Shebs <shebs@apple.com>
> To: Mike Stump <mrs@windriver.com>

> Since this is an extension to the dialect of C accepted by GCC, I
> would hope there would be some effort to define the dialect before
> putting in dueling patches. :-)

Well, people might say, this is how this vendor defined it, and we
want gcc to be compatible with it.  Fairly reasonable, though long
term, would be nice to do better than this, if we can.

> I don't know as much about the SSE situation, but the AltiVec
> extensions to C have been added to several other compilers

Same.

> and in real-world use for a while now, so there is an existing code
> base to consider.

Ditto (though I don't know how extensive their use it).

> Kumar has kindly provided the URLs to Motorola's spec; is there
> something similar for SSE that we can look at?

ftp://download.intel.com/design/PentiumII/manuals/24319102.PDF

and if that doesn't work for any reason, you can find it at:

http://developer.intel.com/design/PentiumII/manuals/243191.htm

See section 3.1.3 and appendix C.

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: AltiVec support in GCC
@ 2000-02-18 17:13 Mike Stump
  2000-02-18 18:04 ` Stan Shebs
  2000-02-20 10:56 ` Richard Henderson
  0 siblings, 2 replies; 14+ messages in thread
From: Mike Stump @ 2000-02-18 17:13 UTC (permalink / raw)
  To: gcc, kumar

> Date: Thu, 17 Feb 2000 22:30:00 -0600 (CST)
> From: Kumar Gala <kumar@chaos.ph.utexas.edu>
> To: gcc@gcc.gnu.org

> The major issues that I have been told about, surrounds the fact that the
> Motorola changes add a 'vector' primitive.  

Sounds half way reasonable.  I have here in my hand a piece of paper,
no, a compiler for the Pentium III SSE with intrinsic support for SSE.
It adds a vector type to the compiler also.

Would be nice if a person in the know took the moto patches and the
SSE patches and unified them...  If not, then the first set in, wins,
and the other will just have to cope, extend and transform.

> the C API is much more like 'c' function calls

Same with the SSE stuff.

> Also, people have discussed the creation of auto-vectorizing
> compilers.  While this can be useful for the simple case, from the
> AltiVec code I think it would be very diffucult to get full use of
> the AltiVec instruction set.

Yes, this is a longer range goal that shouldn't be worried about at
first.  I think we can postpone talks about it.

^ permalink raw reply	[flat|nested] 14+ messages in thread
* AltiVec support in GCC
@ 2000-02-17 20:30 Kumar Gala
  0 siblings, 0 replies; 14+ messages in thread
From: Kumar Gala @ 2000-02-17 20:30 UTC (permalink / raw)
  To: gcc

I am new this list and wanted to start up a discussion on this issues with
getting AltiVec support into GCC.  I am aware that Motorola has worked on
a set of patches against GCC 2.95.2, binutils, gdb, and are in the process
of assigning the copyright to the FSF/GNU.

The major issues that I have been told about, surrounds the fact that the
Motorola changes add a 'vector' primitive.  

(ie)

vector pixel
vector float
vector short
vector int
vector char
vector bool
...

These are the major AltiVec docs.
http://www.mot.com/SPS/PowerPC/teksupport/teklibrary/manuals/altivec_pem.pdf
http://www.mot.com/SPS/PowerPC/teksupport/teklibrary/manuals/altivecpim.pdf

The PEM documents the assembly level instructions that AltiVec is composed
of.  The PIM documents the C/C++ extensions.  It also discusses ABI
changes and the such.  The patches that Motorola have done following the
PIM.

The rest of the PIM documents the C API.  To clarify what some people have
said on this list, the C API is much more like 'c' function calls then
overloaded operators in c++.

for example to add to vectors you would do the following code

   vector int a, b, c;
   vec_add(a,b,c)  /* a + b = c */

Also, people have discussed the creation of auto-vectorizing compilers.
While this can be useful for the simple case, from the AltiVec code I
think it would be very diffucult to get full use of the AltiVec
instruction set. 

There are instructions like vec_perm, vec_max, vec_min, vec_avg.  That
would be very diffucult for any auto-vectorizing utility to use.  Some of
these operations provide the greatest benefit.  For one example, some 2-d
median code developed at Motorola has shown a 30-40x speedup with the use
of altivec due to these unique instructions.  Also, these operations allow
the coder to think in new/creative ways.

I also believe it is time that SIMD is taken more seriously.  I believe
that the AltiVec SIMD engine provides one of the more robust set of
instructions to the programmer (as apposed to MMX, SSE, etc).  While SIMD
may not be ment for the general programmer it may well be that the general
programmer will unknowingly use it.  Here's a list of ideas that I have
had for places where AltiVec could enhance performance.

Software RAID code (XOR), high bandwidth memory operations (128 bit data
paths), String manipluations, encryption (take a look at the latest
powerpc rc5 client), checksums.  GIMP, MESA.  

The reason I am brinking this up know is that I think the sooner the
discussion starts about this the faster programmers well have access to
it and the better for everyone.  

I am looking into getting the patches from Motorola and have a contact for
anyone interested.  

thanks

 - kumar gala


ignorance is bliss.







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

end of thread, other threads:[~2003-04-22 19:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-08 10:10 altivec support in gcc Michel LESPINASSE
2003-04-09 16:57 ` Aldy Hernandez
2003-04-09 22:55   ` Michel LESPINASSE
2003-04-21 13:30     ` altivec support in gcc - bug with vec_mergel Michel LESPINASSE
2003-04-22 15:11       ` Daniel Egger
2003-04-22 16:43         ` Michel LESPINASSE
2003-04-22 19:55           ` Daniel Egger
2003-04-22 21:40             ` Aldy Hernandez
  -- strict thread matches above, loose matches on Subject: below --
2000-02-18 18:47 AltiVec support in GCC Mike Stump
2000-02-19 15:03 ` Geoff Keating
2000-02-18 17:13 Mike Stump
2000-02-18 18:04 ` Stan Shebs
2000-02-20 10:56 ` Richard Henderson
2000-02-17 20:30 Kumar Gala

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