<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Le 28.04.2015 16:55, Mehdi Amini a écrit :</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div>
<blockquote class="">
<div class="">
<div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<div class="">Yes the first operands are the destinations (MI can produce multiple values).</div>
<div class=""> </div>
<div class="">The instruction selector will always use a vreg to select your instruction, you don't have anything to do.</div>
<div class="">The custom inserter is executed before register allocation, and it is the role of the RA to turn the vreg into a physical one, </div>
<div class=""> </div>
<div class="">The physical registers that you can see at this point are mainly here to implement the ABI AFAIK.</div>
</div>
</div>
</blockquote>
<div> </div>
<div> </div>
</div>
I should also add that I don't know what you're trying to achieve, but keep in mind that some scheduling and optimizations will run after this point.
<div class="">Depending on the end result you are seeking, you might need to your expansion later.</div>
<div class=""> </div>
</blockquote>
<p>Thank's a lot, it nearly works !</p>
<p> </p>
<p>My intrinsics now:</p>
<p><em>def int_antivm2 : Intrinsic<[llvm_i8_ty], [llvm_ptr_ty], [], "llvm.antivm2">;</em></p>
<p> </p>
<p>My "backend" intrinsics:</p>
<p><em>let usesCustomInserter = 1, isPseudo = 1, Defs = [EFLAGS, EAX, ECX, EDX, EBX] in {</em><br /><em>def ANTIVM : PseudoI<(outs GR8:$dst), (ins i32mem:$src), [(set GR8:$dst, (int_antivm2 addr:$src))]>;</em><br /><em>}</em></p>
<p> </p>
<p>As I understand ANTIVM:</p>
<p>- It returns an int8 into a one byte register (<em>GR8</em>)</p>
<p>- It receives a pointer stored on memory (<em>i32mem</em>)</p>
<p>- <em>[(set GR8:$dst, (int_antivm2 addr:$src))]</em> match two DAGNode that corresponds to  <em>int_antivm2</em> translation into SelectionDAG node</p>
<p>Am I right? I constructed both by try-and-error based on example I found here and there.</p>
<p> </p>
<p>Seems to work well when returning a <em>llvm_i8_t</em>y but I got a "PromotionInteger error" with <em>llvm_i1_ty</em>. I tried to also change "GR8" to "VK1" (seems to be a register of one bit) in the second one, but without success. Any idea?</p>
<p> </p>
<p> </p>
<div> </div>
</body></html>