]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/powerpc/bmi2-pext64-1a.c
Get rid of dg-skip-if etc. default args
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / powerpc / bmi2-pext64-1a.c
1 /* { dg-do compile } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-options "-O3 -mcpu=power7" } */
4 /* { dg-require-effective-target lp64 } */
5 /* { dg-require-effective-target powerpc_vsx_ok } */
6 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
7
8 #define NO_WARN_X86_INTRINSICS 1
9 #include <x86intrin.h>
10
11 unsigned long long
12 test__pexp_cmask_u64 (unsigned long long a[4])
13 {
14 /* The _pext implmentation is nominally a popcount of the mask,
15 followed by a loop using count leading zeros to find the
16 next bit to process.
17 If the mask is a const, the popcount should be folded and
18 the constant propagation should eliminate the mask
19 generation loop and produce a single constant bpermd permute
20 control word.
21 This test verifies that the compiler is replacing the mask
22 popcount and loop with a const bperm control and generating
23 the bpermd for this case. */
24 const unsigned long mask = 0x00000000100000a4UL;
25 unsigned long res;
26 res = _pext_u64 (a[0], mask);
27 res = (res << 8) | _pext_u64 (a[1], mask);
28 res = (res << 8) | _pext_u64 (a[2], mask);
29 res = (res << 8) | _pext_u64 (a[3], mask);
30 return (res);
31 }
32 /* the resulting assembler should have 4 X bpermd and no popcntd or
33 cntlzd instructions. */
34
35 /* { dg-final { scan-assembler-times "bpermd" 4 } } */
36 /* { dg-final { scan-assembler-not "popcntd" } } */
37 /* { dg-final { scan-assembler-not "cntlzd" } } */