<div dir="ltr">We have intrinsic versions of the floating point instructions to suppress optimizations that are unsafe when exceptions are enabled. <a href="https://llvm.org/docs/LangRef.html#constrained-floating-point-intrinsics">https://llvm.org/docs/LangRef.html#constrained-floating-point-intrinsics</a> Currently I think it prevents nearly all optimizations.<div><br></div><div>Clang should emit these for some targets like X86 when it sees #pragma STDC FENV_ACCESS. Clang can only do this for targets that have implemented proper support for the constrained intrinsics in the backend.<br><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 6, 2021 at 2:26 AM raghesh 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi All,<div><br></div><div>We would like to prevent certain optimizations (like hoisting an fdiv instruction) when the application has set the floating point environment flags using APIs like<br><a href="https://en.cppreference.com/w/cpp/numeric/fenv/feraiseexcept" title="cpp/numeric/fenv/feraiseexcept" style="background-image:none;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;color:rgb(250,167,0);font-family:DejaVuSansMono,"DejaVu Sans Mono",courier,monospace;font-size:12.8px;font-variant-ligatures:no-common-ligatures;font-weight:700;white-space:nowrap" target="_blank"><span style="display:inline">feraiseexcept</span></a>  or if it uses <span style="color:rgb(0,0,0);font-family:DejaVuSans,"DejaVu Sans",arial,sans-serif;font-size:12.8px;font-variant-ligatures:no-common-ligatures"> </span><a href="https://en.cppreference.com/w/cpp/preprocessor/impl" title="cpp/preprocessor/impl" style="color:rgb(250,167,0);background-image:none;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:DejaVuSans,"DejaVu Sans",arial,sans-serif;font-size:12.8px;font-variant-ligatures:no-common-ligatures" target="_blank"><tt style="font-family:DejaVuSansMono,"DejaVu Sans Mono",courier,monospace">#pragma STDC FENV_ACCESS</tt></a>.</div><div><br></div><div>Is there any way to know this at LLVM-IR level?</div><div><br></div><div>Regards,</div><div>Raghesh</div><div><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>------------------------------</div><div>Raghesh Aloor</div><div>AMD India Pvt. Ltd.</div><div>Bengaluru.</div><div>------------------------------</div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>