[llvm] ea130a8 - [Support/BLAKE3] Fix error when building llvm for big endian AArch64 host

Daniil Kovalev via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 01:47:30 PDT 2023


Author: Daniil Kovalev
Date: 2023-08-30T11:47:12+03:00
New Revision: ea130a81d4c195b4beeebd21c7cfbfc91aa07ca8

URL: https://github.com/llvm/llvm-project/commit/ea130a81d4c195b4beeebd21c7cfbfc91aa07ca8
DIFF: https://github.com/llvm/llvm-project/commit/ea130a81d4c195b4beeebd21c7cfbfc91aa07ca8.diff

LOG: [Support/BLAKE3] Fix error when building llvm for big endian AArch64 host

BLAKE3 implementation does not support using arm neon on big-endian hosts: see
blake3_neon.c. Setting `BLAKE3_USE_NEON` to 1 by default for all AArch64
hosts broke builds for big endian hosts. This patch fixes the behavior
by introducing an additional check against `__ARM_BIG_ENDIAN` before
setting `BLAKE3_USE_NEON`.

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

Added: 
    

Modified: 
    llvm/lib/Support/BLAKE3/blake3_impl.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/BLAKE3/blake3_impl.h b/llvm/lib/Support/BLAKE3/blake3_impl.h
index 8e5456d745cd97..c679ecde4c4e9e 100644
--- a/llvm/lib/Support/BLAKE3/blake3_impl.h
+++ b/llvm/lib/Support/BLAKE3/blake3_impl.h
@@ -54,8 +54,9 @@ enum blake3_flags {
 #endif
 
 #if !defined(BLAKE3_USE_NEON) 
-  // If BLAKE3_USE_NEON not manually set, autodetect based on AArch64ness
-  #if defined(IS_AARCH64)
+  // If BLAKE3_USE_NEON not manually set, autodetect based on
+  // AArch64ness and endianness.
+  #if defined(IS_AARCH64) && !defined(__ARM_BIG_ENDIAN)
     #define BLAKE3_USE_NEON 1
   #else
     #define BLAKE3_USE_NEON 0


        


More information about the llvm-commits mailing list