Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "FP precision conv" with no floats in sight




On Oct 30, 2004, at 5:14 AM, Holger Bettag wrote:


"Notice that if the value to be stored by a single-precision store
floating-point instruction is larger in magnitude than  [MAX_FLOAT],
the result stored in WORD is then a well-defined value, but is not
numerically equal to the value in the source register."

In other words, 'stfs' doesn't correctly handle values greater than
MAX_FLOAT, so the 'frsp' is required to ensure that 'stfs' will always
do the right thing.

I would read that differently. Values greater than MAX_FLOAT can simply
not be represented as a single precision float, so both 'frsp' and 'stfs'
must replace the true value with +infinity.


Holger

Perhaps, but the condition "is not numerically equal" would be true for any double-precision value not exactly representable in single-precision (not just those greater than MAX_FLOAT), so why would the description single out large values specifically? (My initial read was that the conversion simply ignored the high bits of the exponent, which would create a problem for both very large and very small values.)


Another observation: The 'stfs' instruction does not appear to set overflow/underflow flags when it rounds -- this would cause a problem for code that depends on those flags, so the 'frsp' may be necessary after all for those purposes.

Regardless, if OSX no longer supports whichever buggy processors it were that Jonas mentioned, it would be nice to have a compiler option that would get rid of those 'frsp's. And for the 'fabs' case, it's practically an optimizer bug not to get rid of the frsp, I would think.

Ben

_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/email@hidden

This email sent to email@hidden
References: 
 >"FP precision conv" with no floats in sight (From: "James W. Walker" <email@hidden>)
 >Re: "FP precision conv" with no floats in sight (From: John Stiles <email@hidden>)
 >Re: "FP precision conv" with no floats in sight (From: "James W. Walker" <email@hidden>)
 >Re: "FP precision conv" with no floats in sight (From: Chris Cox <email@hidden>)
 >Re: "FP precision conv" with no floats in sight (From: Jonas Maebe <email@hidden>)
 >Re: "FP precision conv" with no floats in sight (From: Ben Weiss <email@hidden>)
 >Re: "FP precision conv" with no floats in sight (From: Holger Bettag <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.