Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!news.cs.indiana.edu!news.nd.edu!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin From: hrubin@pop.stat.purdue.edu (Herman Rubin) Newsgroups: comp.arch Subject: Re: Unusual instructions and constructions Message-ID: <7571@mentor.cc.purdue.edu> Date: 10 Mar 91 14:53:44 GMT References: <7499@mentor.cc.purdue.edu> <4748@eastapps.East.Sun.COM> Sender: news@mentor.cc.purdue.edu Lines: 49 In article <4748@eastapps.East.Sun.COM>, gsteckel@vergil.East.Sun.COM (Geoff Steckel - Sun BOS Hardware CONTRACTOR) writes: > In article <7499@mentor.cc.purdue.edu> hrubin@pop.stat.purdue.edu (Herman Rubin) writes: > >There clearly is a major disagreement on what "should" be in an architecture > >or language. One of the arguments given against including assembler code is > >that compiler optimization is at least made more difficult, and portability is > >lost. > > One thing lost in the recent debate is the possibility of applying `object' > methodology to the complex operation debate. The C language already has > the ability to return a structure from a function; the `divrem' function > could return struct div_and_rem { int quotient ; int remainder } ; > > C++ (admitting its many faults) can implement this sort of operation easily. ........................... These suggestions are not enough, for two reasons. Structs are not adequate for two reasons. One is that the results need not be stored, but frequently, possibly even predominately, they should be kept in registers for proximate use. The other is that struct is too clumsy, as there is no automatic reason (although in some cases hardware may do it for simplicity) to assign adjacent locations for the results. Despite some formal similarities, a list is not a struct. Some examples of this are dividing float by float with an integer quotient and a floating remainder, which is a widely used operation, and the frexp function in C, which writes a float as as one whose magnitude is in [.5,1) and puts the power of 2 into a memory location y = frexp(x,&n) instead of y,n = frexp(x) The other is notation. I see not good reason why I should not be able to write q,r = a/b for both the integer and the floating case, with q being the integer quotient in both cases. I would like to write exp,mant =UP x, where exp is the exponent and mant the mantissa for the floating point x, etc. -- Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399 Phone: (317)494-6054 hrubin@l.cc.purdue.edu (Internet, bitnet) {purdue,pur-ee}!l.cc!hrubin(UUCP)