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_ISNAN_H
9#define LIBSIMDPP_SIMDPP_CORE_ISNAN_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_isnan.h>
17
18namespace simdpp {
19namespace SIMDPP_ARCH_NAMESPACE {
20
21/** Checks whether elements in @a a are IEEE754 NaN.
22
23 @code
24 r0 = isnan(a0) ? 0xffffffff : 0
25 ...
26 rN = isnan(aN) ? 0xffffffff : 0
27 @endcode
28
29 @par 256-bit version:
30 @icost{SSE2-SSE4.1, NEON, ALTIVEC, 2}
31*/
32template<unsigned N, class E> SIMDPP_INL
33mask_float32<N,expr_empty> isnan(const float32<N,E>& a)
34{
35 return detail::insn::i_isnan(a.eval());
36}
37
38/** Checks whether elements in @a a are IEEE754 NaN.
39
40 @code
41 r0 = isnan(a0) ? 0xffffffffffffffff : 0
42 ...
43 rN = isnan(aN) ? 0xffffffffffffffff : 0
44 @endcode
45
46 @par 128-bit version:
47 @novec{NEON, ALTIVEC}
48
49 @par 256-bit version:
50 @novec{NEON, ALTIVEC}
51 @icost{SSE2-SSE4.1, 2}
52*/
53template<unsigned N, class E> SIMDPP_INL
54mask_float64<N,expr_empty> isnan(const float64<N,E>& a)
55{
56 return detail::insn::i_isnan(a.eval());
57}
58
59} // namespace SIMDPP_ARCH_NAMESPACE
60} // namespace simdpp
61
62#endif
63
64