Closed newpavlov closed 6 months ago
@piegamesde Can you check that this PR indeed helps with performance issues on RISC-V?
Hi, and thank you for the fix. However, I cannot test it as I have quite working on embedded systems over a year ago, and the setup was for a work project.
or spilling them to stack
Interesting. Wonder if we could use that approach in the aes
crate as well?
Wonder if we could use that approach in the aes crate as well?
It will be a bit harder to do. If there is enough registers, we want keys to stay in them, while read_volatile
would always read them. In the sha2
case we know for certain that there is not enough registers, even on register rich targets like RISC-V, so reading round constants on every block processing is fine.
Prevents compiler from inlining round constants or spilling them to stack, which can slightly improve performance.
For example, on my x86-64 laptop:
Closes #328