Skip to content

Commit

Permalink
Adjust defaults to prevent code-size regression
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Rodgman <[email protected]>
  • Loading branch information
daverodgman committed Jan 15, 2025
1 parent 150f100 commit 557cc82
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/builtin/src/chacha20.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,24 @@
// Select scalar implementation if Neon not available
#define MBEDTLS_CHACHA20_NEON_MULTIBLOCK 0
#elif !defined(MBEDTLS_CHACHA20_NEON_MULTIBLOCK)
// By default, select the best performing option that is smaller than the scalar implementation.
// By default, select the best performing option that is not a code-size regression (based on
// measurements from recent gcc and clang).
#if defined(MBEDTLS_ARCH_IS_THUMB)
#if defined(MBEDTLS_COMPILER_IS_GCC)
#define MBEDTLS_CHACHA20_NEON_MULTIBLOCK 1
#else
#define MBEDTLS_CHACHA20_NEON_MULTIBLOCK 2
#endif
#elif defined(MBEDTLS_ARCH_IS_ARM64)
#define MBEDTLS_CHACHA20_NEON_MULTIBLOCK 3
#else
#if defined(MBEDTLS_COMPILER_IS_GCC)
#define MBEDTLS_CHACHA20_NEON_MULTIBLOCK 2
#else
#define MBEDTLS_CHACHA20_NEON_MULTIBLOCK 3
#endif
#endif
#endif

#if MBEDTLS_CHACHA20_NEON_MULTIBLOCK != 0
// Tested on all combinations of Armv7 arm/thumb2; Armv8 arm/thumb2/aarch64; Armv8 aarch64_be on
Expand Down

0 comments on commit 557cc82

Please sign in to comment.