home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / arch / 10711 < prev    next >
Encoding:
Internet Message Format  |  1992-11-14  |  1.9 KB

  1. Xref: sparky comp.arch:10711 comp.lang.misc:3643
  2. Newsgroups: comp.arch,comp.lang.misc
  3. Path: sparky!uunet!caen!sol.ctr.columbia.edu!sal.wisc.edu!alan
  4. From: alan@sal.wisc.edu (Alan Watson)
  5. Subject: Re: how to advocate new software/hardware features (Re: Hardware Support for Numeric Algorithms)
  6. Message-ID: <1992Nov13.200222.23955@sal.wisc.edu>
  7. Organization: Space Astronomy Lab, Madison WI
  8. References: <1992Nov12.131856.12605@linus.mitre.org> <TMB.92Nov13144057@arolla.idiap.ch> <1992Nov13.155126.3660@linus.mitre.org>
  9. Date: Fri, 13 Nov 1992 20:02:22 GMT
  10. Lines: 35
  11.  
  12. In article <1992Nov13.155126.3660@linus.mitre.org> bs@gauss.mitre.org (Robert D. Silverman) writes:
  13. >Nothing so esoteric.  I get the *impression* that none of you are really
  14. >listening to what he is saying.
  15. >
  16. >Herman is bemoaning the fact that quite often a computer HAS hardware
  17. >to execute some particular instruction that he likes, but that HLL's
  18. >do not allow him access to it.
  19. >
  20. >I can cite one example that bothers me a lot.
  21. >
  22. >Quite a few modern microprocessors have hardware to do 32 x 32 bit 
  23. >multiplies and 64 bit / 32 bit divides.  I know of no HLL that will
  24. >allow me to write code to access these instructions. For example,
  25. >suppose I want to compute A*B/C exactly, where A,B, C are 32 bit
  26. >ints and C > A and C > B.  How do I do this in a HLL ?
  27.  
  28. This is a compiler issue, not a language issue; many compilers provide
  29. access to system-specific operations.
  30.  
  31. If the compiler on your system does not provide an appropriate built-in
  32. either persuade your compiler supplier to put it in, or pay them to put
  33. it in, or use something like gcc or lcc and put it in yourself.
  34.  
  35. For example, on my MIPS machine I am able to access the abs.s instruction
  36. in the following manner:
  37.  
  38. #if defined __mips && defined __GNUC__
  39. #define __builtin_absf(y,x) \
  40.     __asm__ volatile ("abs.s\t%0,%1 # __builtin_absf" : "=f" (y) : "f" (x));
  41. #else
  42. #define __builtin_absf(y,x) \
  43.     if (x >= 0) y = x; else y = -x;
  44. #endif
  45.  
  46.