Skip to content
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 floating minmax performance #5016

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion stl/src/vector_algorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2222,11 +2222,23 @@ namespace {
}
}

// TRNSITION, DevCom-10767462
template <_Min_max_mode _Mode, class _Traits, bool _Sign>
auto __std_minmax_impl_wrap(const void* const _First, const void* const _Last) {
auto _Rx = __std_minmax_impl<_Mode, _Traits, _Sign>(_First, _Last);
_mm256_zeroupper();
return _Rx;
}

template <_Min_max_mode _Mode, class _Traits, bool _Sign>
auto __std_minmax_disp(const void* const _First, const void* const _Last) noexcept {
#ifndef _M_ARM64EC
if (_Byte_length(_First, _Last) >= 32 && _Use_avx2()) {
return __std_minmax_impl<_Mode, typename _Traits::_Avx, _Sign>(_First, _Last);
if constexpr (_Traits::_Avx::_Is_floating && _Mode == _Min_max_mode::_Mode_both) {
return __std_minmax_impl_wrap<_Mode, typename _Traits::_Avx, _Sign>(_First, _Last);
} else {
return __std_minmax_impl<_Mode, typename _Traits::_Avx, _Sign>(_First, _Last);
}
}

if (_Byte_length(_First, _Last) >= 16 && _Use_sse42()) {
Expand Down