<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>Hi all,</p>
<p>I'm playing with intrinsics and I was wondering how to lower an intrinsic that should return, for example, an int1? More precisely, how to return the value when working with MachineInst?</p>
<p> </p>
<p>First, I have defined an instrinsic in "Intrinsics.td":</p>
<p><em>def int_antivm : Intrinsic<[llvm_i1_ty], [], [], "llvm.antivm">;</em></p>
<p> </p>
<p>Then I want to lower it in the X86 backend, so I defined a pseudo instruction in "X86InstrCompiler.td":</p>
<p><em>let usesCustomInserter = 1, Defs = [EFLAGS] in {</em><br /><em>def ANTIVM : PseudoI<(outs), (ins), [(int_antivm)]>;</em><br /><em>}</em></p>
<p> </p>
<p>I wrote my custom inserter:</p>
<p><em>MachineBasicBlock *</em><br /><em>X86TargetLowering::EmitANTIVMWithCustomInserter(</em><br /><em>    MachineInstr *MI,</em><br /><em>    MachineBasicBlock *MBB) const {</em><br /><br /><em>  // Some stuff, </em><br /><br /><em>  MI->eraseFromParent(); // The pseudo is gone now.</em><br /><em>  return BB;</em><br /><em>}</em></p>
<p>Should I put the return value to EAX (like for a standard function) ?</p>
<p> </p>
<p>Thank you for your help.</p>
<div> </div>
<div> </div>
<div> </div>
</body></html>