[PATCH] D120327: compiler-rt: Add udivmodei5 to builtins and add bitint library
Andrew Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 8 08:03:55 PDT 2022
andrewng added a comment.
@mgehre-amd this has broken our Linux GCC And Windows MSVC builds. Both complain that:
.../compiler-rt/lib/builtins/udivmodei5.c:27:32: error: initializer element is not constant
static const su_int WORD_MSB = (su_int)1 << (WORD_SIZE_IN_BITS - 1);
Also `__attribute__((weak))` is not supported for MSVC.
The following patch fixes the Windows MSVC build:
diff --git a/compiler-rt/lib/builtins/udivmodei5.c b/compiler-rt/lib/builtins/udivmodei5.c
index d1cc62c19135..5a31b9c1e685 100644
--- a/compiler-rt/lib/builtins/udivmodei5.c
+++ b/compiler-rt/lib/builtins/udivmodei5.c
@@ -15,7 +15,7 @@
// When this is built into the bitint library, provide symbols with
// weak linkage to allow gracefully upgrading once libgcc contains those
// symbols.
-#ifdef IS_BITINT_LIBRARY
+#if defined(IS_BITINT_LIBRARY) && !defined(_WIN32)
#define WEAK_IF_BITINT_LIBRARY __attribute__((weak))
#else
#define WEAK_IF_BITINT_LIBRARY
@@ -24,7 +24,7 @@
static const int WORD_SIZE_IN_BITS = sizeof(su_int) * CHAR_BIT;
/// A mask with the most significant bit set.
-static const su_int WORD_MSB = (su_int)1 << (WORD_SIZE_IN_BITS - 1);
+static const su_int WORD_MSB = (su_int)1 << ((sizeof(su_int) * CHAR_BIT) - 1);
// Define an index such that a[WORD_IDX(0)] is the least significant word
// and a[WORD_IDX(words-1)] is the most significant word.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120327/new/
https://reviews.llvm.org/D120327
More information about the llvm-commits
mailing list