[llvm] RuntimeLibcalls: Remove __muloti4 from default libcall set (PR #148562)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 14 03:16:04 PDT 2025
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/148562
>From 59035482f5cca65640c0a541d1b597ccdeca0b1b Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Mon, 14 Jul 2025 12:06:18 +0900
Subject: [PATCH 1/2] RuntimeLibcalls: Remove __muloti4 from default libcall
set
The current logic says it's only available on wasm, so only
explicitly add it there. Also fix a misnomer in the compiler-rt
call list.
---
llvm/include/llvm/IR/RuntimeLibcalls.td | 13 +++++++++----
llvm/lib/IR/RuntimeLibcalls.cpp | 2 --
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 4ad6689691f8e..d56943222da0d 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -459,7 +459,6 @@ def __multi3 : RuntimeLibcallImpl<MUL_I128>;
def __mulosi4 : RuntimeLibcallImpl<MULO_I32>;
def __mulodi4 : RuntimeLibcallImpl<MULO_I64>;
-def __muloti4 : RuntimeLibcallImpl<MULO_I128>;
def __divqi3 : RuntimeLibcallImpl<SDIV_I8>;
def __divhi3 : RuntimeLibcallImpl<SDIV_I16>;
@@ -935,6 +934,12 @@ def calloc : RuntimeLibcallImpl<CALLOC>;
} // End let IsDefault = true
+//--------------------------------------------------------------------
+// compiler-rt, not available for most architectures
+//--------------------------------------------------------------------
+
+def __muloti4 : RuntimeLibcallImpl<MULO_I128>;
+
//--------------------------------------------------------------------
// Define implementation other libcalls
//--------------------------------------------------------------------
@@ -1036,7 +1041,7 @@ defvar Int128RTLibcalls = [
];
// Only available in compiler-rt
-defvar CompilerRTOnlyInt128Libcalls = [
+defvar CompilerRTOnlyInt64Libcalls = [
__mulodi4
];
@@ -1057,7 +1062,7 @@ defvar DefaultRuntimeLibcallImpls =
!listremove(
!listremove(
!listremove(AllDefaultRuntimeLibcallImpls, Int128RTLibcalls),
- CompilerRTOnlyInt128Libcalls),
+ CompilerRTOnlyInt64Libcalls),
DefaultRuntimeLibcallImpls_f80),
DefaultRuntimeLibcallImpls_ppcf128);
@@ -2147,5 +2152,5 @@ def isWasm : RuntimeLibcallPredicate<"TT.isWasm()">;
def WasmSystemLibrary
: SystemRuntimeLibrary<isWasm,
(add DefaultRuntimeLibcallImpls, Int128RTLibcalls,
- CompilerRTOnlyInt128Libcalls,
+ CompilerRTOnlyInt64Libcalls, __muloti4,
emscripten_return_address)>;
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index 45c4bd12658a6..3dd894ad6c50e 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -250,8 +250,6 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT,
setLibcallImpl(RTLIB::MUL_I128, RTLIB::Unsupported);
setLibcallImpl(RTLIB::MULO_I64, RTLIB::Unsupported);
}
-
- setLibcallImpl(RTLIB::MULO_I128, RTLIB::Unsupported);
}
if (TT.getArch() == Triple::ArchType::msp430) {
>From 19c269fcd4224457a9d8e8dc4c99df3c0b7b6163 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Mon, 14 Jul 2025 18:05:46 +0900
Subject: [PATCH 2/2] Fix __mulodi4 in int128 calls
---
llvm/include/llvm/IR/RuntimeLibcalls.td | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index d56943222da0d..d487ff6e82df8 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -1037,7 +1037,7 @@ defvar AllDefaultRuntimeLibcallImpls
// Exist in libgcc and compiler-rt for 64-bit targets, or if
// COMPILER_RT_ENABLE_SOFTWARE_INT128.
defvar Int128RTLibcalls = [
- __ashlti3, __lshrti3, __ashrti3, __multi3, __mulodi4
+ __ashlti3, __lshrti3, __ashrti3, __multi3
];
// Only available in compiler-rt
@@ -1045,6 +1045,10 @@ defvar CompilerRTOnlyInt64Libcalls = [
__mulodi4
];
+defvar CompilerRTOnlyInt128Libcalls = [
+ __muloti4
+];
+
defvar DefaultRuntimeLibcallImpls_f80 =
!filter(entry, AllDefaultRuntimeLibcallImpls,
!match(!cast<string>(entry.Provides), "F80"));
@@ -1062,7 +1066,8 @@ defvar DefaultRuntimeLibcallImpls =
!listremove(
!listremove(
!listremove(AllDefaultRuntimeLibcallImpls, Int128RTLibcalls),
- CompilerRTOnlyInt64Libcalls),
+ !listconcat(CompilerRTOnlyInt64Libcalls,
+ CompilerRTOnlyInt128Libcalls)),
DefaultRuntimeLibcallImpls_f80),
DefaultRuntimeLibcallImpls_ppcf128);
@@ -2152,5 +2157,5 @@ def isWasm : RuntimeLibcallPredicate<"TT.isWasm()">;
def WasmSystemLibrary
: SystemRuntimeLibrary<isWasm,
(add DefaultRuntimeLibcallImpls, Int128RTLibcalls,
- CompilerRTOnlyInt64Libcalls, __muloti4,
+ CompilerRTOnlyInt64Libcalls, CompilerRTOnlyInt128Libcalls,
emscripten_return_address)>;
More information about the llvm-commits
mailing list