/*************************************************************************** * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and * * Martin Renou * * Copyright (c) QuantStack * * Copyright (c) Serge Guelton * * Copyright (c) Marco Barbone * * * * Distributed under the terms of the BSD 3-Clause License. * * * * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ #include "xsimd/xsimd.hpp" #ifndef XSIMD_NO_SUPPORTED_ARCHITECTURE #include "test_utils.hpp" // Compile time tests for include/xsimd/arch/common/xsimd_common_swizzle.hpp namespace xsimd { namespace kernel { namespace detail { // ──────────────────────────────────────────────────────────────────────── // compile-time tests (identity, all-different, dup-lo, dup-hi) // 8-lane identity static_assert(is_identity(), "identity failed"); // 8-lane reverse is not identity static_assert(!is_identity(), "identity on reverse"); // 8-lane dup-lo (repeat 0..3 twice) static_assert(is_dup_lo(), "dup_lo failed"); static_assert(!is_dup_hi(), "dup_hi on dup_lo"); // 8-lane dup-hi (repeat 4..7 twice) static_assert(is_dup_hi(), "dup_hi failed"); static_assert(!is_dup_lo(), "dup_lo on dup_hi"); // 8-lane is-only-from-hi (repeat 4..7 twice) static_assert(is_only_from_hi(), "only_from_hi on hi"); static_assert(!is_only_from_hi(), "only_from_hi failed"); // 8-lane is-only-from-lo (repeat 4..7 twice) static_assert(is_only_from_lo(), "only_from_lo on lo"); static_assert(!is_only_from_lo(), "only_from_lo failed"); // ──────────────────────────────────────────────────────────────────────── // 4-lane identity static_assert(is_identity(), "4-lane identity failed"); // 4-lane reverse is not identity static_assert(!is_identity(), "4-lane identity on reverse"); // 4-lane dup-lo (repeat 0..1 twice) static_assert(is_dup_lo(), "4-lane dup_lo failed"); static_assert(!is_dup_hi(), "4-lane dup_hi on dup_lo"); // 4-lane dup-hi (repeat 2..3 twice) static_assert(is_dup_hi(), "4-lane dup_hi failed"); static_assert(!is_dup_lo(), "4-lane dup_lo on dup_hi"); static_assert(is_cross_lane<0, 1, 0, 1>(), "dup-lo only → crossing"); static_assert(is_cross_lane<2, 3, 2, 3>(), "dup-hi only → crossing"); static_assert(is_cross_lane<0, 3, 3, 3>(), "one low + rest high → crossing"); static_assert(!is_cross_lane<1, 0, 2, 3>(), "mixed low/high → no crossing"); static_assert(!is_cross_lane<0, 1, 2, 3>(), "mixed low/high → no crossing"); } } } namespace xsimd { template