mirror of
https://github.com/boostorg/uuid.git
synced 2025-05-12 05:51:43 +00:00
* Re-format the test code for MSVC bug 981648. * Improved generated x86 code for SSE4.1 and later targets. Prefer movdqu to lddqu on CPUs supporting SSE4.1 and later. lddqu has one extra cycle latency on Skylake and later Intel CPUs, and with AVX vlddqu is not merged to the following instructions as a memory operand, which makes the code slightly larger. Legacy SSE3 lddqu is still preferred when SSE4.1 is not enabled because it is faster on Prescott and the same as movdqu on AMD CPUs. It also doesn't affect code size because movdqu cannot be converted to a memory operand as memory operands are required to be aligned in SSE. Closes https://github.com/boostorg/uuid/issues/137. * Use movdqu universally for loading UUIDs. This effectively drops the optimization for NetBurst CPUs and instead prefers code that is slightly better on Skylake and later Intel CPUs, even when the code is compiled for SSE3 and not SSE4.1.
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
/*
|
|
* Copyright 2014 Andrey Semashev
|
|
*
|
|
* Distributed under the Boost Software License, Version 1.0.
|
|
* See accompanying file LICENSE_1_0.txt or copy at
|
|
* https://www.boost.org/LICENSE_1_0.txt
|
|
*/
|
|
/*
|
|
* This is a part of the test for a workaround for MSVC 12 (VS2013) optimizer bug
|
|
* which causes incorrect SIMD code generation for operator==. See:
|
|
*
|
|
* https://svn.boost.org/trac/boost/ticket/8509#comment:3
|
|
* https://connect.microsoft.com/VisualStudio/feedbackdetail/view/981648#tabs
|
|
*
|
|
* The file contains the function that actually causes the crash. Reproduces only
|
|
* in Release x64 builds.
|
|
*/
|
|
|
|
#include <cstdio>
|
|
#include <cstddef>
|
|
#include "test_msvc_simd_bug981648.hpp"
|
|
|
|
void mp_grid_update_marker_parameters(headerProperty* header_prop, my_obj ¤t_marker)
|
|
{
|
|
headerProperty *old_header_prop = NULL;
|
|
my_obj *p = dynamic_cast<my_obj*>(header_prop);
|
|
/*
|
|
* This != statement crashes with a GP.
|
|
*/
|
|
if (p != NULL && (current_marker.get_id() != p->get_marker_id())) {
|
|
std::printf("works okay, if it reaches this printf: %p\n", reinterpret_cast<void *>(p));
|
|
old_header_prop = header_prop;
|
|
if (old_header_prop == 0) {
|
|
std::fprintf(stderr, "ouch");
|
|
}
|
|
}
|
|
}
|