[all-commits] [llvm/llvm-project] 1886b1: [libc] add PREFER_GENERIC flag (#73744)

Schrodinger ZHU Yifan via All-commits all-commits at lists.llvm.org
Tue Nov 28 20:48:02 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1886b1a580240fc6aa3173f5a9344d3ead0421b6
      https://github.com/llvm/llvm-project/commit/1886b1a580240fc6aa3173f5a9344d3ead0421b6
  Author: Schrodinger ZHU Yifan <yifanzhu at rochester.edu>
  Date:   2023-11-28 (Tue, 28 Nov 2023)

  Changed paths:
    M libc/cmake/modules/LLVMLibCFlagRules.cmake
    M libc/cmake/modules/LLVMLibCObjectRules.cmake
    M libc/src/__support/HashTable/CMakeLists.txt
    M libc/src/__support/HashTable/bitmask.h

  Log Message:
  -----------
  [libc] add PREFER_GENERIC flag (#73744)

There are some basic vectorization features in standard architecture
specifications. Such as SSE/SSE2 for x86-64, or NEON for aarch64. Even
though such features are almost always available, we still need some
methods to test fallback routines without any vectorization.

Previous attempt in hsearch adds a DISABLE_SSE2_OPT flag that tries to
compile the code with -mno-sse2 in order to test specific table scanning
routines. However, it turns out that such flag may have some unwanted
side effects hindering portability.

This PR introduces PREFER_GENERIC as an alternative. When a target is
built with PREFER_GENERIC, cmake will define a macro
__LIBC_PREFER_GENERIC such that developers can selectively choose the
fallback routine based on the macro.




More information about the All-commits mailing list