chacha20poly1305: Implement SIMD optimizations for tag comparison - #258
chacha20poly1305: Implement SIMD optimizations for tag comparison#258matbech wants to merge 2 commits into
Conversation
Add SIMD support for poly1305 tag comparison
|
In its current form I can't accept this PR unfortunately. For SQLite3MC I chose the approach to instruct the compiler by setting target attributes, which CPU features to use. But which code branch is actually used is decided at runtime by checking the available CPU features. Your approach requires to specify the correct compile options, otherwise the fallback branch is used, even if the CPU is able to excute better variant. Since the amount of code is small, I can handle the implementation in SQLite3MC's style. |
|
I could remove the implementations for the x86 and aarch64 architectures, which would only leave WASM SIMD. Would that be acceptable? |
That's not the point. Of course, it makes sense to make use of available CPU features and to accelerate the implementation for the x86 and aarch64 architecture, too. I already started to code it in the way that the best available implementation is chosen at runtime. Yes, I know it's different for WASM, because feature detection at runtime is not supported. So, for WASM using SIMD can only achieved by using the corresponding compile time option. |
|
I agree. Architecture-specific implementations should be separated into their own files. I'll close this PR for now, but feel free to open a new one with the restructured approach. |
I added the architecture-specific |
Description
Add SIMD support for poly1305 tag comparison.
Type of Change
Problem / Motivation
Improves performance for WASM SIMD and -msse4.1 or /arch:SSE4.2 with MSVC.
Checklist