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.
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.
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.
Note that the intrinsics don’t affect the rounding mode at run time.
What they do is the tell llvm what rounding mode llvm should expect the code to be using when it does eventually get run. You’ll need to change the rounding mode in your fp environment yourself by calling fpsetround() or whatever your system uses.
Also, note that the work to implement the constrained intrinsics is ongoing. Some hosts support it (X86, SystemZ, and recently PowerPC), but roughly no optimizations are enabled yet. So don’t expect performance yet.