Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!iuvax!pur-ee!j.cc.purdue.edu!k.cc.purdue.edu!l.cc.purdue.edu!cik From: cik@l.cc.purdue.edu (Herman Rubin) Newsgroups: comp.lang.c,comp.misc Subject: Re: 32bit = 16bit x 16bit (Really: Compiler deficiencies) Message-ID: <593@l.cc.purdue.edu> Date: Sat, 24-Oct-87 09:23:25 EST Article-I.D.: l.593 Posted: Sat Oct 24 09:23:25 1987 Date-Received: Wed, 28-Oct-87 05:25:35 EST References: <141@kesmai.COM> 7349@alice.UUCP <146MAXHAM@RICE> Organization: Purdue University Statistics Department Lines: 30 Summary: This is a problem with HLL Xref: mnetor comp.lang.c:5147 comp.misc:1531 In article <146MAXHAM@RICE>, MAXHAM@RICE.BITNET (Mark Maxham) writes: > But the 68000 MULS and MULU commands multiply two sixteen bit words > into a 32 bit longword. Thus they are defined. Is the question > how C translates from multiplicitive expressions into actual machine > instructions? > > Mark Maxham maxham@icsa.rice.edu > A general problem with HLL's is that they do not have the necessary flexibility to handle situations like this. I do not know of any language which has in its operation list an operation to multiply two 16 bit object and get a 32 bit object. (Note: I am using the term "object" because what is called a word, longword, etc., differs from machine to machine.) On many machines, this would have to be done by the portable method of converting the 16 bit objects to 32 bits, but the possessor of a machine which can do the operation directly should not have to go to such lengths to achieve the results. How about the related problem of multiplying two 32 bit objects and getting a 64 bit object? Other than inserting assembler instructions, which may involve such problems as not knowing where the (expletive deleted) compiler has decided to locate the objects, I see no way to do this in any HLL. I know of no way to tell the compiler that here is an operation with a given syntax, and the compiler should put it in its set of operations. If the syntax is different from other syntaxes for that operator, the compiler should perform the overloading. It is clear that the languages need more flexibility and that the gurus who claim that they have the solutions are wrong. -- Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907 Phone: (317)494-6054 hrubin@l.cc.purdue.edu (ARPA or UUCP) or hrubin@purccvm.bitnet