-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix vectorized min/max/minmax_element
for 64-bit types on x86
#2821
Merged
StephanTLavavej
merged 5 commits into
microsoft:main
from
StephanTLavavej:fix-max-element
Jun 25, 2022
Merged
Fix vectorized min/max/minmax_element
for 64-bit types on x86
#2821
StephanTLavavej
merged 5 commits into
microsoft:main
from
StephanTLavavej:fix-max-element
Jun 25, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: Alex Guteniev <[email protected]>
CaseyCarter
approved these changes
Jun 24, 2022
AlexGuteniev
approved these changes
Jun 24, 2022
miscco
approved these changes
Jun 24, 2022
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 want to reaffirm my opinion that @AlexGuteniev is a wizard
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
CaseyCarter
approved these changes
Jun 25, 2022
AraHaan
approved these changes
Jun 25, 2022
fsb4000
pushed a commit
to fsb4000/STL
that referenced
this pull request
Aug 13, 2022
…osoft#2821) Co-authored-by: Alex Guteniev <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a regression caused by #2447 that was specific to 64-bit types on x86, reported by internal VSO-1558536 "[RWC][prod/fe][Regression][x86] LLVM one test 'Profile/c-counter-overflows.c' failed".
Thanks to @AlexGuteniev for finding the root cause and providing the fix. The problem is that
_mm_extract_epi32
and_mm_cvtsi128_si32
both returnint
. By directly casting to_Unsigned_t
, i.e.uint64_t
in_Minmax_traits_8
, high-bit values were being sign-extended, but the desired behavior was zero-extension. Adding initial casts ofstatic_cast<uint32_t>
fixes this.Then, I'm enhancing the test coverage:
[1, 20]
range concealed this bug. Now, integers use the full range, while floating-point values use a large range centered around 0. (Unfortunately,uniform_real_distribution
requiresb - a <= max
, so we can't generate a full range without extra work. As floating-point is not yet vectorized, I felt that this was sufficient for now.)Fortunately, this regression has not yet shipped in a Preview.