diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2022-06-17 22:40:00 +0200 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2022-06-17 22:41:10 +0200 |
commit | d5c29b23e1d483d7f0309b444e6043a9149ea36e (patch) | |
tree | cb069961c9f437f477a82e3edc9248c0a9a00643 /mlir | |
parent | 9d5e6ccd9bbaffc5cf67ceb064251f1e0d1663ad (diff) | |
download | llvm-d5c29b23e1d483d7f0309b444e6043a9149ea36e.zip llvm-d5c29b23e1d483d7f0309b444e6043a9149ea36e.tar.gz llvm-d5c29b23e1d483d7f0309b444e6043a9149ea36e.tar.bz2 |
[mlir][sparse] Inline the definition of LLVM_ATTRIBUTE_WEAK
This library is supposed not to have a dependency on LLVM, and linking
LLVMSupport into it breaks its shared library setup.
Diffstat (limited to 'mlir')
-rw-r--r-- | mlir/lib/ExecutionEngine/Float16bits.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/mlir/lib/ExecutionEngine/Float16bits.cpp b/mlir/lib/ExecutionEngine/Float16bits.cpp index c376022..6ee2e41 100644 --- a/mlir/lib/ExecutionEngine/Float16bits.cpp +++ b/mlir/lib/ExecutionEngine/Float16bits.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "mlir/ExecutionEngine/Float16bits.h" -#include "llvm/Support/Compiler.h" namespace { @@ -145,13 +144,23 @@ std::ostream &operator<<(std::ostream &os, const bf16 &d) { // Provide a float->bfloat conversion routine in case the runtime doesn't have // one. -extern "C" uint16_t LLVM_ATTRIBUTE_WEAK __truncsfbf2(float f) { +extern "C" uint16_t +#if defined(__has_attribute) && __has_attribute(weak) && \ + !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32) + __attribute__((__weak__)) +#endif + __truncsfbf2(float f) { return float2bfloat(f); } // Provide a double->bfloat conversion routine in case the runtime doesn't have // one. -extern "C" uint16_t LLVM_ATTRIBUTE_WEAK __truncdfbf2(double d) { +extern "C" uint16_t +#if defined(__has_attribute) && __has_attribute(weak) && \ + !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_WIN32) + __attribute__((__weak__)) +#endif + __truncdfbf2(double d) { // This does a double rounding step, but it's precise enough for our use // cases. return __truncsfbf2(static_cast<float>(d)); |