mirror of
https://github.com/espressif/mbedtls.git
synced 2025-05-09 19:31:18 +08:00
Fix aarch64 assembly for bignum multiplication
Add memory constraints to the aarch64 inline assembly in MULADDC_STOP. This fixes an issue where Clang 12 and 13 were generating non-functional code on aarch64 platforms. See #4962, #4943 for further details. Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
f0f2294f57
commit
11c81df707
4
ChangeLog.d/muladdc-aarch64-memory.txt
Normal file
4
ChangeLog.d/muladdc-aarch64-memory.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Bugfix
|
||||||
|
* Add missing memory constraints in aarch64 inline assembly for
|
||||||
|
bignum multiplication.
|
||||||
|
Fixes #4962.
|
@ -224,7 +224,7 @@
|
|||||||
"adcq %%rdx, %%rcx\n" \
|
"adcq %%rdx, %%rcx\n" \
|
||||||
"addq $8, %%rdi\n"
|
"addq $8, %%rdi\n"
|
||||||
|
|
||||||
#define MULADDC_STOP \
|
#define MULADDC_STOP \
|
||||||
: "+c" (c), "+D" (d), "+S" (s), "+m" (*(uint64_t (*)[16]) d) \
|
: "+c" (c), "+D" (d), "+S" (s), "+m" (*(uint64_t (*)[16]) d) \
|
||||||
: "b" (b), "m" (*(const uint64_t (*)[16]) s) \
|
: "b" (b), "m" (*(const uint64_t (*)[16]) s) \
|
||||||
: "rax", "rdx", "r8" \
|
: "rax", "rdx", "r8" \
|
||||||
@ -240,18 +240,18 @@
|
|||||||
#define MULADDC_CORE \
|
#define MULADDC_CORE \
|
||||||
"ldr x4, [%2], #8 \n\t" \
|
"ldr x4, [%2], #8 \n\t" \
|
||||||
"ldr x5, [%1] \n\t" \
|
"ldr x5, [%1] \n\t" \
|
||||||
"mul x6, x4, %3 \n\t" \
|
"mul x6, x4, %4 \n\t" \
|
||||||
"umulh x7, x4, %3 \n\t" \
|
"umulh x7, x4, %4 \n\t" \
|
||||||
"adds x5, x5, x6 \n\t" \
|
"adds x5, x5, x6 \n\t" \
|
||||||
"adc x7, x7, xzr \n\t" \
|
"adc x7, x7, xzr \n\t" \
|
||||||
"adds x5, x5, %0 \n\t" \
|
"adds x5, x5, %0 \n\t" \
|
||||||
"adc %0, x7, xzr \n\t" \
|
"adc %0, x7, xzr \n\t" \
|
||||||
"str x5, [%1], #8 \n\t"
|
"str x5, [%1], #8 \n\t"
|
||||||
|
|
||||||
#define MULADDC_STOP \
|
#define MULADDC_STOP \
|
||||||
: "+r" (c), "+r" (d), "+r" (s) \
|
: "+r" (c), "+r" (d), "+r" (s), "+m" (*(uint64_t (*)[16]) d) \
|
||||||
: "r" (b) \
|
: "r" (b), "m" (*(const uint64_t (*)[16]) s) \
|
||||||
: "x4", "x5", "x6", "x7", "cc" \
|
: "x4", "x5", "x6", "x7", "cc" \
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif /* Aarch64 */
|
#endif /* Aarch64 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user