home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!purdue!sample.eng.ohio-state.edu!cis.ohio-state.edu!news.sei.cmu.edu!firth
- From: firth@sei.cmu.edu (Robert Firth)
- Newsgroups: comp.arch
- Subject: Re: SPARC Floating Point Query
- Message-ID: <1992Sep9.171204.24907@sei.cmu.edu>
- Date: 9 Sep 92 17:12:04 GMT
- References: <1992Sep9.135913.12073@gdr.bath.ac.uk>
- Organization: Software Engineering Institute
- Lines: 51
-
- In article <1992Sep9.135913.12073@gdr.bath.ac.uk> masjpf@gdr.bath.ac.uk (J P Fitch) writes:
- >Can anyone throw any light on the following aspect of the SPARC?
-
- fdivd %f0,%f2,%f4 <<< Note well
-
- ** fmovs %f4,%f4 ** added by Assembler
-
- fdtoi %f4,%f5
- st %f5,[%sp+LP12]
-
- [a heap of monstrously bloated and stupendously bad generated code
- deleted, since I don't want to see it again and I'm sure you don't]
-
- I suspect the answer is to be found in the Sparc Architecture manual,
- section C.6, which deals with the issues of floating point execution.
- The processor can execute one or more Fp ops concurrently, which raises
- the issue of when this is safe. The spec I have seems to be wrong, ie
- it does not accurately describe the behaviour of the machine, but what
- *seems* to be the case [Warning - I may be wrong!] is that
-
- if an FP op is executing, that uses a register %fx, and
- a new FP instruction is fetched, that makes a conflicting
- use of %fx, then the new instruction will be delayed until
- the earlier completes, IF the new instrcution is a load,
- store, or move (plus some special cases not germane).
-
- Thus, these are safe:
-
- fadd %f0,%f2,%f2
- ld [src],%f0 ; will delay until fadd no longer needs %f0
-
- fadd %f0,%f2,%f4
- st %f4,[dest] ; will delay until fadd writes to %f4
-
- But this is unsafe:
-
- fdivd %f0,%f2,%f4
- fdtoi %f4,%f5
-
- since the second instruction is allowed to start before the first completes.
-
- The assembler seems to be solving this problem by inserting a dummy move:
-
- fdivd %f0,%f2,%f4
- fmovs %f4,%f4
-
- to force completion of the divide. Whether this is necessary depends on
- how many instructions your FPU can execute concurrenyly - if that number
- is one, you can get away without the fmov.
-
- Sigh. sunt lacrimae rerum.
-