Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / sve / popcount_1_run.c
blob7494dfd51612d40f529a7ac939d38791a2937252
1 /* { dg-do run { target aarch64_sve_hw } } */
2 /* { dg-options "-O2 -ftree-vectorize" } */
4 #include "popcount_1.c"
6 extern void abort (void) __attribute__ ((noreturn));
8 unsigned int data[] = {
9 0x11111100, 6,
10 0xe0e0f0f0, 14,
11 0x9900aab3, 13,
12 0x00040003, 3,
13 0x000e000c, 5,
14 0x22227777, 16,
15 0x12341234, 10,
16 0x0, 0
19 int __attribute__ ((optimize (1)))
20 main (void)
22 unsigned int count = sizeof (data) / sizeof (data[0]) / 2;
24 uint32_t in32[count];
25 unsigned int out32[count];
26 for (unsigned int i = 0; i < count; ++i)
28 in32[i] = data[i * 2];
29 asm volatile ("" ::: "memory");
31 popcount_32 (out32, in32, count);
32 for (unsigned int i = 0; i < count; ++i)
33 if (out32[i] != data[i * 2 + 1])
34 abort ();
36 count /= 2;
37 uint64_t in64[count];
38 unsigned int out64[count];
39 for (unsigned int i = 0; i < count; ++i)
41 in64[i] = ((uint64_t) data[i * 4] << 32) | data[i * 4 + 2];
42 asm volatile ("" ::: "memory");
44 popcount_64 (out64, in64, count);
45 for (unsigned int i = 0; i < count; ++i)
46 if (out64[i] != data[i * 4 + 1] + data[i * 4 + 3])
47 abort ();
49 return 0;