<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Courier New";
        color:#44546A;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546A">I’m already working on support for target-specific handling.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546A"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546A">I like the idea of target-specific disabling of the relevant options. I do think a warning is appropriate since this is a _<i>correctness</i>_ issue, and also because the options can
 be triggered indirectly like Cameron showed.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546A"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546A">The target-specific parts in clang itself that need to be done are very small, and as far as I know are confined to CGBuiltins.cpp. So I don’t think that any new options need to be added
 for developer use. Testing is an issue, but X86 and SystemZ are in such good shape that clang tests for anything else besides builtins can test on one of those two targets.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";color:#44546A"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Nemanja Ivanovic <nemanja.i.ibm@gmail.com> <br>
<b>Sent:</b> Thursday, April 23, 2020 10:01 AM<br>
<b>To:</b> cameron.mcinally@nyu.edu<br>
<b>Cc:</b> Kevin Neal <Kevin.Neal@sas.com>; Clang Dev <cfe-dev@lists.llvm.org><br>
<b>Subject:</b> Re: [cfe-dev] Warning for partially implemented options/pragmas?<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><b><i><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:red">EXTERNAL</span></i></b><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:red">
</span><o:p></o:p></p>
<div>
<div>
<div>
<p class="MsoNormal">I think it would be quite useful to add this in the front end. The way I envision this working is that targets would specify whether they support constrained FP intrinsics. If this flag is unset, it would cause the front end to do two things:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">1. Warn the user that the mode is not supported for the target<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">2. Ignore the option and not generate the constrained FP intrinsics<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This should additionally be coupled with a temporary option for developers to use to aid in developing support for the intrinsics.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Something like: <span style="font-family:"Courier New"">-ftrapping-math-on-unsupported-target
</span>and <span style="font-family:"Courier New"">-frounding-math-on-unsupported-target</span>.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Thu, Apr 16, 2020 at 4:19 PM Cameron McInally via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">On Thu, Apr 16, 2020 at 4:01 PM Kevin Neal via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>
> Bug 45329 “segfault with frounding-math” “<a href="https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.llvm.org%2Fshow_bug.cgi%3Fid%3D45329&data=02%7C01%7CKevin.Neal%40sas.com%7Cba3a9bfacc8b4357359c08d7e78ec522%7Cb1c14d5c362545b3a4309552373a0c2f%7C0%7C0%7C637232472689586464&sdata=SwcDG7o7Yj1Fj8474IhK4gJQPHV4zBLp1%2BIMAynBIyY%3D&reserved=0" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=45329</a>”
 highlights that we are silently allowing people to use options that are unimplemented or only partially implemented.<br>
><br>
> If use the -frounding-math option on a compile I expect it to work. I do not expect it to trigger an ICE, a crash, or much worse silently not work and produce wrong results.<br>
><br>
> I propose a warning be printed so that we can avoid issues like bug 45329 in the future. And it needs to be per-target since some targets are closer to supporting this feature than others.<br>
><br>
> Thoughts?<br>
<br>
Thanks for bringing this up, Kevin.<br>
<br>
We have a customer code that has been using<br>
`-fno-unsafe-math-optimizations` for some time. That option implies<br>
`-ftrapping-math`, which was a no-op until a few months ago. Now,<br>
`-ftrapping-math` enables the constrained FP intrinsics, which aren't<br>
fully supported on all targets. That behavior change looked like a<br>
regression to the customer.<br>
<br>
A warning would be a good short-term solution.<br>
<br>
-Cameron<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fcfe-dev&data=02%7C01%7CKevin.Neal%40sas.com%7Cba3a9bfacc8b4357359c08d7e78ec522%7Cb1c14d5c362545b3a4309552373a0c2f%7C0%7C0%7C637232472689586464&sdata=6LBuXTtD3tCXx76neWabT37uv3a8bqKE8Qdu%2FD%2Fzphs%3D&reserved=0" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</body>
</html>