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