If we are talking practicabilities, then things are very different, and expecting repeatable results in real programs is crying for the moon. But we have been there before, and let's not go there again.
Maybe I should have explained why I was asking those questions.I work with people in industry who build embedded systems (using PowerPCs, for instance). Testing programs on the embedded system itself, or rather a hardware simulator thereof, is possible, but needs fairly bulky, fragile and expensive hardware. For many purposes, software simulation would be enough. One of their requirements, though, is that simulators should output the exact same values as the simulated hardware.
Now, one can validly argue that it is silly to expect absolute repeatable floating-point behavior. Yet, it is probably much easier for these industry folks to order a simulator that absolutely mimics a PowerPC than to request a waiver from this requirement.
They have requested my input on how to do this properly.Since we're looking at assembly-level code we do not have to worry about funny business in compilers or libraries. (In the past I had warned them about possible issues between C source and what actually happens on the FPU.)
The good thing is that, as far as I understand, their programs:* Trap on overflow and invalid operations, so I don't have to worry about different FPUs putting different things inside the NaNs they generate.
* Do not look at FPU flags except for vanilla comparisons. * Use round to nearest. * Do not set the FPU to nonconformant modes.Given those constraints, I'm lead to believe that the same computations run on PowerPC and Intel SSE would give the same results (either the same floating point value, either an overflow or invalid operation trap). This is what I'd like to confirm.
Michel is right to point to FMA, which is available on PowerPC but won't be available on Intel until 2011, I heard. We'll have to look into this one - I believe Sylvie Boldo has a way to implement it not too costly using only *, +, and - and round to nearest. Also, PowerPC has over operators if I remember correctly, such as inverse of square root....
-- DM
Attachment:
David_Monniaux.vcf
Description: Vcard