-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chacha20: AVX2 detection #200
Conversation
c8a52b7
to
94a31e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this code is correct. You can not assume that SSE2 is available without checking it either via cfg
s or via runtime detection. It should be quite easy to add a second token which would check SSE2 feature and will use the software fallback if it's not available for some reason. For most builds it will be replaced by true
, so compiler should remove the fallback code for them. Ideally we would use "CPUID match", but it's not implemented yet, so we have no choice for now.
94a31e2
to
1767c76
Compare
@newpavlov I'm trying to find a reference for it, but I believe the Otherwise I suppose I can gate on it. Edit: added explicit |
1767c76
to
220e346
Compare
Yes, it is, thus my comment about second token being replaced by UPD: Yeah, adding the |
Under what conditions would that target feature be absent, short of someone explicitly going out of their way to make it happen? I added explicit target feature gating which handles this case the same way |
bb8544d
to
9566953
Compare
Automatically detects the availability of AVX2 on x86(_64) architectures based on CPUID, and falls back to the SSE2" backend if unavailable.
9566953
to
2b1ab7a
Compare
Automatically detects the availability of AVX2 on x86(_64) architectures based on CPUID, and falls back to the SSE2" backend if unavailable.