Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-early-break_71.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_ffs##suffix(type x) { \
19 int i; \
20 if (x == 0) \
21 return 0; \
22 for (i = 0; i < CHAR_BIT * sizeof (type); i++) \
23 if (x & ((type) 1 << i)) \
24 break; \
25 return i + 1; \
26 }
27
28 MAKE_FUNS (, unsigned);
29
30 extern void abort (void);
31 extern void exit (int);
32
33 #define NUMS32 \
34 { \
35 0x00000000UL, \
36 0x00000001UL, \
37 0x80000000UL, \
38 0x00000002UL, \
39 0x40000000UL, \
40 0x00010000UL, \
41 0x00008000UL, \
42 0xa5a5a5a5UL, \
43 0x5a5a5a5aUL, \
44 0xcafe0000UL, \
45 0x00cafe00UL, \
46 0x0000cafeUL, \
47 0xffffffffUL \
48 }
49
50
51 unsigned int ints[] = NUMS32;
52
53 #define N(table) (sizeof (table) / sizeof (table[0]))
54
55 int
56 main (void)
57 {
58 int i;
59
60 check_vect ();
61
62 #pragma GCC novector
63 for (i = 0; i < N(ints); i++)
64 {
65 if (__builtin_ffs (ints[i]) != my_ffs (ints[i]))
66 abort ();
67 }
68
69 exit (0);
70 }
71