Runtime lib calls

I am trying to bring an out-of-tree architecture from Release 19 to Release 23. (I should not have done this all at once, but rookie mistake.) For a test case of UDIV_I128, I am getting the error
Expand integer result: t9: i128 = udiv t7, t8
LLVM ERROR: unsupported library call operation

This is from TargetLowering::makeLibCall()
if (LibcallImpl == RTLIB::Unsupported)
reportFatalInternalError(“unsupported library call operation”);

The libcall stuff was vastly changed between rel-19 and rel-23 so I must be missing something. It doesn’t appear that any generic changes were made in the lib/Target/* code. How do I make LibcallImpl supported for my target?

Thanks,
Brian

This PR TableGen: Add runtime libcall backend by arsenm · Pull Request #144972 · llvm/llvm-project · GitHub (and related) might be useful.

1 Like

It appears that the solution is modify the file llvm/include/llvm/IR/RuntimeLibcalls.td to add the out-of-tree arch to

//===----------------------------------------------------------------------===//
// Legacy Default Runtime Libcalls
//===----------------------------------------------------------------------===//

// TODO: Should make every target explicit.
def isDefaultLibcallArch : RuntimeLibcallPredicate<[{
TT.isMIPS() || TT.isLoongArch() || TT.isVE() || TT.isBPF() ||
TT.getArch() == Triple::csky || TT.getArch() == Triple::arc ||
TT.getArch() == Triple::m68k || TT.getArch() == Triple::xtensa ||
(TT.isSystemZ() && !TT.isOSzOS())
}]>;

One more file to modify to add a new target.