<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">We (C, C++, and LLVM) are generally moving towards supporting FP as a first-class thing with all atomic operations †, including cmpxchg. It’s indeed *usually* specified as a bitwise comparison, not a floating-point one, although IIRC AMD has an FP cmpxchg. Similarly, some of the operations are allowed to have separate FP state (say, atomic add won’t necessarily affect the scalar FP execution’s exception state, might have a different rounding mode, etc).<div class=""><br class=""></div><div class="">I’m OK with MLIR matching the current state of LLVM, but I want to point out that the docs might be incorrect, or are expected to change in the future.<br class=""><div class=""><br class=""></div><div class=""><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">† See </span><font color="#000000" class=""><span style="caret-color: rgb(0, 0, 0);" class=""><a href="http://wg21.link/p0020" class="">http://wg21.link/p0020</a> as well as </span></font>r360421 D58251 D50491 D26266 D26266 r264845 D15471</div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 14, 2020, at 6:15 AM, Nicolai Hähnle via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">We've relaxed `atomicrmw xchg` to support floating point types but not<br class="">cmpxchg -- the cmpxchg comparison behavior is not a floating point<br class="">comparison, so that would be potentially misleading. I'd say adding<br class="">the assertion is a good idea.<br class=""><br class="">Cheers,<br class="">Nicolai<br class=""><br class="">On Thu, Aug 13, 2020 at 10:59 PM Chris Lattner via llvm-dev<br class=""><<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""><blockquote type="cite" class=""><br class="">Does the code generator support this?  If not, we should add an assertion to the verifier.  If so, we can consider relaxing langref or making it more specific about floats.<br class=""></blockquote></div></div></blockquote><div><br class=""></div><div>I agree with this. Generally it’s a bit tricky because, some of these are tied to the atomic expand pass, where a backend says what it supports.</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><blockquote type="cite" class="">-Chris<br class=""><br class="">On Aug 13, 2020, at 6:35 AM, Alex Zinenko via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""><br class="">Hi LLVM-dev,<br class=""><br class="">when working on MLIR-to-LLVM-IR conversion, I noticed that it is possible to programmatically construct a cmpxchg instruction operating on floats (or actually any type since there is no assertion on pointer element type here <a href="https://github.com/llvm/llvm-project/blob/9c2e708f0dc547d386ea528450a33ef4bd2a750b/llvm/lib/IR/Instructions.cpp#L1501" class="">https://github.com/llvm/llvm-project/blob/9c2e708f0dc547d386ea528450a33ef4bd2a750b/llvm/lib/IR/Instructions.cpp#L1501</a>), but LangRef specifies that only integers and pointers are accepted (<a href="https://llvm.org/docs/LangRef.html#cmpxchg-instruction" class="">https://llvm.org/docs/LangRef.html#cmpxchg-instruction</a>). Does somebody rely on other types being accepted in cmpxchg or should we add an assertion for the element type to match the LangRef?<br class=""><br class="">--<br class="">Alex<br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""><br class=""><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class="">llvm-dev@lists.llvm.org<br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></blockquote><br class=""><br class=""><br class="">-- <br class="">Lerne, wie die Welt wirklich ist,<br class="">aber vergiss niemals, wie sie sein sollte.<br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></div></blockquote></div><br class=""></div></div></body></html>