[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / utilities / function.objects / bitwise.operations / bit_xor.pass.cpp
blobeff1beadef7832eb3d79c012eba79192cb84c7fe
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 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
11 // <functional>
13 // bit_xor
15 #include <functional>
16 #include <type_traits>
17 #include <cassert>
19 #include "test_macros.h"
21 int main(int, char**)
24 typedef std::bit_xor<int> F;
25 const F f = F();
26 #if TEST_STD_VER <= 17
27 static_assert((std::is_same<int, F::first_argument_type>::value), "" );
28 static_assert((std::is_same<int, F::second_argument_type>::value), "" );
29 static_assert((std::is_same<int, F::result_type>::value), "" );
30 #endif
31 assert(f(0xEA95, 0xEA95) == 0);
32 assert(f(0xEA95, 0x58D3) == 0xB246);
33 assert(f(0x58D3, 0xEA95) == 0xB246);
34 assert(f(0x58D3, 0) == 0x58D3);
35 assert(f(0xFFFF, 0x58D3) == 0xA72C);
37 #if TEST_STD_VER > 11
39 typedef std::bit_xor<> F2;
40 const F2 f = F2();
41 assert(f(0xEA95, 0xEA95) == 0);
42 assert(f(0xEA95L, 0xEA95) == 0);
43 assert(f(0xEA95, 0xEA95L) == 0);
45 assert(f(0xEA95, 0x58D3) == 0xB246);
46 assert(f(0xEA95L, 0x58D3) == 0xB246);
47 assert(f(0xEA95, 0x58D3L) == 0xB246);
49 assert(f(0x58D3, 0xEA95) == 0xB246);
50 assert(f(0x58D3L, 0xEA95) == 0xB246);
51 assert(f(0x58D3, 0xEA95L) == 0xB246);
53 assert(f(0x58D3, 0) == 0x58D3);
54 assert(f(0x58D3L, 0) == 0x58D3);
55 assert(f(0x58D3, 0L) == 0x58D3);
57 assert(f(0xFFFF, 0x58D3) == 0xA72C);
58 assert(f(0xFFFFL, 0x58D3) == 0xA72C);
59 assert(f(0xFFFF, 0x58D3L) == 0xA72C);
61 constexpr int foo = std::bit_xor<int> () (0x58D3, 0xEA95);
62 static_assert ( foo == 0xB246, "" );
64 constexpr int bar = std::bit_xor<> () (0x58D3L, 0xEA95);
65 static_assert ( bar == 0xB246, "" );
67 #endif
69 return 0;