From 68f3262cb2cf35b2990a91d770464a73c58ac30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Hrabal=C3=ADk?= Date: Fri, 22 Jan 2016 04:55:12 +0100 Subject: [PATCH] Require that SIMD types are trivially copyable --- include/simdify/impl/named_array.hpp | 2 +- test/avx.cpp | 3 +++ test/dum.cpp | 3 +++ test/sse.cpp | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/simdify/impl/named_array.hpp b/include/simdify/impl/named_array.hpp index 3842c59..289ca36 100644 --- a/include/simdify/impl/named_array.hpp +++ b/include/simdify/impl/named_array.hpp @@ -271,7 +271,7 @@ namespace simd { } SIMDIFY_INL void swap(named_array& rhs) { - if (std::is_trivial::value) { + if (std::is_trivially_copyable::value) { std::swap(*this, rhs); } else { diff --git a/test/avx.cpp b/test/avx.cpp index 789e549..9fa2225 100644 --- a/test/avx.cpp +++ b/test/avx.cpp @@ -63,6 +63,9 @@ TEST_CASE("AVX basic guarantees", "[simd_t][x86][avx]") { REQUIRE(sizeof(F::e_t) * F::W == sizeof(F)); REQUIRE(sizeof(U::e_t) * U::W == sizeof(U)); REQUIRE(sizeof(S::e_t) * S::W == sizeof(S)); + REQUIRE((std::is_trivially_copyable::value)); + REQUIRE((std::is_trivially_copyable::value)); + REQUIRE((std::is_trivially_copyable::value)); } TEST_CASE("AVX explicit construction", "[simd_t][x86][avx]") { diff --git a/test/dum.cpp b/test/dum.cpp index a0981c7..617357f 100644 --- a/test/dum.cpp +++ b/test/dum.cpp @@ -57,6 +57,9 @@ TEST_CASE("DUM basic guarantees", "[simd_t][x86][dum]") { REQUIRE(sizeof(F::e_t) * F::W == sizeof(F)); REQUIRE(sizeof(U::e_t) * U::W == sizeof(U)); REQUIRE(sizeof(S::e_t) * S::W == sizeof(S)); + REQUIRE((std::is_trivially_copyable::value)); + REQUIRE((std::is_trivially_copyable::value)); + REQUIRE((std::is_trivially_copyable::value)); } TEST_CASE("DUM explicit construction", "[simd_t][x86][dum]") { diff --git a/test/sse.cpp b/test/sse.cpp index 090c9ec..59b2add 100644 --- a/test/sse.cpp +++ b/test/sse.cpp @@ -57,6 +57,9 @@ TEST_CASE("SSE basic guarantees", "[simd_t][x86][sse]") { REQUIRE(sizeof(F::e_t) * F::W == sizeof(F)); REQUIRE(sizeof(U::e_t) * U::W == sizeof(U)); REQUIRE(sizeof(S::e_t) * S::W == sizeof(S)); + REQUIRE((std::is_trivially_copyable::value)); + REQUIRE((std::is_trivially_copyable::value)); + REQUIRE((std::is_trivially_copyable::value)); } TEST_CASE("SSE explicit construction", "[simd_t][x86][sse]") {