1 | /* Copyright (C) 2013-2014 Povilas Kanapickas <povilas@radix.lt> |
2 | |
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 | |
8 | #ifndef LIBSIMDPP_SIMDPP_CORE_F_ISNAN2_H |
9 | #define LIBSIMDPP_SIMDPP_CORE_F_ISNAN2_H |
10 | |
11 | #ifndef LIBSIMDPP_SIMD_H |
12 | #error "This file must be included through simd.h" |
13 | #endif |
14 | |
15 | #include <simdpp/types.h> |
16 | #include <simdpp/detail/insn/f_isnan2.h> |
17 | |
18 | namespace simdpp { |
19 | namespace SIMDPP_ARCH_NAMESPACE { |
20 | |
21 | /** Checks whether corresponding elements in either @a a or @a b are IEEE754 NaN. |
22 | |
23 | @code |
24 | r0 = isnan(a0) || isnan(b0) ? 0xffffffff : 0 |
25 | ... |
26 | rN = isnan(aN) || isnan(bN) ? 0xffffffff : 0 |
27 | @endcode |
28 | |
29 | @par 128-bit version: |
30 | @icost{NEON, ALTIVEC, 3} |
31 | |
32 | @par 256-bit version: |
33 | @icost{SSE2-SSE4.1, 2} |
34 | @icost{NEON, ALTIVEC, 6} |
35 | */ |
36 | template<unsigned N, class E1, class E2> SIMDPP_INL |
37 | mask_float32<N,expr_empty> isnan2(const float32<N,E1>& a, const float32<N,E2>& b) |
38 | { |
39 | return detail::insn::i_isnan2(a.eval(), b.eval()); |
40 | } |
41 | |
42 | /** Checks whether corresponding elements in either @a a or @a b are IEEE754 |
43 | NaN. |
44 | |
45 | @code |
46 | r0 = isnan(a0) || isnan(b0) ? 0xffffffffffffffff : 0 |
47 | ... |
48 | rN = isnan(aN) || isnan(bN) ? 0xffffffffffffffff : 0 |
49 | @endcode |
50 | |
51 | @par 128-bit version: |
52 | @novec{NEON, ALTIVEC} |
53 | |
54 | @par 256-bit version: |
55 | @novec{NEON, ALTIVEC} |
56 | @icost{SSE2-SSE4.1, 2} |
57 | */ |
58 | template<unsigned N, class E1, class E2> SIMDPP_INL |
59 | mask_float64<N,expr_empty> isnan2(const float64<N,E1>& a, const float64<N,E2>& b) |
60 | { |
61 | return detail::insn::i_isnan2(a.eval(), b.eval()); |
62 | } |
63 | |
64 | |
65 | } // namespace SIMDPP_ARCH_NAMESPACE |
66 | } // namespace simdpp |
67 | |
68 | #endif |
69 | |
70 | |