Matt, This seems to generate llvm.my_intrinsic just fine in the DAG, so no DAG errors; however, it won't match. For example, if I call the intrinsic from C, the DAG node looks to be named the same in dotty file but it won't match... am I missing something? I've done it exactly the way it was done above. The DAG looks great but it won't match. Did I miss something? Thanks. On Tue, Feb 2, 2016 at 2:47 PM, Matt Arsenault <arsenm2 at gmail.com> wrote:> > On Feb 2, 2016, at 11:27, Ryan Taylor <ryta1203 at gmail.com> wrote: > > Matt, > > Is this an example you are talking about: > > LoadedVect = DAG.getNode > <http://llvm.org/docs/doxygen/html/classllvm_1_1SelectionDAG.html#ab02868bea897db34232413f1929ade1d> > (ISD::INTRINSIC_WO_CHAIN > <http://llvm.org/docs/doxygen/html/namespacellvm_1_1ISD.html#a22ea9cec080dd5f4f47ba234c2f59110ac771b9cda3b889242d457cc4d9b2159c>, > dl, MVT::v4f64, > DAG.getConstant > <http://llvm.org/docs/doxygen/html/classllvm_1_1SelectionDAG.html#adf7343dcb7fff67cf516abca4c1d6793>(Intrinsic::ppc_qpx_qvfcfidu, > dl, MVT::i32), > LoadedVect); > > Something like this? > > > Yes >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160202/3dfc6af6/attachment.html>
> On Feb 2, 2016, at 12:43, Ryan Taylor <ryta1203 at gmail.com> wrote: > > Matt, > > This seems to generate llvm.my_intrinsic just fine in the DAG, so no DAG errors; however, it won't match. For example, if I call the intrinsic from C, the DAG node looks to be named the same in dotty file but it won't match... am I missing something? > > I've done it exactly the way it was done above. The DAG looks great but it won't match. Did I miss something? > > Thanks. >Are you using the right intrinsic type? Does it have a chain or result? How are you calling it from C? Are you declaring the intrinsic? This can fail if you mismatched the readnone or readonly to the actual intrinsic definition
Matt, Here's the DAG code: Op is the SDValue incoming (the node I want to lower). SDValue result = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, SDLoc(Op), Op.getValueType(), DAG.getConstant(Intrinsic::my_intrinsic, SDLoc(Op), Op.getValueType()), Op.getOperand(0)); The type of the intrinsic call is the same as the type of Op, hence I'm using Op.getValueType() For the C code, I'm simply calling __builtin_myIntrinsic, where __builtin_myIntrinsic has been added to the appropriate files in clang and llvm and this maps down to the table gen just fine (we have lots of other intrinsics working the same way but we've never done it directly in DAG). On Tue, Feb 2, 2016 at 3:55 PM, Matt Arsenault <arsenm2 at gmail.com> wrote:> > > On Feb 2, 2016, at 12:43, Ryan Taylor <ryta1203 at gmail.com> wrote: > > > > Matt, > > > > This seems to generate llvm.my_intrinsic just fine in the DAG, so no > DAG errors; however, it won't match. For example, if I call the intrinsic > from C, the DAG node looks to be named the same in dotty file but it won't > match... am I missing something? > > > > I've done it exactly the way it was done above. The DAG looks great > but it won't match. Did I miss something? > > > > Thanks. > > > > Are you using the right intrinsic type? Does it have a chain or result? > > How are you calling it from C? Are you declaring the intrinsic? This can > fail if you mismatched the readnone or readonly to the actual intrinsic > definition > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160202/210218a1/attachment.html>
Matt, The added intrinsic in DAG looks like: 0xbedb698: i32 = llvm.MyIntrinsic 0xbedb200, 0xbedac18 [ORD=4] The builtin in DAG looks like: 0xbedb2a8: i32,ch = llvm 0xbedb158:1, 0xbedb200, 0xbedb158 [ORD=7] [ID=16] The only difference I'm seeing is the extra operand, which is a 'ch' from a load. On Tue, Feb 2, 2016 at 3:55 PM, Matt Arsenault <arsenm2 at gmail.com> wrote:> > > On Feb 2, 2016, at 12:43, Ryan Taylor <ryta1203 at gmail.com> wrote: > > > > Matt, > > > > This seems to generate llvm.my_intrinsic just fine in the DAG, so no > DAG errors; however, it won't match. For example, if I call the intrinsic > from C, the DAG node looks to be named the same in dotty file but it won't > match... am I missing something? > > > > I've done it exactly the way it was done above. The DAG looks great > but it won't match. Did I miss something? > > > > Thanks. > > > > Are you using the right intrinsic type? Does it have a chain or result? > > How are you calling it from C? Are you declaring the intrinsic? This can > fail if you mismatched the readnone or readonly to the actual intrinsic > definition > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160202/603db7c7/attachment.html>