[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / language.support / support.limits / limits / numeric.limits.members / signaling_NaN.pass.cpp
blob6c629a211660a6e7303e6a1be9178da1f822cbba
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // test numeric_limits
11 // signaling_NaN()
13 #include <limits>
14 #include <cmath>
15 #include <type_traits>
16 #include <cassert>
18 #include "test_macros.h"
20 template <class T>
21 void
22 test_imp(std::true_type)
24 assert(std::isnan(std::numeric_limits<T>::signaling_NaN()));
25 assert(std::isnan(std::numeric_limits<const T>::signaling_NaN()));
26 assert(std::isnan(std::numeric_limits<volatile T>::signaling_NaN()));
27 assert(std::isnan(std::numeric_limits<const volatile T>::signaling_NaN()));
30 template <class T>
31 void
32 test_imp(std::false_type)
34 assert(std::numeric_limits<T>::signaling_NaN() == T());
35 assert(std::numeric_limits<const T>::signaling_NaN() == T());
36 assert(std::numeric_limits<volatile T>::signaling_NaN() == T());
37 assert(std::numeric_limits<const volatile T>::signaling_NaN() == T());
40 template <class T>
41 inline
42 void
43 test()
45 test_imp<T>(std::is_floating_point<T>());
48 int main(int, char**)
50 test<bool>();
51 test<char>();
52 test<signed char>();
53 test<unsigned char>();
54 test<wchar_t>();
55 #if TEST_STD_VER > 17 && defined(__cpp_char8_t)
56 test<char8_t>();
57 #endif
58 test<char16_t>();
59 test<char32_t>();
60 test<short>();
61 test<unsigned short>();
62 test<int>();
63 test<unsigned int>();
64 test<long>();
65 test<unsigned long>();
66 test<long long>();
67 test<unsigned long long>();
68 #ifndef TEST_HAS_NO_INT128
69 test<__int128_t>();
70 test<__uint128_t>();
71 #endif
72 test<float>();
73 test<double>();
74 test<long double>();
76 return 0;