Skip to content

Hexagon: Move runtime libcall configuration to tablegen #147482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: users/arsenm/dag/use-fast-variants-math-libcalls
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions llvm/include/llvm/IR/RuntimeLibcalls.td
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,7 @@ def AVRSystemLibrary
// Hexagon Runtime Libcalls
//===----------------------------------------------------------------------===//

defset list<RuntimeLibcallImpl> HexagonLibcalls = {
def __hexagon_divsi3 : RuntimeLibcallImpl<SDIV_I32>;
def __hexagon_divdi3 : RuntimeLibcallImpl<SDIV_I64>;
def __hexagon_udivsi3 : RuntimeLibcallImpl<UDIV_I32>;
Expand Down Expand Up @@ -1445,6 +1446,16 @@ def __hexagon_fast2_sqrtdf2 : RuntimeLibcallImpl<FAST_SQRT_F64>;

def __hexagon_memcpy_likely_aligned_min32bytes_mult8bytes
: RuntimeLibcallImpl<HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES>;
}

def isHexagon : RuntimeLibcallPredicate<"TT.getArch() == Triple::hexagon">;

def HexagonSystemLibrary
: SystemRuntimeLibrary<isHexagon,
(add (sub DefaultLibcallImpls32,
__adddf3, __divsf3, __udivsi3, __udivdi3,
__umoddi3, __divdf3, __muldf3, __divsi3, __subdf3, sqrtf,
__divdi3, __umodsi3, __moddi3, __modsi3), HexagonLibcalls)>;

//===----------------------------------------------------------------------===//
// Lanai Runtime Libcalls
Expand Down
35 changes: 0 additions & 35 deletions llvm/lib/IR/RuntimeLibcalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,41 +254,6 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
setLibcallImpl(RTLIB::MULO_I128, RTLIB::Unsupported);
}

if (TT.getArch() == Triple::ArchType::hexagon) {
setLibcallImpl(RTLIB::SDIV_I32, RTLIB::__hexagon_divsi3);
setLibcallImpl(RTLIB::SDIV_I64, RTLIB::__hexagon_divdi3);
setLibcallImpl(RTLIB::UDIV_I32, RTLIB::__hexagon_udivsi3);
setLibcallImpl(RTLIB::UDIV_I64, RTLIB::__hexagon_udivdi3);
setLibcallImpl(RTLIB::SREM_I32, RTLIB::__hexagon_modsi3);
setLibcallImpl(RTLIB::SREM_I64, RTLIB::__hexagon_moddi3);
setLibcallImpl(RTLIB::UREM_I32, RTLIB::__hexagon_umodsi3);
setLibcallImpl(RTLIB::UREM_I64, RTLIB::__hexagon_umoddi3);

// Prefix is: nothing for "slow-math",
// "fast2_" for V5+ fast-math double-precision
// (actually, keep fast-math and fast-math2 separate for now)

setLibcallImpl(RTLIB::FAST_ADD_F64, RTLIB::__hexagon_fast_adddf3);
setLibcallImpl(RTLIB::FAST_SUB_F64, RTLIB::__hexagon_fast_subdf3);
setLibcallImpl(RTLIB::FAST_MUL_F64, RTLIB::__hexagon_fast_muldf3);
setLibcallImpl(RTLIB::FAST_DIV_F64, RTLIB::__hexagon_fast_divdf3);
setLibcallImpl(RTLIB::FAST_DIV_F32, RTLIB::__hexagon_fast_divsf3);
setLibcallImpl(RTLIB::FAST_SQRT_F32, RTLIB::__hexagon_fast2_sqrtf);
// This is the only fast library function for sqrtd.
setLibcallImpl(RTLIB::FAST_SQRT_F64, RTLIB::__hexagon_fast2_sqrtdf2);

setLibcallImpl(RTLIB::ADD_F64, RTLIB::__hexagon_adddf3);
setLibcallImpl(RTLIB::SUB_F64, RTLIB::__hexagon_subdf3);
setLibcallImpl(RTLIB::MUL_F64, RTLIB::__hexagon_muldf3);
setLibcallImpl(RTLIB::DIV_F64, RTLIB::__hexagon_divdf3);
setLibcallImpl(RTLIB::DIV_F32, RTLIB::__hexagon_divsf3);
setLibcallImpl(RTLIB::SQRT_F32, RTLIB::__hexagon_sqrtf);

setLibcallImpl(
RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES,
RTLIB::__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes);
}

if (TT.getArch() == Triple::ArchType::msp430) {
setLibcallImplCallingConv(RTLIB::__mspabi_mpyll,
CallingConv::MSP430_BUILTIN);
Expand Down