home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / arch / 10817 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  4.1 KB

  1. Xref: sparky comp.arch:10817 comp.lang.misc:3730
  2. Newsgroups: comp.arch,comp.lang.misc
  3. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!spool.mu.edu!yale.edu!ira.uka.de!rz.uni-karlsruhe.de!stepsun.uni-kl.de!uklirb!kirchner
  4. From: kirchner@uklira.informatik.uni-kl.de (Reinhard Kirchner)
  5. Subject: Re: how to advocate new software/hardware features (Re: Hardware Support for Numeric Algorithms)
  6. Message-ID: <1992Nov17.112551.10920@uklirb.informatik.uni-kl.de>
  7. Sender: news@uklirb.informatik.uni-kl.de (Unix-News-System)
  8. Nntp-Posting-Host: uklira.informatik.uni-kl.de
  9. Organization: University of Kaiserslautern, Germany
  10. References: <1992Nov13.155126.3660@linus.mitre.org>
  11. Date: Tue, 17 Nov 1992 11:25:51 GMT
  12. Lines: 96
  13.  
  14. From article <1992Nov13.155126.3660@linus.mitre.org>, by bs@gauss.mitre.org (Robert D. Silverman):
  15. > Herman is bemoaning the fact that quite often a computer HAS hardware
  16. > to execute some particular instruction that he likes, but that HLL's
  17. > do not allow him access to it.
  18. > I can cite one example that bothers me a lot.
  19. > Quite a few modern microprocessors have hardware to do 32 x 32 bit 
  20. > multiplies and 64 bit / 32 bit divides.  I know of no HLL that will
  21. > allow me to write code to access these instructions. For example,
  22. > suppose I want to compute A*B/C exactly, where A,B, C are 32 bit
  23. > ints and C > A and C > B.  How do I do this in a HLL ?
  24. >  
  25. > If one has:
  26. > long a,b,c,d;
  27. > c = 7777777;
  28. > a = 111111;
  29. > b = 222222;
  30. > d = a*b/c;
  31. > I will NOT get the right answer, even when the computer has a 64 bit
  32. > multiply because the compiler will not generate the instruction!
  33. > It will generate an ordinary 32 bit multiply, and a*b will overflow.
  34. > I would like to see a language that has a feature that will allow
  35. > me to (say) define new operators that use specific machine instructions.
  36. > for example: (pseudocode)
  37. > #ifdef VAX define binary operator arg1 ** arg2  as  'emul arg1 arg2'
  38. > #elseif SUN define binary operator arg1 ** arg2 as 'umul arg1 arg2'
  39. > #ifdef VAX define binary operator arg1 /& arg2 as 'ediv arg1 arg2'
  40. > #elseif SUN define binary operator arg1 /& arg2 as 'ldiv arg1 arg2'
  41. > OR
  42. > define unary operator *& arg1  as  'sigbit arg1'
  43. > should my computer have an instruction, sigbit, that returns the
  44. > most significant bit in a word.
  45. > and be able to write:
  46. > d = a**b/& c;
  47. > or
  48. > d = *& a;
  49. > where 'emul' is the double length multiply instruction on a VAX and
  50. > 'umul' is the same for a SUN-3. Similarly for ediv and ldiv.
  51. > This requires that the code emitter for the compiler be able to
  52. > recognize such things.
  53. > I would also like to see an HLL developed that handles arithmetic
  54. > correctly. i.e. a language for numerical and semi-numerical algorithms.
  55. > Fortran claims to be that, but it is woefully inadequate. 
  56. > I could design such a language, but I don't have the spare time to
  57. > do it and I can't see my employer paying me to do it.
  58.  
  59. I must completely support this.
  60.  
  61. There are often VERY USEFULL things in the hardware, but now programming
  62. language supports them. This is mostly the case in the field of numerics,
  63. like
  64. - long integer product, as shown by Bob,
  65. - the carry, the major incredient to build a 'long' arithmetic
  66. - rounding control, needed to generate verified results ( not a mode bit! )
  67.  
  68. The writing of own operators, as Bob would like it, is available in the
  69. -XSC languages, where we have Pascal-, Fortran- ( Acrith-XSC by IBM )
  70. and C- ( will come out soon )
  71.  
  72. Since these languages need long integer arithmetic for the precise dot product
  73. access to the carry is mandatory. Since C does not support it the portable
  74. versions are SLOOOOOW.....
  75.  
  76. Even those versions supporting IEEE hardware do change the rounding mode
  77. veryveryveryvery often, which always drains the pipeline etc.
  78.  
  79. What bothers me even more is the fact that modern processors are designed
  80. to support only things that can be used by HLL, mainly C, because statistics
  81. show no use of other features ( what else ), and so we find ourselves
  82. severley limited by a chicken and egg problem.
  83.  
  84. Reinhard Kirchner
  85. Univ. of Kaiserslautern, Germany
  86. kirchner@informatik.uni-kl.de
  87.  
  88.