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-*-*" } } } } */
11 #include "tree-vect.h"
13 #if __INT_MAX__ > 2147483647L
14 # if __INT_MAX__ >= 9223372036854775807L
15 # define BITSIZEOF_INT 64
17 # define BITSIZEOF_INT 32
20 # if __INT_MAX__ >= 2147483647L
21 # define BITSIZEOF_INT 32
23 # define BITSIZEOF_INT 16
27 #if __LONG_MAX__ > 2147483647L
28 # if __LONG_MAX__ >= 9223372036854775807L
29 # define BITSIZEOF_LONG 64
31 # define BITSIZEOF_LONG 32
34 # define BITSIZEOF_LONG 32
37 #if __LONG_LONG_MAX__ > 2147483647L
38 # if __LONG_LONG_MAX__ >= 9223372036854775807L
39 # define BITSIZEOF_LONG_LONG 64
41 # define BITSIZEOF_LONG_LONG 32
44 # define BITSIZEOF_LONG_LONG 32
47 #define MAKE_FUNS(suffix, type) \
48 int my_clrsb##suffix(type x) { \
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) \
59 MAKE_FUNS (, unsigned);
60 MAKE_FUNS (ll
, unsigned long long);
62 extern void abort (void);
63 extern void exit (int);
99 0x0000000000000000ULL, \
100 0x0000000000000001ULL, \
101 0x8000000000000000ULL, \
102 0x0000000000000002ULL, \
103 0x4000000000000000ULL, \
104 0x0000000100000000ULL, \
105 0x0000000080000000ULL, \
106 0xa5a5a5a5a5a5a5a5ULL, \
107 0x5a5a5a5a5a5a5a5aULL, \
108 0xcafecafe00000000ULL, \
109 0x0000cafecafe0000ULL, \
110 0x00000000cafecafeULL, \
111 0xffffffffffffffffULL \
114 unsigned int ints
[] =
115 #if BITSIZEOF_INT == 64
117 #elif BITSIZEOF_INT == 32
123 unsigned long longs
[] =
124 #if BITSIZEOF_LONG == 64
130 unsigned long long longlongs
[] =
131 #if BITSIZEOF_LONG_LONG == 64
137 #define N(table) (sizeof (table) / sizeof (table[0]))
147 for (i
= 0; i
< N(ints
); i
++)
149 if (__builtin_clrsb (ints
[i
]) != my_clrsb (ints
[i
]))
153 /* Test constant folding. */
155 #define TEST(x, suffix) \
156 if (__builtin_clrsb##suffix (x) != my_clrsb##suffix (x)) \
159 #if BITSIZEOF_LONG_LONG == 64
160 TEST(0xffffffffffffffffULL
, ll
);
161 TEST(0xffffffffffffffffULL
, ll
);
162 TEST(0xffffffffffffffffULL
, ll
);
163 TEST(0xffffffffffffffffULL
, ll
);
164 TEST(0xffffffffffffffffULL
, ll
);
165 TEST(0xffffffffffffffffULL
, ll
);