Real.maxFinite and friends

Matthew Fluet fluet@CS.Cornell.EDU
Fri, 5 Oct 2001 10:39:31 -0400 (EDT)


> So, this leads to some questions about what happens when isNormal and
> isFinite are made primitives.  I currently don't have a natural way of
> forcing a value out of a register at the point where I translate
> primitives.  And, for the most part, that isn't completely necessary.
> What I imagine I would do would be to translate isNormal(X) is to copy X
> to a temporary location then access the high word of the temporary
> location.  That will force the float to be written to memory and then read
> into a gpr; but it may well leave X in the floating point register if
> there are future uses.  

There is one other alternative, which is to directly access the high word
of the float, which requires some changes to the way I'm representing
memory locations, but was something I had in mind for the future with 64
bit integers.  This has one advantage over the above; namely, if the float
is already in memory then we don't need to bounce it to the temporary
location to fetch it's bits.  (e.g., acessing a float that was computed
before a non-tail call; during the call, it will be on the stack, so on
return, to check normality, we don't need to load it into the FPU and
store it to the other temporary).  But, this doesn't really solve the
above problem, because the use of a memory location that aliases a memory
location in the FPU causes it to be written to memory, but not necessarily
removed from the FPU.  That would only occur if there were a def of a
memory location aliased by a memory loc in the FPU.  

Anyways, the whole point being that the natural way of doing isNormal and
isFinite may lead to strange semantics.  Furthermore, it will break the
hack in real7.sml -- although, that was a hack anyways.