[all-commits] [llvm/llvm-project] 847534: [AARCH64] ssbs should be enabled by default for co...

Michał Górny via All-commits all-commits at lists.llvm.org
Mon Apr 11 16:10:57 PDT 2022


  Branch: refs/heads/release/14.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 8475349bd6398edb4b2f13dead70e143b71d2263
      https://github.com/llvm/llvm-project/commit/8475349bd6398edb4b2f13dead70e143b71d2263
  Author: Ties Stuij <ties.stuij at arm.com>
  Date:   2022-04-11 (Mon, 11 Apr 2022)

  Changed paths:
    M clang/test/Driver/aarch64-ssbs.c
    M clang/test/Preprocessor/aarch64-target-features.c
    M llvm/lib/Support/AArch64TargetParser.cpp
    M llvm/lib/Target/AArch64/AArch64.td

  Log Message:
  -----------
  [AARCH64] ssbs should be enabled by default for cortex-x1, cortex-x1c, cortex-a77

Reviewed By: amilendra

Differential Revision: https://reviews.llvm.org/D121206


  Commit: 6697c5bc3a1e3e7a3ffbee6680b58338df4b5818
      https://github.com/llvm/llvm-project/commit/6697c5bc3a1e3e7a3ffbee6680b58338df4b5818
  Author: Michał Górny <mgorny at moritz.systems>
  Date:   2022-04-11 (Mon, 11 Apr 2022)

  Changed paths:
    M compiler-rt/cmake/config-ix.cmake
    M compiler-rt/lib/scudo/CMakeLists.txt
    M compiler-rt/lib/scudo/scudo_allocator.cpp
    M compiler-rt/lib/scudo/scudo_crc32.cpp
    M compiler-rt/lib/scudo/scudo_crc32.h
    M compiler-rt/lib/scudo/standalone/CMakeLists.txt
    M compiler-rt/lib/scudo/standalone/checksum.h
    M compiler-rt/lib/scudo/standalone/chunk.h
    M compiler-rt/lib/scudo/standalone/crc32_hw.cpp

  Log Message:
  -----------
  [compiler-rt] [scudo] Use -mcrc32 on x86 when available

Update the hardware CRC32 logic in scudo to support using `-mcrc32`
instead of `-msse4.2`.  The CRC32 intrinsics use the former flag
in the newer compiler versions, e.g. in clang since 12fa608af44a.
With these versions of clang, passing `-msse4.2` is insufficient
to enable the instructions and causes build failures when `-march` does
not enable CRC32 implicitly:

    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/scudo_crc32.cpp:20:10: error: always_inline function '_mm_crc32_u32' requires target feature 'crc32', but would be inlined into function 'computeHardwareCRC32' that is compiled without support for 'crc32'
      return CRC32_INTRINSIC(Crc, Data);
             ^
    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/scudo_crc32.h:27:27: note: expanded from macro 'CRC32_INTRINSIC'
    #  define CRC32_INTRINSIC FIRST_32_SECOND_64(_mm_crc32_u32, _mm_crc32_u64)
                              ^
    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/../sanitizer_common/sanitizer_platform.h:132:36: note: expanded from macro 'FIRST_32_SECOND_64'
    #  define FIRST_32_SECOND_64(a, b) (a)
                                       ^
    1 error generated.

For backwards compatibility, use `-mcrc32` when available and fall back
to `-msse4.2`.  The `<smmintrin.h>` header remains in use as it still
works and is compatible with GCC, while clang's `<crc32intrin.h>`
is not.

Use __builtin_ia32*() rather than _mm_crc32*() when using `-mcrc32`
to preserve compatibility with GCC.  _mm_crc32*() are aliases
to __builtin_ia32*() in both compilers but GCC requires `-msse4.2`
for the former, while both use `-mcrc32` for the latter.

Originally reported in https://bugs.gentoo.org/835870.

Differential Revision: https://reviews.llvm.org/D122789

(cherry picked from commit fd1da784ac644492f8ca40064baf3ef360352f55)


Compare: https://github.com/llvm/llvm-project/compare/d4e3c50b2bda...6697c5bc3a1e


More information about the All-commits mailing list