home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.aix
- Path: sparky!uunet!think.com!enterpoop.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jfc
- From: jfc@athena.mit.edu (John F Carr)
- Subject: Re: RS/6000 Integer Multiply Instruction
- Message-ID: <1993Jan3.172528.27328@athena.mit.edu>
- Sender: news@athena.mit.edu (News system)
- Nntp-Posting-Host: achates.mit.edu
- Organization: Massachusetts Institute of Technology
- References: <1i58g8INNk0j@msuinfo.cl.msu.edu>
- Date: Sun, 3 Jan 1993 17:25:28 GMT
- Lines: 61
-
- In article <1i58g8INNk0j@msuinfo.cl.msu.edu> mrr@scss3.cl.msu.edu (Mark Riordan) writes:
- >On architectures with which I am familiar, I have been able to
- >speed up RIPEM by 50% or more simply by:
- >
- > 1. Feeding the C source through the compiler to get assembly output,
- > 2. Replacing the lengthy and obtuse code needed to do the multiply
- > portably with the appropriate instruction for that platform,
- > 3. Feeding the resultant assembly source to the assembler.
-
- >I can get xlc to put out an assembly *listing*, but not assembly
- >source code that can be fed to a compiler. I obtained and installed
- >GNU C to solve that problem. But I still can't figure out how to
- >access the MQ register.
-
- If you have gcc, try using the built in "long long" type.
-
-
- This source file:
-
- long long mul32x32(int x, int y)
- {
- return (long long)x * (long long)y;
- }
- unsigned long long umul32x32(unsigned int x, unsigned int y)
- {
- return (unsigned long long)x * (unsigned long long)y;
- }
-
- compiles to this assembly:
-
- .mul32x32:
- mul 3,3,4
- mfmq 4
- br
-
- .umul32x32:
- ai 11,3,0
- ai 7,4,0
- ai 12,11,0
- cal 11,0(0)
- ai 8,7,0
- cal 7,0(0)
- mul 3,12,8
- mfmq 4
- sri 9,12,31
- a 9,9,11
- sri 0,8,31
- a 0,0,7
- muls 0,0,12
- a 3,3,0
- muls 9,9,8
- a 3,3,9
- br
-
- gcc allocates 64 bit integers in consecutive registers, so the function
- return value is in r3:r4.
-
- "ai <x>,<y>,0" is the instruction gcc uses for a register-register move.
-
- --
- John Carr (jfc@athena.mit.edu)
-