<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 9, 2021, 11:58 Kevin Neal via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="m_-3498996995618036139WordSection1">
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546a">Yes, true.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546a">This came up in the context of adding support for the constrained FP intrinsics. These intrinsics all include a metadata argument for specifying how important FP traps are. If traps
are “strict” then we can’t fold away any traps. The default FP environment would use “ignore” where there are no traps and folding is fine. I’m working on the “maytrap” case where we can eliminate traps but cannot introduce any new ones. More on constrained
intrinsics: <a href="https://llvm.org/docs/LangRef.html#constrained-floating-point-intrinsics" target="_blank" rel="noreferrer">
https://llvm.org/docs/LangRef.html#constrained-floating-point-intrinsics</a></span></p></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Afaict converting SNaN inputs to QNaN should be fine for maytrap, excluding, of course, things like fneg and copysign that just manipulate bits. If LLVM wants to guarantee correct NaN bits in the output, be aware that some platforms have special cases for SNaN -> QNaN: RISC-V always produces the canonical NaN, MIPS pre-2008-mode has the quiet bit inverted from the usual, so a SNaN mantissa with a 1 MSB and the rest zeros needs to adjust the mantissa to avoid generating an infinity instead of a QNaN.</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word"><div class="m_-3498996995618036139WordSection1"><p class="MsoNormal"><span style="font-family:"Courier New";color:#44546a"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546a"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546a">To be clear, are you saying that my interpretation of 754 is correct?</span></p></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Yes, afaict. I'd suggest waiting for someone else to also check this since we may be missing some special case...</div><div dir="auto"><br></div><div dir="auto">Jacob</div></div>