<div dir="ltr"><div><div>I am currently working on DAGToDAGISel class for MIPS and am trying to
figure out a way to use INTRINSIC_W_CHAIN for an intrinsic which can return a value.<br><br></div><div>My intrinsic is defined as:<br> Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_i32_ty,llvm_i32_ty,llvm_i32_ty],[IntrReadWriteArgMem]>;<br></div><div>i.e. it has four arguments and one return value<br></div><div><br></div><div>In DAGToDAGISel when I try to pass it with four arguments and a return register it fails the assertion `ResNo < NumValues && "Illegal result number!"'.<br><br></div><div>More specifically I am doing something like:<br> EVT ReturnValueVT = Node->getValueType(0) ;<br> SDValue ChainIn = Node->getOperand(0);<br> SDValue Zero = CurDAG->getCopyFromReg(ChainIn, DL,<br> Mips::ZERO, MVT::i32);<br> SDValue op0 = Node->getOperand(2);<br> SDValue op1 = Node->getOperand(3);<br> SDValue op2= Node->getOperand(4);<br> SDValue op3 = Node->getOperand(5); <br> SDValue Ops[]= { op0, op1, op2, op3, Zero, ChainIn };<br> SDNode *Result = CurDAG->getMachineNode(Mips::BWT_DROP_RESULT, SDLoc(Node), <br> ReturnValueVT, Ops);<br> ReplaceUses(Node, Result); <br> return std::make_pair(true, Result); <br><br></div></div><div>Any clues on how INTRINSIC_W_CHAIN differs from INTRINSIC_VOID?<br><br></div><div>Thanks,<br></div>Ambuj Agrawal<br></div>