Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 51a7965

Browse files
committed
[SYCL][ESIMD] Refactor the order of functions in file
Signed-off-by: Kochetkov, Yuriy <[email protected]>
1 parent 1e54ab1 commit 51a7965

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed

SYCL/ESIMD/api/functional/ctors/ctor_move.cpp

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,63 @@ using namespace sycl::ext::intel::experimental::esimd;
3333
using namespace esimd_test::api::functional::ctors;
3434
using namespace esimd_test::api::functional;
3535

36+
// Uses the initializer C++ context to call simd move constructor
37+
struct initializer {
38+
static std::string get_description() { return "initializer"; }
39+
40+
template <typename SimdT, typename ActionT>
41+
static void run(SimdT &&source, const ActionT &action) {
42+
static_assert(
43+
type_traits::is_nonconst_rvalue_reference_v<decltype(source)>);
44+
45+
const auto instance = SimdT(std::move(source));
46+
action(instance);
47+
}
48+
};
49+
50+
// Uses the variable declaration C++ context to call simd move constructor
51+
struct var_decl {
52+
static std::string get_description() { return "variable declaration"; }
53+
54+
template <typename SimdT, typename ActionT>
55+
static void run(SimdT &&source, const ActionT &action) {
56+
static_assert(
57+
type_traits::is_nonconst_rvalue_reference_v<decltype(source)>);
58+
59+
const auto instance(std::move(source));
60+
action(instance);
61+
}
62+
};
63+
64+
// Uses the rvalue in expression C++ context to call simd move constructor
65+
struct rval_in_expr {
66+
static std::string get_description() { return "rvalue in expression"; }
67+
68+
template <typename SimdT, typename ActionT>
69+
static void run(SimdT &&source, const ActionT &action) {
70+
static_assert(
71+
type_traits::is_nonconst_rvalue_reference_v<decltype(source)>);
72+
73+
SimdT instance;
74+
instance = SimdT(std::move(source));
75+
action(instance);
76+
}
77+
};
78+
79+
// Uses the function argument C++ context to call simd move constructor
80+
class const_ref {
81+
public:
82+
static std::string get_description() { return "const reference"; }
83+
84+
template <typename SimdT, typename ActionT>
85+
static void run(SimdT &&source, const ActionT &action) {
86+
static_assert(
87+
type_traits::is_nonconst_rvalue_reference_v<decltype(source)>);
88+
89+
action(SimdT(std::move(source)));
90+
}
91+
};
92+
3693
// The core test functionality.
3794
// Runs a TestCaseT, specific for each C++ context, for a simd<DataT,NumElems>
3895
// instance
@@ -158,63 +215,6 @@ template <typename DataT, int NumElems, typename TestCaseT> class run_test {
158215
}
159216
};
160217

161-
// Uses the initializer C++ context to call simd move constructor
162-
struct initializer {
163-
static std::string get_description() { return "initializer"; }
164-
165-
template <typename SimdT, typename ActionT>
166-
static void run(SimdT &&source, const ActionT &action) {
167-
static_assert(
168-
type_traits::is_nonconst_rvalue_reference_v<decltype(source)>);
169-
170-
const auto instance = SimdT(std::move(source));
171-
action(instance);
172-
}
173-
};
174-
175-
// Uses the variable declaration C++ context to call simd move constructor
176-
struct var_decl {
177-
static std::string get_description() { return "variable declaration"; }
178-
179-
template <typename SimdT, typename ActionT>
180-
static void run(SimdT &&source, const ActionT &action) {
181-
static_assert(
182-
type_traits::is_nonconst_rvalue_reference_v<decltype(source)>);
183-
184-
const auto instance(std::move(source));
185-
action(instance);
186-
}
187-
};
188-
189-
// Uses the rvalue in expression C++ context to call simd move constructor
190-
struct rval_in_expr {
191-
static std::string get_description() { return "rvalue in expression"; }
192-
193-
template <typename SimdT, typename ActionT>
194-
static void run(SimdT &&source, const ActionT &action) {
195-
static_assert(
196-
type_traits::is_nonconst_rvalue_reference_v<decltype(source)>);
197-
198-
SimdT instance;
199-
instance = SimdT(std::move(source));
200-
action(instance);
201-
}
202-
};
203-
204-
// Uses the function argument C++ context to call simd move constructor
205-
class const_ref {
206-
public:
207-
static std::string get_description() { return "const reference"; }
208-
209-
template <typename SimdT, typename ActionT>
210-
static void run(SimdT &&source, const ActionT &action) {
211-
static_assert(
212-
type_traits::is_nonconst_rvalue_reference_v<decltype(source)>);
213-
214-
action(SimdT(std::move(source)));
215-
}
216-
};
217-
218218
int main(int, char **) {
219219
bool passed = true;
220220
const auto types = get_tested_types<tested_types::all>();

0 commit comments

Comments
 (0)