libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-early-break_78.c
blobf93babc069e10b4709b138115c6576c3f43bb29c
1 /* { dg-add-options vect_early_break } */
2 /* { dg-require-effective-target vect_early_break_hw } */
3 /* { dg-require-effective-target vect_int } */
5 /* { dg-additional-options "-O3" } */
6 /* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target { ! "x86_64-*-* i?86-*-*" } } } } */
8 #include <limits.h>
9 #include <assert.h>
11 #include "tree-vect.h"
13 #if __INT_MAX__ > 2147483647L
14 # if __INT_MAX__ >= 9223372036854775807L
15 # define BITSIZEOF_INT 64
16 # else
17 # define BITSIZEOF_INT 32
18 # endif
19 #else
20 # if __INT_MAX__ >= 2147483647L
21 # define BITSIZEOF_INT 32
22 # else
23 # define BITSIZEOF_INT 16
24 # endif
25 #endif
27 #if __LONG_MAX__ > 2147483647L
28 # if __LONG_MAX__ >= 9223372036854775807L
29 # define BITSIZEOF_LONG 64
30 # else
31 # define BITSIZEOF_LONG 32
32 # endif
33 #else
34 # define BITSIZEOF_LONG 32
35 #endif
37 #if __LONG_LONG_MAX__ > 2147483647L
38 # if __LONG_LONG_MAX__ >= 9223372036854775807L
39 # define BITSIZEOF_LONG_LONG 64
40 # else
41 # define BITSIZEOF_LONG_LONG 32
42 # endif
43 #else
44 # define BITSIZEOF_LONG_LONG 32
45 #endif
47 #define MAKE_FUNS(suffix, type) \
48 int my_clrsb##suffix(type x) { \
49 int i; \
50 int leading = (x >> CHAR_BIT * sizeof (type) - 1) & 1; \
51 for (i = 1; i < CHAR_BIT * sizeof (type); i++) \
52 if (((x >> ((CHAR_BIT * sizeof (type)) - i - 1)) & 1) \
53 != leading) \
54 break; \
55 return i - 1; \
58 MAKE_FUNS (, unsigned);
60 extern void abort (void);
61 extern void exit (int);
64 int
65 main (void)
67 check_vect ();
69 #define TEST(x, suffix) \
70 if (__builtin_clrsb##suffix (x) != my_clrsb##suffix (x)) \
71 abort ();
73 #if BITSIZEOF_INT == 32
74 TEST(0xffffffffUL,);
75 #endif
76 exit (0);