AMD K6/K6-2, 3DNOW!, and MMX - where to start?

AMD K6/K6-2, 3DNOW!, and MMX - where to start?

Post by Rob Dal » Sun, 12 Jul 1998 04:00:00



Hello.  I am looking to make a K6/K6-2 optimized
version of gcc and implement MMX and 3D NOW! instructions.
Where do I start?

I have have printed all related documents from AMD's website,
and I bought 'The AMD-K6 3D Processor.'  All I need to know
now is where the code goes.. I'm guessing in libc.
If so, exactly what are the 'pentium optimizations' being
made in pgcc?  

Thanks for any help!  

--
Robert Dale

   "arrest this man he talks in maths"
                          RADIOHEAD OK COMPUTER

 
 
 

AMD K6/K6-2, 3DNOW!, and MMX - where to start?

Post by Bruce Stephen » Sun, 12 Jul 1998 04:00:00



> Hello.  I am looking to make a K6/K6-2 optimized
> version of gcc and implement MMX and 3D NOW! instructions.
> Where do I start?
> I have have printed all related documents from AMD's website,
> and I bought 'The AMD-K6 3D Processor.'  All I need to know
> now is where the code goes.. I'm guessing in libc.
> If so, exactly what are the 'pentium optimizations' being
> made in pgcc?  

Where the code goes is a design decision.  Putting it in the library
(presumably providing fairly large-grained operations, either
implemented using MMX or using traditional loops, depending on the
processor) would mean that applications that needed to do fairly
large-grained chunks would benefit.  

I'd guess that would include the things that MMX was supposed to
benefit: some of the basic operations in The Gimp, for example, where
you're doing similar operations over an entire image.

For smaller things, the cost of calling a function or a system call
might outweigh the benefits.  Not that it isn't worth looking at.

One thing that's worth a look at is context switching in the kernel.
The kernel saves and restores the floating point stuff if a process
has used it (which will be true if you use MMX): I think the K6-2
provides a faster floating point save/restore operation, and I seem to
remember it's given a different op (which seems crazy---why not speed
up the existing one---so maybe I misread it); it would be good if the
kernel could be compiled to use this, if it's possible.

Another approach would be to extend the assembler so it understood
these things, and then you could provide macros (or inline functions)
in suitable header files which would call these things.

I'd look at the last two: make sure the context switching is a fast as
possible, and make it easy to use MMX and 3DNow operations, and do
some tests to see if there's enough benefit from it.  

Ideally, you want the support in glibc or some other library, so that
applications can be distributed in binary (but people with different
processors would have different libraries installed), but that might
not provide much benefit.  It would be nice if people who compiled
from source were able to ask for a binary tuned to their processor
(which suggests inline functions or macros).

My guess is that doing this as an automatic compiler optimization
isn't practical.

 
 
 

1. Any advantages running AMD K6 vs. AMD K6-2 w/3DNow!

I've starting to build a new Linux box to replace my aging 486/33. I was
wondering if there were any advantages of choosing an AMD K6-2 w/3DNow! over
the older AMD K6? I won't be doing anything in 3D and the 100 MHz bus isn't
that important to me. Are there any other advantages, like if AMD improved
the FPU? Thanks!

--Dan

2. Multiple Linux OS's on one hd

3. Linux on AMD K6-2 350MHz 3DNow

4. Sun T3 tray (Disk Array)

5. AMD K6-2 without 3dnow ????

6. "Reply-To:" in pine?

7. Compiling for AMD K6-2 3DNow!

8. How to determine IRQ's

9. Upgraded from Intel Pentium 200MMX to AMD K6-2 400 3dNOW (Problems)

10. AMD K6-2 3DNow compatibility

11. advice wanted: upgrade to P233 MMX or AMD K6-2 333

12. AMD K6-2 or K6-3

13. AMD K6-2 vs. K6-III