Xuan Tang via llvm-dev
2020-Sep-04 00:53 UTC
[llvm-dev] using experimental intrinsics failed
Hi Craig: I tried that, now the function is like this: ; Function Attrs: norecurse nounwind readnone ssp uwtable define { double, double } @add(double, double, double, double) local_unnamed_addr #0 { %5 = call double @llvm.experimental.constrained.fadd(double %0, double %2, metadata !"round.downward", metadata !"fpexcept.ignore") %6 = fadd double %1, %3 %7 = insertvalue { double, double } undef, double %5, 0 %8 = insertvalue { double, double } %7, double %6, 1 ret { double, double } %8 } declare double @llvm.experimental.constrained.fadd(double, double, metadata, metadata) But now I get the error at the line of declaration: error: expected function name I tried the example at https://llvm.org/docs/LangRef.html#variable-argument-handling-intrinsics and that compiles fine, which means the declaration code should work as well. Thank you Xuan Tang On Sep 3, 2020, 19:41 -0500, Craig Topper <craig.topper at gmail.com>, wrote:> I think you need a declaration like this at module scope in your IR file. Everything that's called either needs to be defined or declared even if it is an intrinsic. It doesn't matter if the declaration is before or after the use. > > declare double @llvm.experimental.constrained.fadd(double, double, metadata", metadata) > > ~Craig > > > > On Thu, Sep 3, 2020 at 5:36 PM Xuan Tang via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > > Hi: > > > > > > Sorry I need to send email directly. I am new to llvm and trying to write interval arithmetic, which requires changing rounding mode during computation. > > > > > > The document I found https://llvm.org/docs/LangRef.html#constrained-floating-point-intrinsics, seems to be doing the trick. Here is the piece of code that I did: > > > > > > %5 = call double @llvm.experimental.constrained.fadd(double %0, double %2, metadata !"round.downward", metadata !"fpexcept.ignore") > > > > > > It is taking the first and third argument and adding them together with the downward rounding mode. However, when I try to convert it to bit code, I got the error: > > > > > > error: use of undefined value '@llvm.experimental.constrained.fadd' > > > > > > Is there any flags I need to add in order to use this intrinsic? Or this is just a wrong function call. I am using the llvm version 10.0.1. > > > > > > Thank you > > > Xuan Tang > > > _______________________________________________ > > > LLVM Developers mailing list > > > llvm-dev at lists.llvm.org > > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200903/f92f529b/attachment-0001.html>
Craig Topper via llvm-dev
2020-Sep-04 01:14 UTC
[llvm-dev] using experimental intrinsics failed
I just pasted that code and ran it through llc, opt, and llvm-as. All passed without issue. What version of llvm are you using? ~Craig On Thu, Sep 3, 2020 at 5:53 PM Xuan Tang <xt585 at nyu.edu> wrote:> Hi Craig: > > I tried that, now the function is like this: > *; Function Attrs: norecurse nounwind readnone ssp uwtable* > *define* { *double*, *double* } *@add*(*double*, *double*, *double*, > *double*) local_unnamed_addr #0 { > *%5* = *call* *double* *@llvm.experimental.constrained.fadd*(*double* > *%0*, *double* *%2*, *metadata* !"round.downward", *metadata* !"fpexcept.i > gnore") > *%6* = *fadd* *double* *%1*, *%3* > *%7* = *insertvalue* { *double*, *double* } undef, *double* *%5*, 0 > *%8* = *insertvalue* { *double*, *double* } *%7*, *double* *%6*, 1 > *ret* { *double*, *double* } *%8* > } > > *declare* *double* *@llvm.experimental.constrained.fadd*(*double*, > *double*, *metadata*, *metadata*) > > But now I get the error at the line of declaration: > error: expected function name > > I tried the example at > https://llvm.org/docs/LangRef.html#variable-argument-handling-intrinsics and > that compiles fine, which means the declaration code should work as well. > > Thank you > Xuan Tang > On Sep 3, 2020, 19:41 -0500, Craig Topper <craig.topper at gmail.com>, wrote: > > I think you need a declaration like this at module scope in your IR file. > Everything that's called either needs to be defined or declared even if it > is an intrinsic. It doesn't matter if the declaration is before or after > the use. > > *declare double* *@llvm.experimental.constrained.fadd*(*double,* *double* > , *metadata*", *metadata*) > > ~Craig > > > On Thu, Sep 3, 2020 at 5:36 PM Xuan Tang via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hi: >> >> Sorry I need to send email directly. I am new to llvm and trying to write >> interval arithmetic, which requires changing rounding mode during >> computation. >> >> The document I found >> https://llvm.org/docs/LangRef.html#constrained-floating-point-intrinsics >> <https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_docs_LangRef.html-23constrained-2Dfloating-2Dpoint-2Dintrinsics&d=DwMFaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=hLa09n1yvyXy9ubp1REixw&m=dfQEfUhbjIQmr4ORw7fkG8wv0VKl4Rf0QVcMJwAmQGA&s=7N7tSGQ2qieHYkFTYdM5hRvGW564X0nUZFD4S75z_Vs&e=>, >> seems to be doing the trick. Here is the piece of code that I did: >> >> *%5* = *call* *double* *@llvm.experimental.constrained.fadd*(*double* >> *%0*, *double* *%2*, *metadata* !"round.downward", *metadata* !"fpexcept >> .ignore") >> >> It is taking the first and third argument and adding them together with >> the downward rounding mode. However, when I try to convert it to bit code, >> I got the error: >> >> error: use of undefined value '@llvm.experimental.constrained.fadd' >> >> Is there any flags I need to add in order to use this intrinsic? Or this >> is just a wrong function call. I am using the llvm version 10.0.1. >> >> Thank you >> Xuan Tang >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> <https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=DwMFaQ&c=slrrB7dE8n7gBJbeO0g-IQ&r=hLa09n1yvyXy9ubp1REixw&m=dfQEfUhbjIQmr4ORw7fkG8wv0VKl4Rf0QVcMJwAmQGA&s=2ZFnMljwFjusSuon3DD_qfwDIwvVBECfEzEATQrTmdQ&e=> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200903/0e3c024d/attachment.html>
Xuan Tang via llvm-dev
2020-Sep-04 01:16 UTC
[llvm-dev] using experimental intrinsics failed
Hi Craig: It’s llvm 10.1 I think, I did the same thing, removing everything except the code block but still failed with llvm-as. Thank you Xuan Tang On Sep 3, 2020, 20:14 -0500, Craig Topper <craig.topper at gmail.com>, wrote:> I just pasted that code and ran it through llc, opt, and llvm-as. All passed without issue. What version of llvm are you using? > > ~Craig > > > > On Thu, Sep 3, 2020 at 5:53 PM Xuan Tang <xt585 at nyu.edu> wrote: > > > Hi Craig: > > > > > > I tried that, now the function is like this: > > > ; Function Attrs: norecurse nounwind readnone ssp uwtable > > > define { double, double } @add(double, double, double, double) local_unnamed_addr #0 { > > > %5 = call double @llvm.experimental.constrained.fadd(double %0, double %2, metadata !"round.downward", metadata !"fpexcept.ignore") > > > %6 = fadd double %1, %3 > > > %7 = insertvalue { double, double } undef, double %5, 0 > > > %8 = insertvalue { double, double } %7, double %6, 1 > > > ret { double, double } %8 > > > } > > > > > > declare double @llvm.experimental.constrained.fadd(double, double, metadata, metadata) > > > > > > But now I get the error at the line of declaration: > > > error: expected function name > > > > > > I tried the example at https://llvm.org/docs/LangRef.html#variable-argument-handling-intrinsics and that compiles fine, which means the declaration code should work as well. > > > > > > Thank you > > > Xuan Tang > > > On Sep 3, 2020, 19:41 -0500, Craig Topper <craig.topper at gmail.com>, wrote: > > > > I think you need a declaration like this at module scope in your IR file. Everything that's called either needs to be defined or declared even if it is an intrinsic. It doesn't matter if the declaration is before or after the use. > > > > > > > > declare double @llvm.experimental.constrained.fadd(double, double, metadata", metadata) > > > > > > > > ~Craig > > > > > > > > > > > > > On Thu, Sep 3, 2020 at 5:36 PM Xuan Tang via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > > > > > Hi: > > > > > > > > > > > > Sorry I need to send email directly. I am new to llvm and trying to write interval arithmetic, which requires changing rounding mode during computation. > > > > > > > > > > > > The document I found https://llvm.org/docs/LangRef.html#constrained-floating-point-intrinsics, seems to be doing the trick. Here is the piece of code that I did: > > > > > > > > > > > > %5 = call double @llvm.experimental.constrained.fadd(double %0, double %2, metadata !"round.downward", metadata !"fpexcept.ignore") > > > > > > > > > > > > It is taking the first and third argument and adding them together with the downward rounding mode. However, when I try to convert it to bit code, I got the error: > > > > > > > > > > > > error: use of undefined value '@llvm.experimental.constrained.fadd' > > > > > > > > > > > > Is there any flags I need to add in order to use this intrinsic? Or this is just a wrong function call. I am using the llvm version 10.0.1. > > > > > > > > > > > > Thank you > > > > > > Xuan Tang > > > > > > _______________________________________________ > > > > > > LLVM Developers mailing list > > > > > > llvm-dev at lists.llvm.org > > > > > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200903/929b73ae/attachment-0001.html>