Handle T_HRESULT types in CodeView records
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / p8vector-vectorize-4.c
blob4cf3b88b38814ae9c5ab9a297ea79bbedf5146f3
1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-options "-mdejagnu-cpu=power8 -mvsx -O2 -ftree-vectorize -fvect-cost-model=dynamic -fno-unroll-loops -fno-unroll-all-loops" } */
4 /* { dg-require-effective-target powerpc_vsx } */
6 #ifndef SIZE
7 #define SIZE 1024
8 #endif
10 #ifndef ALIGN
11 #define ALIGN 32
12 #endif
14 #define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
16 #define DO_BUILTIN(PREFIX, TYPE, CLZ, POPCNT) \
17 TYPE PREFIX ## _a[SIZE] ALIGN_ATTR; \
18 TYPE PREFIX ## _b[SIZE] ALIGN_ATTR; \
20 void \
21 PREFIX ## _clz (void) \
22 { \
23 unsigned long i; \
25 for (i = 0; i < SIZE; i++) \
26 PREFIX ## _a[i] = CLZ (PREFIX ## _b[i]); \
27 } \
29 void \
30 PREFIX ## _popcnt (void) \
31 { \
32 unsigned long i; \
34 for (i = 0; i < SIZE; i++) \
35 PREFIX ## _a[i] = POPCNT (PREFIX ## _b[i]); \
38 #if !defined(DO_LONG_LONG) && !defined(DO_LONG) && !defined(DO_INT) && !defined(DO_SHORT) && !defined(DO_CHAR)
39 #define DO_INT 1
40 #endif
42 #if DO_LONG_LONG
43 /* At the moment, only int is auto vectorized. */
44 DO_BUILTIN (sll, long long, __builtin_clzll, __builtin_popcountll)
45 DO_BUILTIN (ull, unsigned long long, __builtin_clzll, __builtin_popcountll)
46 #endif
48 #if defined(_ARCH_PPC64) && DO_LONG
49 DO_BUILTIN (sl, long, __builtin_clzl, __builtin_popcountl)
50 DO_BUILTIN (ul, unsigned long, __builtin_clzl, __builtin_popcountl)
51 #endif
53 #if DO_INT
54 DO_BUILTIN (si, int, __builtin_clz, __builtin_popcount)
55 DO_BUILTIN (ui, unsigned int, __builtin_clz, __builtin_popcount)
56 #endif
58 #if DO_SHORT
59 DO_BUILTIN (ss, short, __builtin_clz, __builtin_popcount)
60 DO_BUILTIN (us, unsigned short, __builtin_clz, __builtin_popcount)
61 #endif
63 #if DO_CHAR
64 DO_BUILTIN (sc, signed char, __builtin_clz, __builtin_popcount)
65 DO_BUILTIN (uc, unsigned char, __builtin_clz, __builtin_popcount)
66 #endif
68 /* { dg-final { scan-assembler-times "vclzw" 2 } } */
69 /* { dg-final { scan-assembler-times "vpopcntw" 2 } } */