Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!tut.cis.ohio-state.edu!sei!fs7.ece.cmu.edu!o.gp.cs.cmu.edu!ram From: ram+@cs.cmu.edu (Rob MacLachlan) Newsgroups: comp.arch Subject: Re: bizarre instructions Message-ID: <1991Feb27.162528.7290@cs.cmu.edu> Date: 27 Feb 91 16:25:28 GMT References: <9102220245.AA14853@ucbvax.Berkeley.EDU> <6728@mentor.cc.purdue.edu> Sender: netnews@cs.cmu.edu (USENET News Group Software) Organization: School of Computer Science, Carnegie Mellon Lines: 37 >From: hrubin@pop.stat.purdue.edu (Herman Rubin) >Newsgroups: comp.arch,comp.lang.misc >Subject: Re: bizarre instructions >Summary: Syntax changes would be needed >Date: 24 Feb 91 18:18:53 GMT > >> A sufficiently intelligent compiler will do the right thing. It may >> work to write >> k8=i4*j4 > >The first approach would require a very intelligent compiler, indeed. >The second approach is the "right" one. However, every standard I have >read would try the first. Since i8*j8 might not even exist on the machine, >at best an inlined function would have to be brought in instead of the >single hardware instruction for k8=i4*j4. > >I have never seen any language description in which the type of the result >in a replacement statement affected what operation is performed. Actually, this use of output type information to select operators is relatively common in Lisp compilers, especially Common Lisp. It is necessitated by the default assumption of indefinite-precision arithmetic. In order to do fixed precision, you must somehow know the result is a "small" integer. The CMU Common Lisp compiler (Python) is (so far as I know) unique among Lisp compilers in efficiently compiling full-word integer arithmetic (no tag bits). And our BIGNUM code is implemented with this facility combined with some additional primitives such as 32x32 -> 64. The 64 bit result is returned as two 32 bit values, using the Common Lisp multiple value mechanism. It would be relatively straightforward to add support for larger fixed-precision arithmetic. Robert A MacLachlan (ram@cs.cmu.edu)