Builtin vs magic library function

Given some target specific IR intrinsics, in this case a load instruction for various types, I can target said intrinsic using a clang builtin function or an IR pass that recognises the function call.

Is one approach considered better than the other?

Libm calls seem to be a mixture. Builtins are available that sometimes lower to IR intrinsics, sometimes to library calls. Library calls sometimes get turned into IR intrinsics. Optimisations act on one or the other.

IR pass seems easier to test but there’s not much in it.