llvm undefined experimental intrinsics

Viewed 179

I am trying to edit the llvm ir code:

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
}

where on line 2 using an experimental intrinsic from llvm, the document can be found here

When compiling the llvm code using llvm-as, I get the error:

use of undefined value '@llvm.experimental.constrained.fadd'

The code I use to compile it to binary is:

/usr/local/opt/llvm/bin/llvm-as interval.ll -o interval.bc

Is there any special flags I need to add in order to use the experimental intrinsics?

2 Answers

Change@llvm.experimental.constrained.fadd to @llvm.experimental.constrained.fadd.f64 and add the declare declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata)

The problem is, with every function used in llvm, you need to declare it somewhere in the file.

Related