home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.aix
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!rpi!sarah!dinner.asrc.albany.edu!rob
- From: rob@dinner.asrc.albany.edu (Robert D. Seals)
- Subject: Assembly long multiply for mandelspawn, anyone?
- Message-ID: <1992Aug26.175258.7569@sarah.albany.edu>
- Sender: news@sarah.albany.edu (News Administrator)
- Organization: SUNYA - ASRC, Albany, NY
- Date: Wed, 26 Aug 92 17:52:58 GMT
- Lines: 49
-
-
- Hey,
- Has anybody figgered out the POWER assembly code to implement
- the fixed point multiply code for mandelspawn? The idea -
- like that used in fractint - is to use hardware fixed point
- arithmetic to speed up the inner loop multiplies in the
- mandelbrot code. Here is the code (note it's compiled
- with GCC - the 'inline' keyword) for 68000 and VAX...
-
- #ifdef mc68000
- static inline unsigned long fracmult(x,y) unsigned long x,y;
- { unsigned long high;
- asm("mulsl %3,%1,%0" : "=d" (x), "=d" (high): "0" (x), "d" (y));
- return((high<<LEFTBITS) | (x>>RIGHTBITS));
- }
-
- static inline unsigned long fracmult2(x,y) unsigned long x,y;
- { unsigned long high;
- asm("mulsl %3,%1,%0" : "=d" (x), "=d" (high): "0" (x), "d" (y));
- return((high<<(LEFTBITS+1)) | (x>>(RIGHTBITS-1)));
- }
- #endif /* mc68000 */
-
- #ifdef vax /* VAX code due to Jussi Maki, thanks */
- typedef struct
- { unsigned int i0;
- unsigned int i1;
- } int64;
-
- static inline unsigned long fracmult(x,y) unsigned long x,y;
- { int64 r;
- asm("emul %1,%2,$0,%0" : "=g" (r) : "g" (x), "g" (y));
- return((r.i1<<LEFTBITS) | (r.i0>>RIGHTBITS));
- }
-
- static inline unsigned long fracmult2(x,y) unsigned long x,y;
- { int64 r;
- asm("emul %1,%2,$0,%0" : "=g" (r) : "g" (x), "g" (y));
- return((r.i1<<LEFTBITS+1) | (r.i0>>RIGHTBITS-1));
- }
- #endif /* vax */
-
- I hate it when sparc ipcs on the network are faster than my machine...
-
- rob
- --
- ------
- Crazy, man.
- rob@dinner.asrc.albany.edu
-