[cfe-dev c++] Creating additional compiler intrinsics

Hello cfe-dev list,
I am currently working on a fork of llvm to implement a paper I’m submitting to C++. The paper provides a magic standard-library function, however to implement the function, I need an intrinsic. I was looking for the steps necessary for, and some guidance towards, implementing that in clang. Specifically, it interacts with the compiler, so it would need to be a clang intrinsic, rather than an llvm intrinsic.
The intrinsic behavior is as follows:

  • In constant evaluation, emit a failing diagnostic with a string_view and source_location parameter when evaluated.
  • In other contexts, same as __builtin_unreachable() (unconditional UB at runtime).
    Thank you all for your time and any help you can provide.