RISC-V ASM unaligned read/writes: alternative assembly#10530
Conversation
|
Jenkins: retest this please |
Not all RISC-V chips allow unaligned reads and writes with basic assembly instructions like lw/sw. Add alternative assembly that is turned on with: WOLFSSL_RISCV_ASM_NO_UNALIGNED.
3b8e981 to
b4611fa
Compare
|
I would like to push back on this implementation a bit. Currently, all instructions that could be unaligned get emulated. I think it makes sense to check if the pointers are actually unaligned and only then use the more costly emulation. There should only be a negligible impact on performance in case the data is aligned. This also only introduces a small size overhead, the check should be a few instructions at most. |
|
On a separate issue: In my opinion readability would be increased if you just used the EDIT: This is probably obsolete in case the suggestion above gets adopted |
Description
Not all RISC-V chips allow unaligned reads and writes with basic assembly instructions like lw/sw.
Add alternative assembly that is turned on with:
WOLFSSL_RISCV_ASM_NO_UNALIGNED.
Fixes #10525
Testing
./configure --disable-shared LDFLAGS=--static --host=riscv64 CC=riscv64-linux-gnu-gcc --enable-riscv-asm CFLAGS=-DWOLFSSL_RISCV_ASM_NO_UNALIGNED