Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-early-break_73.c

raw
1 /* { dg-add-options vect_early_break } */
2 /* { dg-require-effective-target vect_early_break_hw } */
3 /* { dg-require-effective-target vect_int } */
4
5 /* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target { ! "x86_64-*-* i?86-*-*" } } } } */
6
7 #include <limits.h>
8 #include <assert.h>
9
10 #include "tree-vect.h"
11
12 # define BITSIZEOF_INT 32
13 # define BITSIZEOF_LONG 64
14 # define BITSIZEOF_LONG_LONG 64
15
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; \
24 }
25
26
27 MAKE_FUNS (, unsigned);
28
29 extern void abort (void);
30 extern void exit (int);
31
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 \
47 }
48
49
50 unsigned int ints[] = NUMS32;
51
52 #define N(table) (sizeof (table) / sizeof (table[0]))
53
54 int
55 main (void)
56 {
57 int i;
58
59 check_vect ();
60
61 #pragma GCC novector
62 for (i = 0; i < N(ints); i++)
63 {
64 if (ints[i] != 0
65 && __builtin_clz (ints[i]) != my_clz (ints[i]))
66 abort ();
67 }
68
69 exit (0);
70 }
71