From: bs@gauss.mitre.org (Robert D. Silverman)
Subject: Re: how to advocate new software/hardware features (Re: Hardware Support for Numeric Algorithms)
Organization: Research Computer Facility, MITRE Corporation, Bedford, MA
Date: Fri, 13 Nov 1992 15:51:26 GMT

In article <TMB.92Nov13144057@arolla.idiap.ch> tmb@idiap.ch writes:
>bs@gauss.mitre.org writes:
>> rbe@yrloc.ipsa.reuter.com writes:
>> > Optimization before design is usually a bad idea. 
>>
>> Spouting aphorisms adds little to this discussion. Especially since you
>> are assuming facts not in evidence. (i.e. you are assuming that the
>> optimization came before the design).
>
>What Rubin codes in the privacy of his own VAX is his own business.
>
>But he is trying to use his code as an example to convince the rest of
>us that we should pay for our computer manufacturers to incorporate
>"get bit from bitsream" and "generate exponential rv" instructions,
 
Nothing so esoteric.  I get the *impression* that none of you are really
listening to what he is saying.

Herman is bemoaning the fact that quite often a computer HAS hardware
to execute some particular instruction that he likes, but that HLL's
do not allow him access to it.

I can cite one example that bothers me a lot.

Quite a few modern microprocessors have hardware to do 32 x 32 bit 
multiplies and 64 bit / 32 bit divides.  I know of no HLL that will
allow me to write code to access these instructions. For example,
suppose I want to compute A*B/C exactly, where A,B, C are 32 bit
ints and C > A and C > B.  How do I do this in a HLL ?
 
If one has:

long a,b,c,d;

c = 7777777;
a = 111111;
b = 222222;
d = a*b/c;


I will NOT get the right answer, even when the computer has a 64 bit
multiply because the compiler will not generate the instruction!
It will generate an ordinary 32 bit multiply, and a*b will overflow.

I would like to see a language that has a feature that will allow
me to (say) define new operators that use specific machine instructions.

for example: (pseudocode)

#ifdef VAX define binary operator arg1 ** arg2  as  'emul arg1 arg2'
#elseif SUN define binary operator arg1 ** arg2 as 'umul arg1 arg2'
#ifdef VAX define binary operator arg1 /& arg2 as 'ediv arg1 arg2'
#elseif SUN define binary operator arg1 /& arg2 as 'ldiv arg1 arg2'


OR

define unary operator *& arg1  as  'sigbit arg1'

should my computer have an instruction, sigbit, that returns the
most significant bit in a word.

and be able to write:

d = a**b/& c;
or

d = *& a;


where 'emul' is the double length multiply instruction on a VAX and
'umul' is the same for a SUN-3. Similarly for ediv and ldiv.

This requires that the code emitter for the compiler be able to
recognize such things.

I would also like to see an HLL developed that handles arithmetic
correctly. i.e. a language for numerical and semi-numerical algorithms.
Fortran claims to be that, but it is woefully inadequate. 

I could design such a language, but I don't have the spare time to
do it and I can't see my employer paying me to do it.
--
Bob Silverman
These are my opinions and not MITRE's.
Mitre Corporation, Bedford, MA 01730
"You can lead a horse's ass to knowledge, but you can't make him think"
Newsgroups: comp.arch,comp.unix.bsd,comp.os.linux