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

Daniil Kovalev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 19:44:35 PDT 2023


kovdan01 created this revision.
kovdan01 added reviewers: akyrtzi, jbms, foad.
Herald added subscribers: StephenFan, hiraditya, kristof.beyls.
Herald added a project: All.
kovdan01 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159156

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


Index: llvm/lib/Support/BLAKE3/blake3_impl.h
===================================================================
--- llvm/lib/Support/BLAKE3/blake3_impl.h
+++ llvm/lib/Support/BLAKE3/blake3_impl.h
@@ -54,8 +54,9 @@
 #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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159156.554550.patch
Type: text/x-patch
Size: 584 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230830/32f62185/attachment.bin>


More information about the llvm-commits mailing list