PR tree-optimization/81384 - built-in form of strnlen missing
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr61306-1.c
blobebc90a32f986750e566a5bdb64112f3b9432e5dd
1 #ifdef __INT32_TYPE__
2 typedef __INT32_TYPE__ int32_t;
3 #else
4 typedef int int32_t;
5 #endif
7 #ifdef __UINT32_TYPE__
8 typedef __UINT32_TYPE__ uint32_t;
9 #else
10 typedef unsigned uint32_t;
11 #endif
13 #define __fake_const_swab32(x) ((uint32_t)( \
14 (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \
15 (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \
16 (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \
17 (( (int32_t)(x) & (int32_t)0xff000000UL) >> 24)))
19 /* Previous version of bswap optimization failed to consider sign extension
20 and as a result would replace an expression *not* doing a bswap by a
21 bswap. */
23 __attribute__ ((noinline, noclone)) uint32_t
24 fake_bswap32 (uint32_t in)
26 return __fake_const_swab32 (in);
29 int
30 main(void)
32 if (sizeof (int32_t) * __CHAR_BIT__ != 32)
33 return 0;
34 if (sizeof (uint32_t) * __CHAR_BIT__ != 32)
35 return 0;
36 if (fake_bswap32 (0x87654321) != 0xffffff87)
37 __builtin_abort ();
38 return 0;