i386: Adjust rtx cost for imulq and imulw [PR115749]
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-early-break_72.c
blobc6d1e9f5fd26d1348db9287a3adcc57ee4c2fc37
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 #if __INT_MAX__ > 2147483647L
13 # if __INT_MAX__ >= 9223372036854775807L
14 # define BITSIZEOF_INT 64
15 # else
16 # define BITSIZEOF_INT 32
17 # endif
18 #else
19 # if __INT_MAX__ >= 2147483647L
20 # define BITSIZEOF_INT 32
21 # else
22 # define BITSIZEOF_INT 16
23 # endif
24 #endif
26 #if __LONG_MAX__ > 2147483647L
27 # if __LONG_MAX__ >= 9223372036854775807L
28 # define BITSIZEOF_LONG 64
29 # else
30 # define BITSIZEOF_LONG 32
31 # endif
32 #else
33 # define BITSIZEOF_LONG 32
34 #endif
36 #if __LONG_LONG_MAX__ > 2147483647L
37 # if __LONG_LONG_MAX__ >= 9223372036854775807L
38 # define BITSIZEOF_LONG_LONG 64
39 # else
40 # define BITSIZEOF_LONG_LONG 32
41 # endif
42 #else
43 # define BITSIZEOF_LONG_LONG 32
44 #endif
46 #define MAKE_FUNS(suffix, type) \
47 __attribute__((noinline)) \
48 int my_ctz##suffix(type x) { \
49 int i; \
50 for (i = 0; i < CHAR_BIT * sizeof (type); i++) \
51 if (x & ((type) 1 << i)) \
52 break; \
53 return i; \
56 MAKE_FUNS (, unsigned);
58 extern void abort (void);
59 extern void exit (int);
61 #define NUMS16 \
62 { \
63 0x0000U, \
64 0x0001U, \
65 0x8000U, \
66 0x0002U, \
67 0x4000U, \
68 0x0100U, \
69 0x0080U, \
70 0xa5a5U, \
71 0x5a5aU, \
72 0xcafeU, \
73 0xffffU \
76 #define NUMS32 \
77 { \
78 0x00000000UL, \
79 0x00000001UL, \
80 0x80000000UL, \
81 0x00000002UL, \
82 0x40000000UL, \
83 0x00010000UL, \
84 0x00008000UL, \
85 0xa5a5a5a5UL, \
86 0x5a5a5a5aUL, \
87 0xcafe0000UL, \
88 0x00cafe00UL, \
89 0x0000cafeUL, \
90 0xffffffffUL \
93 #define NUMS64 \
94 { \
95 0x0000000000000000ULL, \
96 0x0000000000000001ULL, \
97 0x8000000000000000ULL, \
98 0x0000000000000002ULL, \
99 0x4000000000000000ULL, \
100 0x0000000100000000ULL, \
101 0x0000000080000000ULL, \
102 0xa5a5a5a5a5a5a5a5ULL, \
103 0x5a5a5a5a5a5a5a5aULL, \
104 0xcafecafe00000000ULL, \
105 0x0000cafecafe0000ULL, \
106 0x00000000cafecafeULL, \
107 0xffffffffffffffffULL \
110 unsigned int ints[] =
111 #if BITSIZEOF_INT == 64
112 NUMS64;
113 #elif BITSIZEOF_INT == 32
114 NUMS32;
115 #else
116 NUMS16;
117 #endif
119 unsigned long longs[] =
120 #if BITSIZEOF_LONG == 64
121 NUMS64;
122 #else
123 NUMS32;
124 #endif
126 unsigned long long longlongs[] =
127 #if BITSIZEOF_LONG_LONG == 64
128 NUMS64;
129 #else
130 NUMS32;
131 #endif
133 #define N(table) (sizeof (table) / sizeof (table[0]))
136 main (void)
138 int i;
140 check_vect ();
142 #pragma GCC novector
143 for (i = 0; i < N(ints); i++)
145 if (ints[i] != 0
146 && __builtin_ctz (ints[i]) != my_ctz (ints[i]))
147 abort ();
150 exit (0);