replace the intrinsic call by a C function call

Dear there,

Is there anyway to replace a intrinsic call by a “normal” function call?

For exmple, when I see intrinsic “llvm.math.high.add(float x)”, I want to use function “math_high_add(float x)” to replace it because I already have the implementation there.
I tried function attribute “alias”, it turns out not working because “llvm.math.add” is not a legal function name.

Any “elegant” way to handle this?

best

kevin

Is there anyway to replace a intrinsic call by a “normal” function call?

An LLVM IR pass could do it easily, or XYZISelLowering.cpp a bit more
messily once you get that far (AArch64 does something similar in
LowerFSINCOS).

If it's a custom intrinsic though, you could consider emitting the
call in the first place. You don't *have* to use an intrinsic for
functions with special handling: most of the libm functions don't have
special intrinsics in LLVM for example, but do get special treatment
elsewhere.

I suppose I'd make the decision based on whether the front-end easily
knew the final call, or whether it was sometimes a real instruction
(in some subtarget).

Cheers.

Tim.