libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-early-break_70.c
blob3dbedf610406e222253636aa84c68b6544c2fdbb
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-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target { ! "x86_64-*-* i?86-*-*" } } } } */
7 #include <limits.h>
8 #include <assert.h>
10 #include "tree-vect.h"
12 # define BITSIZEOF_INT 32
13 # define BITSIZEOF_LONG 64
14 # define BITSIZEOF_LONG_LONG 64
16 #define MAKE_FUNS(suffix, type) \
17 __attribute__((noinline)) \
18 int my_clz##suffix(type x) { \
19 int i; \
20 for (i = 0; i < CHAR_BIT * sizeof (type); i++) \
21 if (x & ((type) 1 << ((CHAR_BIT * sizeof (type)) - i - 1))) \
22 break; \
23 return i; \
27 MAKE_FUNS (, unsigned);
29 extern void abort (void);
30 extern void exit (int);
32 #define NUMS32 \
33 { \
34 0x00000000UL, \
35 0x00000001UL, \
36 0x80000000UL, \
37 0x00000002UL, \
38 0x40000000UL, \
39 0x00010000UL, \
40 0x00008000UL, \
41 0xa5a5a5a5UL, \
42 0x5a5a5a5aUL, \
43 0xcafe0000UL, \
44 0x00cafe00UL, \
45 0x0000cafeUL, \
46 0xffffffffUL \
50 unsigned int ints[] = NUMS32;
52 #define N(table) (sizeof (table) / sizeof (table[0]))
54 int
55 main (void)
57 int i;
59 for (i = 0; i < N(ints); i++)
61 if (ints[i] != 0
62 && __builtin_clz (ints[i]) != my_clz (ints[i]))
63 abort ();
66 exit (0);
67 return 0;