home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / arch / 10771 < prev    next >
Encoding:
Text File  |  1992-11-15  |  1.9 KB  |  46 lines

  1. Newsgroups: comp.arch
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!sal.wisc.edu!alan
  3. From: alan@sal.wisc.edu (Alan Watson)
  4. Subject: Re: how to advocate new software/hardware features (Re: Hardware Support for Numeric Algorithms)
  5. Message-ID: <1992Nov15.193356.1549@sal.wisc.edu>
  6. Organization: Space Astronomy Lab, Madison WI
  7. References: <1992Nov13.155126.3660@linus.mitre.org> <TMB.92Nov14145619@pollux.idiap.ch> <7899@charon.cwi.nl>
  8. Date: Sun, 15 Nov 1992 19:33:56 GMT
  9. Lines: 35
  10.  
  11. In article <7899@charon.cwi.nl> dik@cwi.nl (Dik T. Winter) writes:
  12. >But wait.  SPARC version 7 does not have an integer multiply instruction,
  13. >it uses multiply step.  When you code the multiply in assembly you will
  14. >find that you get a 64 bit result, but in C it is not possible to
  15. >retrieve that result.  Doing it with inline assembly is not what you
  16. >want in general (>32 instructions inline assembly), so you do it
  17. >out-of-line.  Hence it is not sufficient to have good inliners, on
  18. >some platforms you need out of line assembly routines to do what you
  19. >want, and no, the compilers do not help.  (The same holds for HP-PA 1,
  20. >IBM PC-RT, AMD 29k and a few more.)  So the operation is available but
  21. >you do not get it.
  22. >
  23. >So let's see.  You promote the GCC interface with asm.  How do you
  24. >code the 32x32->64 multiply on the SPARC in GCC?
  25.  
  26. Include the following in every source file:
  27.  
  28.     static inline long long mul32to64 (long i, long j)
  29.     {
  30.         whatever asm magic one requires
  31.     }
  32.  
  33. This terribly inelegant; if you want elegance BUY a compiler for the
  34. machine which has 64 bit longs and use:
  35.  
  36.     long i64;
  37.     int i32, j32;
  38.     i64 = (long) i32 * (long) j32;
  39.  
  40. If the compiler insists on promoting i32 and j32 to 64 bits before the
  41. multiplication, ask for your money back.
  42.  
  43. Solutions exists for many of the specific problems which have been
  44. discussed in this thread: most of the free ones are inelegant and most
  45. of the elegant ones are expensive.
  46.