[PATCH] D136044: [compiler-rt][builtins] Skip building (b)float16 support on i386-freebsd

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 16 15:17:13 PDT 2022


dim added a comment.

In D136044#3861187 <https://reviews.llvm.org/D136044#3861187>, @arichardson wrote:

> What is being done for things like 64bit atomics and int128 support? Surely that will have the same problem?

These are simply done inline at compile time, similar to what I tried to do in rGce6d40f5c23923a807388c58b82b4c343eced0ce <https://reviews.llvm.org/rGce6d40f5c23923a807388c58b82b4c343eced0ce> (but that was unfortunately reverted).

For 64 bit atomics, `compiler-rt/lib/builtins/atomic.c` has:

  c++
  /// Macros for determining whether a size is lock free.
  #define ATOMIC_ALWAYS_LOCK_FREE_OR_ALIGNED_LOCK_FREE(size, p)                  \
    (__atomic_always_lock_free(size, p) ||                                       \
     (__atomic_always_lock_free(size, 0) && ((uintptr_t)p % size) == 0))
  #define IS_LOCK_FREE_1(p) ATOMIC_ALWAYS_LOCK_FREE_OR_ALIGNED_LOCK_FREE(1, p)
  #define IS_LOCK_FREE_2(p) ATOMIC_ALWAYS_LOCK_FREE_OR_ALIGNED_LOCK_FREE(2, p)
  #define IS_LOCK_FREE_4(p) ATOMIC_ALWAYS_LOCK_FREE_OR_ALIGNED_LOCK_FREE(4, p)
  #define IS_LOCK_FREE_8(p) ATOMIC_ALWAYS_LOCK_FREE_OR_ALIGNED_LOCK_FREE(8, p)
  #define IS_LOCK_FREE_16(p) ATOMIC_ALWAYS_LOCK_FREE_OR_ALIGNED_LOCK_FREE(16, p)

and then specific functions are enabled or not depending on the value of the various `IS_LOCK_FREE` macros.

For int128 support there is in `compiler-rt/lib/builtins/int_types.h`:

  c++
  #if defined(__LP64__) || defined(__wasm__) || defined(__mips64) ||             \
      defined(__riscv) || defined(_WIN64)
  #define CRT_HAS_128BIT
  #endif

and all instances of int128 support are fenced by `CRT_HAS_128BIT`. (Something similar is done for 128 bit long doubles.)

> It sounds to me like the configure check should be redone with -m32 instead of adding an os-specific workaround

I don't understand enough about compiler-rt's build system (and CMake in general) to do that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136044/new/

https://reviews.llvm.org/D136044



More information about the llvm-commits mailing list