home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!netnews.upenn.edu!msuinfo!scss3.cl.msu.edu!mrr
- From: mrr@scss3.cl.msu.edu (Mark Riordan)
- Newsgroups: comp.unix.aix
- Subject: RS/6000 Integer Multiply Instruction
- Summary: Want assembly language help
- Message-ID: <1i58g8INNk0j@msuinfo.cl.msu.edu>
- Date: 2 Jan 93 23:29:12 GMT
- Organization: Michigan State University
- Lines: 43
- NNTP-Posting-Host: scss3.cl.msu.edu
- X-Newsreader: TIN [version 1.1 PL6]
-
- I would like help on an RS/6000 assembly language question.
-
- I have written an integer multiply-intensive program which has
- been ported to many platforms. (The program, RIPEM, is a public key
- encryption program written in C; for more info, FTP to rpub.cl.msu.edu.)
-
- RIPEM spends a lot of time doing extended-precision integer
- multiplies. This involves doing a lot of 32 bit * 32 bit = 64 bit
- multiplies. Because there is no 64-bit integer type, doing
- such a multiply in C is painful and inefficient. This is especially
- annoying given that most CPU's, including the RS/6000, have
- a single instruction which does a 32 bit * 32 bit multiply,
- yielding a 64-bit product. But few C compilers can be gotten
- to emit this instruction.
-
- 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 haven't been able to do this on the RS/6000 because I can't
- figure out exactly how the MQ register works (the information
- in InfoExplorer seems to be incorrect), I can't figure out
- how to get IBM's xlc C compiler to emit true assembly code,
- and I don't know the assembly syntax for accessing the MQ register
- (which evidently holds the most significant 32 bits of a multiply).
-
- 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.
-
- Incidentally, I want to do *unsigned* multiplies. Is this going
- to be a problem?
-
- Can anyone help?
-
- Thanks,
-
- Mark Riordan mrr@scss3.cl.msu.edu
-