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

  1. Xref: sparky comp.arch:10700 comp.lang.misc:3638
  2. Newsgroups: comp.arch,comp.lang.misc
  3. Path: sparky!uunet!think.com!linus!linus.mitre.org!gauss!bs
  4. From: bs@gauss.mitre.org (Robert D. Silverman)
  5. Subject: Re: how to advocate new software/hardware features (Re: Hardware Support for Numeric Algorithms)
  6. Message-ID: <1992Nov13.155126.3660@linus.mitre.org>
  7. Sender: news@linus.mitre.org (News Service)
  8. Nntp-Posting-Host: gauss.mitre.org
  9. Organization: Research Computer Facility, MITRE Corporation, Bedford, MA
  10. References: <1992Nov10.153705.27804@yrloc.ipsa.reuter.COM> <1992Nov12.131856.12605@linus.mitre.org> <TMB.92Nov13144057@arolla.idiap.ch>
  11. Date: Fri, 13 Nov 1992 15:51:26 GMT
  12. Lines: 87
  13.  
  14. In article <TMB.92Nov13144057@arolla.idiap.ch> tmb@idiap.ch writes:
  15. >bs@gauss.mitre.org writes:
  16. >> rbe@yrloc.ipsa.reuter.com writes:
  17. >> > Optimization before design is usually a bad idea. 
  18. >>
  19. >> Spouting aphorisms adds little to this discussion. Especially since you
  20. >> are assuming facts not in evidence. (i.e. you are assuming that the
  21. >> optimization came before the design).
  22. >
  23. >What Rubin codes in the privacy of his own VAX is his own business.
  24. >
  25. >But he is trying to use his code as an example to convince the rest of
  26. >us that we should pay for our computer manufacturers to incorporate
  27. >"get bit from bitsream" and "generate exponential rv" instructions,
  28.  
  29. Nothing so esoteric.  I get the *impression* that none of you are really
  30. listening to what he is saying.
  31.  
  32. Herman is bemoaning the fact that quite often a computer HAS hardware
  33. to execute some particular instruction that he likes, but that HLL's
  34. do not allow him access to it.
  35.  
  36. I can cite one example that bothers me a lot.
  37.  
  38. Quite a few modern microprocessors have hardware to do 32 x 32 bit 
  39. multiplies and 64 bit / 32 bit divides.  I know of no HLL that will
  40. allow me to write code to access these instructions. For example,
  41. suppose I want to compute A*B/C exactly, where A,B, C are 32 bit
  42. ints and C > A and C > B.  How do I do this in a HLL ?
  43.  
  44. If one has:
  45.  
  46. long a,b,c,d;
  47.  
  48. c = 7777777;
  49. a = 111111;
  50. b = 222222;
  51. d = a*b/c;
  52.  
  53.  
  54. I will NOT get the right answer, even when the computer has a 64 bit
  55. multiply because the compiler will not generate the instruction!
  56. It will generate an ordinary 32 bit multiply, and a*b will overflow.
  57.  
  58. I would like to see a language that has a feature that will allow
  59. me to (say) define new operators that use specific machine instructions.
  60.  
  61. for example: (pseudocode)
  62.  
  63. #ifdef VAX define binary operator arg1 ** arg2  as  'emul arg1 arg2'
  64. #elseif SUN define binary operator arg1 ** arg2 as 'umul arg1 arg2'
  65. #ifdef VAX define binary operator arg1 /& arg2 as 'ediv arg1 arg2'
  66. #elseif SUN define binary operator arg1 /& arg2 as 'ldiv arg1 arg2'
  67.  
  68.  
  69. OR
  70.  
  71. define unary operator *& arg1  as  'sigbit arg1'
  72.  
  73. should my computer have an instruction, sigbit, that returns the
  74. most significant bit in a word.
  75.  
  76. and be able to write:
  77.  
  78. d = a**b/& c;
  79. or
  80.  
  81. d = *& a;
  82.  
  83.  
  84. where 'emul' is the double length multiply instruction on a VAX and
  85. 'umul' is the same for a SUN-3. Similarly for ediv and ldiv.
  86.  
  87. This requires that the code emitter for the compiler be able to
  88. recognize such things.
  89.  
  90. I would also like to see an HLL developed that handles arithmetic
  91. correctly. i.e. a language for numerical and semi-numerical algorithms.
  92. Fortran claims to be that, but it is woefully inadequate. 
  93.  
  94. I could design such a language, but I don't have the spare time to
  95. do it and I can't see my employer paying me to do it.
  96. --
  97. Bob Silverman
  98. These are my opinions and not MITRE's.
  99. Mitre Corporation, Bedford, MA 01730
  100. "You can lead a horse's ass to knowledge, but you can't make him think"
  101.