annotate clang/test/Sema/128bitfloat.cpp @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -verify -std=gnu++11 %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -verify -std=c++11 %s
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -triple powerpc64-linux -verify -std=c++11 %s
anatofuz
parents:
diff changeset
4 // RUN: %clang_cc1 -triple i686-windows-gnu -verify -std=c++11 %s
anatofuz
parents:
diff changeset
5 // RUN: %clang_cc1 -triple x86_64-windows-gnu -verify -std=c++11 %s
anatofuz
parents:
diff changeset
6 // RUN: %clang_cc1 -triple x86_64-windows-msvc -verify -std=c++11 %s
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 #if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
9
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
10 #if defined(__ppc__)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
11 template <typename> struct __is_float128 { static constexpr bool value = false; };
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
12 template <> struct __is_float128<__float128> { static constexpr bool value = true; };
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
13 static_assert(__is_float128<__ieee128>::value, "__ieee128 aliases to __float128");
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
14 #endif
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
15
150
anatofuz
parents:
diff changeset
16 __float128 f;
anatofuz
parents:
diff changeset
17 template<typename> struct __is_floating_point_helper {};
anatofuz
parents:
diff changeset
18 template<> struct __is_floating_point_helper<__float128> {};
anatofuz
parents:
diff changeset
19 int g(int x, __float128 *y) {
anatofuz
parents:
diff changeset
20 return x + *y;
anatofuz
parents:
diff changeset
21 }
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 // expected-no-diagnostics
anatofuz
parents:
diff changeset
24 #else
anatofuz
parents:
diff changeset
25 #if !defined(__STRICT_ANSI__)
anatofuz
parents:
diff changeset
26 __float128 f; // expected-error {{__float128 is not supported on this target}}
anatofuz
parents:
diff changeset
27 // But this should work:
anatofuz
parents:
diff changeset
28 template<typename> struct __is_floating_point_helper {};
anatofuz
parents:
diff changeset
29 template<> struct __is_floating_point_helper<__float128> {}; // expected-error {{__float128 is not supported on this target}}
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 // FIXME: This could have a better diag.
anatofuz
parents:
diff changeset
32 int g(int x, __float128 *y) { // expected-error {{__float128 is not supported on this target}}
anatofuz
parents:
diff changeset
33 return x + *y;
anatofuz
parents:
diff changeset
34 }
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 #else
anatofuz
parents:
diff changeset
37 __float128 f; // expected-error {{__float128 is not supported on this target}}
anatofuz
parents:
diff changeset
38 template<typename> struct __is_floating_point_helper {};
anatofuz
parents:
diff changeset
39 template<> struct __is_floating_point_helper<__float128> {}; // expected-error {{__float128 is not supported on this target}}
anatofuz
parents:
diff changeset
40
anatofuz
parents:
diff changeset
41 int g(int x, __float128 *y) { // expected-error {{__float128 is not supported on this target}}
anatofuz
parents:
diff changeset
42 return x + *y;
anatofuz
parents:
diff changeset
43 }
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 #endif
anatofuz
parents:
diff changeset
46 #endif