<div dir="ltr">This intrinsic seems very ill-defined, apparently it can be freely reordered and does _not_ act like a compiler barrier. [1]<div>Other than source compatibility, why would one want this intrinsic?  What semantics is it supposed to give?<br>
<div><br></div><div>[1] <<a href="http://connect.microsoft.com/VisualStudio/feedback/details/691456/-readeflags-intrinsic-can-be-reordered-by-the-compiler">http://connect.microsoft.com/VisualStudio/feedback/details/691456/-readeflags-intrinsic-can-be-reordered-by-the-compiler</a>></div>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 17, 2013 at 11:00 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I don't know enough about LLVM CodeGen to answer your questions.  I'm just curious.<div><br></div>
<div>What is the intended level of support for these intrinsics?  Are they for reading ALU flags like CF, OF, etc, or for seldom changed control flags like TF and AC?  Even DF is typically scratch, and could be used for an -Oz memmove lowering for example.</div>

<div><br></div><div>I don't think LLVM will ever really support capturing ALU flags from previous ops without "using" the operation.  LLVM does have overflow intrinsics though:</div><div><a href="http://llvm.org/docs/LangRef.html#id1164" target="_blank">http://llvm.org/docs/LangRef.html#id1164</a><br>

</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Dec 17, 2013 at 1:02 AM, Alexey Volkov <span dir="ltr"><<a href="mailto:avolkov.intel@gmail.com" target="_blank">avolkov.intel@gmail.com</a>></span> wrote:<br>

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hello all,<div><br></div><div>I am trying to implement intrinsics __readeflags and __writeeflags reading and writing EFLAGS register on x86.</div>

<div>These intrinsics expand to two instructions popf and push to register for __readeflags and pushf and pop to register for __writeeflags.</div>
<div>These instructions are not connected explicitly so I can't use patterns in .td file to match intrinsics.</div><div><br clear="all"><div>I tried to implement custom expansion making COPY DAG node with copy from EFLAGS to register.</div>


<div>But this solution works only at -O0 level and failed at -O1 and higher: the problem is that Post-RA pseudo instruction expansion pass seems to be called only at -O0.</div><div><br></div><div>Another way is to expand intrinsics to DAG nodes for each PUSH, POP, PUSHF and POPF instructions.</div>


<div>This will add 4 new X86ISD types for DAG nodes for these instructions.</div><div><br></div><div>What is the proper way to expand these intrinsics?</div><span><font color="#888888"><div><br></div>-- <br>
<div dir="ltr">Alexey Volkov<div>Intel Corporation</div>
</div>
</font></span></div></div>
<br></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>