Skip to content

Commit

Permalink
Use #pragma GCC target to enable CRC in ARM64 hw implementation
Browse files Browse the repository at this point in the history
Use `#pragma GCC target ("+crc+crypto")` to enable the necessary
features in the ARM64 hardware CRC32c implementation.  This makes
it possible to build it without setting `-march` globally.  This should
work with GCC 6.3+, and Clang 18 (tested via godbolt.org).  Older
versions of Clang may require explicit `-march=` still.
  • Loading branch information
mgorny committed Feb 27, 2024
1 parent ea02db3 commit a5836c9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crc32c_arm64.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

#if defined(IS_ARM) && (defined(__linux__) || defined(linux))

#if defined(__GNUC__)
# pragma GCC target ("+crc+crypto")
#endif

#include <stddef.h>
#include <stdint.h>

Expand Down

0 comments on commit a5836c9

Please sign in to comment.