xref: /aosp_15_r20/external/clang/test/Sema/128bitint.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin9 %s -DHAVE
2*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify -triple i686-linux-gnu %s -DHAVE_NOT
3*67e74705SXin Li 
4*67e74705SXin Li #ifdef HAVE
5*67e74705SXin Li typedef int i128 __attribute__((__mode__(TI)));
6*67e74705SXin Li typedef unsigned u128 __attribute__((__mode__(TI)));
7*67e74705SXin Li 
8*67e74705SXin Li int a[((i128)-1 ^ (i128)-2) == 1 ? 1 : -1];
9*67e74705SXin Li int a[(u128)-1 > 1LL ? 1 : -1];
10*67e74705SXin Li int a[__SIZEOF_INT128__ == 16 ? 1 : -1];
11*67e74705SXin Li 
12*67e74705SXin Li // PR5435
13*67e74705SXin Li __uint128_t b = (__uint128_t)-1;
14*67e74705SXin Li 
15*67e74705SXin Li // PR11916: Support for libstdc++ 4.7
16*67e74705SXin Li __int128 i = (__int128)0;
17*67e74705SXin Li unsigned __int128 u = (unsigned __int128)-1;
18*67e74705SXin Li 
19*67e74705SXin Li long long SignedTooBig = 123456789012345678901234567890; // expected-error {{integer literal is too large to be represented in any integer type}}
20*67e74705SXin Li unsigned long long UnsignedTooBig = 123456789012345678901234567890; // expected-error {{integer literal is too large to be represented in any integer type}}
21*67e74705SXin Li 
22*67e74705SXin Li void MPI_Send(void *buf, int datatype) __attribute__(( pointer_with_type_tag(mpi,1,2) ));
23*67e74705SXin Li 
24*67e74705SXin Li static const int mpi_int __attribute__(( type_tag_for_datatype(mpi,int) )) = 10;
25*67e74705SXin Li 
test(int * buf)26*67e74705SXin Li void test(int *buf)
27*67e74705SXin Li {
28*67e74705SXin Li }
29*67e74705SXin Li #else
30*67e74705SXin Li 
31*67e74705SXin Li __int128 n; // expected-error {{__int128 is not supported on this target}}
32*67e74705SXin Li 
33*67e74705SXin Li #if defined(__SIZEOF_INT128__)
34*67e74705SXin Li #error __SIZEOF_INT128__ should not be defined
35*67e74705SXin Li #endif
36*67e74705SXin Li 
37*67e74705SXin Li #endif
38