Implementing VMX128 AltiVec Variant

Gordan Bobic gordan@bobich.net
Tue Aug 21 22:17:00 GMT 2007


Hi,

For those of you who don't know, VMX128 is a slightly modified version 
of VMX (AltiVec) in the Xenon processor (i.e. XBox 360). I'm trying to 
implement support for this in GCC.

The principal difference that makes -maltivec not work is that some VMX 
instructions are missing. Namely, the following:

vmuloub, vmulouh, vmulosb, vmulosh, vmuleub, vmuleuh, vmulesb, vmulesh,
vsum4ubs, vsum4shs, vsum2sws, vsum4sbs, vsumsws, vmhaddshs, vmhraddshs,
vmladduhm, vmsumubm, vmsummbm, vmsumuhm, vmsumuhs, vmsumshm, vmsumshs

As a firs pass at this, I removed all references to these instructions from:
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/altivec.h
gcc/config/rs6000/altivec.md

These are the only place I found references to them, apart from the 
files in the gcc/ada directory:

gcc/ada/g-alveop.adb
gcc/ada/g-alveop.ads
gcc/ada/g-alleve.adb
gcc/ada/g-alleve.ads

I ignored these - I am making a rash assumption here that these are not 
too important for a C/C++ only build, but I'd like some confirmation on 
that. What are the above ada files for?

With the modifications I made, GCC still compiled fine. However, libgcc 
and libstdc++ DO still get build with the missing instructions 
(according to objdump -D). Why is that? Is that a consequence of the ADA 
files? Or something else? Where should I look? Is the it ada files that 
are the cause of the problem I'm seeing?

When I compile a test program with -maltivec and a loop that vectorizes, 
my .o files don't contain any of the non-existant instructions (listed 
above). However, once it is linked, the resulting binary does (including 
if it is a dynamically linked executable). Can anyone hazard a guess as 
to what is actually going on?

Eventually, I would like to implement this as an option independent of 
-maltivec. Binutils already have a -mvmx128 flag, and I was planning to 
use the same flag. Other VMX128 changes include an addition of an extra 
96 vector registers (for a total of 128), and possibly some extra 
functions, I'm not sure off the top of my head. But for a first pass, 
I'm hoping that just removing the non-existent instructions should work.

I'm very new to GCC code (been using it for years, just never looked at 
the source). If somebody would be kind enough to help me out by pointing 
me in the right direction, it would be very much appreciated.

Thanks in advance.

Gordan



More information about the Gcc mailing list