<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jan 15, 2010, at 1:24 AM, Morten Ofstad wrote:</div><div><br></div><blockquote type="cite"><div>I think the main issues are:<br><br>1) special values (+0, -0, NaN, +Inf, -Inf) to be taken into account<br>- this can be represented with an 'assume_finite' bit and an 'assume_no_signed_zero' bit<br></div></blockquote><div><br></div><div>Sounds right to me.</div><br><blockquote type="cite"><div>2) rounding, the x86 FPU has 80 bits of internal precision, so you get inconsistent results depending<br>on intermediate results being spilled or being kept in registers. One usual way of handling this is<br>that any assignment in the source code will truncate to the memory representation, while intermediate<br>results in an expression are allowed to be kept at 80 bits precision (i.e. frontend decides which operations must be rounded).<br>- this can be represented with a 'exact_precision' bit<br></div></blockquote><div><br></div><div>Does LLVM even support generating float and double arithmetic on x87? Certainly the default should be to use SSE/SSE2 and avoid this problem entirely. If legacy x87 codegen is supported, it would be nice to have float-store be the default behavior, and require a flag "-fnon-portable-extra-precision" or something similarly menacing to enable the other behavior.</div><br><blockquote type="cite"><div>3) exceptions, you might need to have the right number of exceptions triggered in the right order so basically no optimizations are allowed.<br>- this can be represented with a 'trapping_math' and/or 'signaling_NaN' bit, or maybe it can be encoded as 'no_reorder' 'no_duplicate'<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><div><br></div>Some reordering should be inhibited not only by trapping math, but also by the default IEEE-754 exception handling (nonstop execution with status flags), at least when <span class="Apple-style-span" style="font-family: Courier; font-size: 12px; "><b>#pragma STDC FENV_ACCESS ON </b></span>is active. If the reordering affects only the order in which flags could be raised, and not which flags could be raised, then it could be allowed with the default exception handling.</div><div><br></div><div>- Steve</div></body></html>