Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaOpenCLCXX / remove-address-space.clcpp
blob07b252da55740fed30c0ef7ac5518f2c6cd89094
1 // RUN: %clang_cc1 %s -cl-std=clc++1.0 -triple spir-unknown-unknown -fdeclare-opencl-builtins -finclude-default-header -verify
2 // RUN: %clang_cc1 %s -cl-std=clc++2021 -triple spir-unknown-unknown -fdeclare-opencl-builtins -finclude-default-header -verify
3 // RUN: %clang_cc1 %s -cl-std=clc++2021 -cl-ext=-__opencl_c_device_enqueue,-__opencl_c_generic_address_space,-__opencl_c_pipes -triple spir-unknown-unknown -fdeclare-opencl-builtins -finclude-default-header -verify
5 // expected-no-diagnostics
7 template<typename T, typename U>
8 struct is_same {
9   static const bool value = false;
12 template<typename T>
13 struct is_same<T, T> {
14   static const bool value = true;
17 void test_is_same() {
18   static_assert(is_same<int, int>::value);
19   static_assert(!is_same<int, float>::value);
20   static_assert(!is_same<__private int, int>::value);
23 void test_remove_address_space() {
24   static_assert(is_same<__remove_address_space<int>::type, int>::value,
25                 "type without an address space unexpectedly modified by __remove_address_space");
26 #if defined(__opencl_c_generic_address_space)
27   static_assert(is_same<__remove_address_space<__generic int>::type, int>::value,
28                 "__generic address space not removed by __remove_address_space");
29 #endif
30   static_assert(is_same<__remove_address_space<__global char>::type, char>::value,
31                 "__global address space not removed by __remove_address_space");
32   static_assert(is_same<__remove_address_space<__private ulong>::type, ulong>::value,
33                 "__private address space not removed by __remove_address_space");
34   static_assert(is_same<__remove_address_space<__local short>::type, short>::value,
35                 "__local address space not removed by __remove_address_space");
36   static_assert(is_same<__remove_address_space<__constant int3>::type, int3>::value,
37                 "__constant address space not removed by __remove_address_space");
38   static_assert(is_same<__remove_address_space<const volatile __global int>::type, const volatile int>::value,
39                 "non-address-space qualifiers inappropriately removed by __remove_address_space");