Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!sundc!hqda-ai!merlin From: merlin@hqda-ai.UUCP (David S. Hayes) Newsgroups: comp.arch Subject: Re: How does compiled code use the floating point unit? Message-ID: <164@hqda-ai.UUCP> Date: Mon, 8-Dec-86 09:36:22 EST Article-I.D.: hqda-ai.164 Posted: Mon Dec 8 09:36:22 1986 Date-Received: Mon, 8-Dec-86 21:04:53 EST References: <394@houxs.UUCP> Organization: Army AI Center, Pentagon Lines: 38 Summary: Sun-2 replaced OS trap at execution time. In article <394@houxs.UUCP>, daw@houxs.UUCP (D.WOLVERTON) writes: > In some systems, the hardware floating point (fp) unit is _optional_. > 4) Code generation emits code which always causes transfer to the > OS, e.g. by illegal opcodes or TRAP instructions. The OS then > proceeds like (3a) or (3b) above except that the fp unit may be used > if present. > > Are there other scenarios in use? According to my memory, (which operates on fuzzy logic :-), the Sun-2 had several different optional FPU boards. The compiler would generate code that always trapped to the OS. Then: No FPU: OS calls a subroutine to do the work. FPU: OS replaces the user instruction (a 68010 TRAP) with the equivalent hardware instruction. The user program is then restarted at the new instruction, which now causes the FPU to do the work. I like this scheme. The overhead of going into the OS is only paid once (assuming you actually have a FPU). Once the OS changes the TRAP instruction, further FP work goes directly to the hardware, without software intervention. Of course, this had to be done once to each different FP instruction. In a large program, that could take a while. On the other hand, the most popular instructions should be replace fairly quickly. Anyone (particularly old Sun engineers) care to correct my memory? -- David S. Hayes, The Merlin of Avalon PhoneNet: (202) 694-6900 ARPA: merlin%hqda-ai@brl UUCP: ...!seismo!sundc!hqda-ai!merlin