Skip to content

Commit eb6d098

Browse files
[ESIMD][NFC] Remove constexpr from simd class ctors (#3944)
* [ESIMD][NFC] Remove constexpr from simd class ctors Also separate implementations of copy and implicit conversion constructors.
1 parent 808b38d commit eb6d098

File tree

1 file changed

+8
-13
lines changed
  • sycl/include/sycl/ext/intel/experimental/esimd

1 file changed

+8
-13
lines changed

sycl/include/sycl/ext/intel/experimental/esimd/simd.hpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,20 @@ template <typename Ty, int N> class simd {
4545
/// The number of elements in this simd object.
4646
static constexpr int length = N;
4747

48-
// TODO @rolandschulz
49-
// Provide examples why constexpr is needed here.
50-
//
5148
/// @{
5249
/// Constructors.
53-
constexpr simd() = default;
54-
template <typename SrcTy> constexpr simd(const simd<SrcTy, N> &other) {
55-
if constexpr (std::is_same<SrcTy, Ty>::value)
56-
set(other.data());
57-
else
58-
set(__builtin_convertvector(other.data(), detail::vector_type_t<Ty, N>));
50+
simd() = default;
51+
simd(const simd &other) { set(other.data()); }
52+
template <typename SrcTy> simd(const simd<SrcTy, N> &other) {
53+
set(__builtin_convertvector(other.data(), detail::vector_type_t<Ty, N>));
5954
}
60-
template <typename SrcTy> constexpr simd(simd<SrcTy, N> &&other) {
55+
template <typename SrcTy> simd(simd<SrcTy, N> &&other) {
6156
if constexpr (std::is_same<SrcTy, Ty>::value)
6257
set(other.data());
6358
else
6459
set(__builtin_convertvector(other.data(), detail::vector_type_t<Ty, N>));
6560
}
66-
constexpr simd(const vector_type &Val) { set(Val); }
61+
simd(const vector_type &Val) { set(Val); }
6762

6863
// TODO @rolandschulz
6964
// {quote}
@@ -84,15 +79,15 @@ template <typename Ty, int N> class simd {
8479
// thought through seems to have only downsides.
8580
// {/quote}
8681

87-
constexpr simd(std::initializer_list<Ty> Ilist) noexcept {
82+
simd(std::initializer_list<Ty> Ilist) noexcept {
8883
int i = 0;
8984
for (auto It = Ilist.begin(); It != Ilist.end() && i < N; ++It) {
9085
M_data[i++] = *It;
9186
}
9287
}
9388

9489
/// Initialize a simd with an initial value and step.
95-
constexpr simd(Ty Val, Ty Step = Ty()) noexcept {
90+
simd(Ty Val, Ty Step = Ty()) noexcept {
9691
if (Step == Ty())
9792
M_data = Val;
9893
else {

0 commit comments

Comments
 (0)