From 3964fe0f5e6622f68cc9059358b08e1fd7cc4d36 Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 25 May 2023 18:53:57 +0100 Subject: [PATCH] Improve ISA detection Signed-off-by: Dave Rodgman --- library/bn_mul.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/library/bn_mul.h b/library/bn_mul.h index 2aea1e8410..83b65cd086 100644 --- a/library/bn_mul.h +++ b/library/bn_mul.h @@ -660,7 +660,8 @@ #if defined(__arm__) -#if defined(__thumb__) && !defined(__thumb2__) && !defined(__ARMCC_VERSION) +#if defined(__thumb__) && !defined(__thumb2__) +#if !defined(__ARMCC_VERSION) /* * Thumb 1 ISA. This code path does not work on armclang. */ @@ -745,10 +746,13 @@ : "r0", "r1", "r2", "r3", "r4", "r5", \ "r6", MULADDC_SCRATCH_CLOBBER, "r8", "r9", "cc" \ ); +#endif /* !defined(__ARMCC_VERSION) */ #elif (__ARM_ARCH >= 6) && \ defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1) -/* Armv6-M with DSP Instruction Set Extensions */ +/* Armv6-M (or later) with DSP Instruction Set Extensions. + * Requires support for either Thumb 2 or Arm ISA. + */ #define MULADDC_X1_INIT \ { \ @@ -813,7 +817,7 @@ ); \ } -#elif defined(__thumb2__) || !defined(__thumb__) +#else /* Thumb 2 or Arm ISA, without DSP extensions */ #define MULADDC_X1_INIT \