File: test_msvc_simd_bug981648_main.cpp

package info (click to toggle)
boost1.90 1.90.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 593,156 kB
  • sloc: cpp: 4,190,642; xml: 196,648; python: 34,618; ansic: 23,145; asm: 5,468; sh: 3,776; makefile: 1,161; perl: 1,020; sql: 728; ruby: 676; yacc: 478; java: 77; lisp: 24; csh: 6
file content (48 lines) | stat: -rw-r--r-- 1,523 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * 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
 *
 * This file contains the main entry point.
 */

#include <cstdio>
#include "test_msvc_simd_bug981648.hpp"

extern void mp_grid_update_marker_parameters(headerProperty* header_prop, my_obj &current_marker);

static my_obj g_my_obj;

int main(void)
{
    my_obj *p = &g_my_obj;
    p->m_uuid = uuid();
    uuid one, two;
    one.data[0] = 0; two.data[0] = 1;

    //*****************************************
    // This != statement generates two movdqu statements or pcmpeqd with a memory operand which crashes
    if (one != two) {
        std::printf("The first != operator works okay if it reaches this printf.\n");
    }

    my_obj a;
    a.m_uuid.data[0] = 1;
    std::printf("There should be another printf coming next.\n");

    //*****************************************
    // The != statement in this function generates a movups and a movdqu statement.
    // It also crashes because the optimizer also creates a pcmpeqd for a non-aligned memory location.
    mp_grid_update_marker_parameters(p, a);

    return 0;
}