modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/pr63302.c (about) 1 /* PR tree-optimization/63302 */ 2 3 #ifdef __SIZEOF_INT128__ 4 #if __SIZEOF_INT128__ * __CHAR_BIT__ == 128 5 #define USE_INT128 6 #endif 7 #endif 8 #if __SIZEOF_LONG_LONG__ * __CHAR_BIT__ == 64 9 #define USE_LLONG 10 #endif 11 12 #ifdef USE_INT128 13 __attribute__((noinline, noclone)) int 14 foo (__int128 x) 15 { 16 __int128 v = x & (((__int128) -1 << 63) | 0x7ff); 17 18 return v == 0 || v == ((__int128) -1 << 63); 19 } 20 #endif 21 22 #ifdef USE_LLONG 23 __attribute__((noinline, noclone)) int 24 bar (long long x) 25 { 26 long long v = x & (((long long) -1 << 31) | 0x7ff); 27 28 return v == 0 || v == ((long long) -1 << 31); 29 } 30 #endif 31 32 int 33 main () 34 { 35 #ifdef USE_INT128 36 if (foo (0) != 1 37 || foo (1) != 0 38 || foo (0x800) != 1 39 || foo (0x801) != 0 40 || foo ((__int128) 1 << 63) != 0 41 || foo ((__int128) -1 << 63) != 1 42 || foo (((__int128) -1 << 63) | 1) != 0 43 || foo (((__int128) -1 << 63) | 0x800) != 1 44 || foo (((__int128) -1 << 63) | 0x801) != 0) 45 __builtin_abort (); 46 #endif 47 #ifdef USE_LLONG 48 if (bar (0) != 1 49 || bar (1) != 0 50 || bar (0x800) != 1 51 || bar (0x801) != 0 52 || bar (1LL << 31) != 0 53 || bar (-1LL << 31) != 1 54 || bar ((-1LL << 31) | 1) != 0 55 || bar ((-1LL << 31) | 0x800) != 1 56 || bar ((-1LL << 31) | 0x801) != 0) 57 __builtin_abort (); 58 #endif 59 return 0; 60 }