]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/context/example/echosse.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / context / example / echosse.cpp
CommitLineData
7c673cae
FG
1
2// Copyright Oliver Kowalke 2009.
3// Distributed under the Boost Software License, Version 1.0.
4// (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7#include <cstddef>
8#include <cstdlib>
9#include <cstring>
10#include <iostream>
11#include <emmintrin.h>
12
b32b8144
FG
13#include <boost/context/continuation.hpp>
14
15namespace ctx = boost::context;
7c673cae
FG
16
17void echoSSE( int i) {
18 __m128i xmm;
19 xmm = _mm_set_epi32( i, i + 1, i + 2, i + 3);
20 uint32_t v32[4];
21 memcpy( & v32, & xmm, 16);
22 std::cout << v32[0];
23 std::cout << v32[1];
24 std::cout << v32[2];
25 std::cout << v32[3];
26}
27
7c673cae
FG
28
29int main( int argc, char * argv[]) {
b32b8144
FG
30 int i = 0;
31 ctx::continuation c = ctx::callcc(
32 [&i](ctx::continuation && c) {
33 for (;;) {
34 std::cout << i;
35 echoSSE( i);
36 std::cout << " ";
37 c = c.resume();
38 }
39 return std::move( c);
40 });
41 for (; i < 10; ++i) {
42 c = c.resume();
7c673cae 43 }
b32b8144 44 std::cout << "\nmain: done" << std::endl;
7c673cae
FG
45 return EXIT_SUCCESS;
46}