2 /* { dg-options "-O3 -mcpu=power7" } */
3 /* { dg-require-effective-target lp64 } */
4 /* { dg-require-effective-target vsx_hw } */
5 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
6 /* { dg-require-effective-target ppc_cpu_supports_hw } */
8 #define NO_WARN_X86_INTRINSICS 1
10 #include "bmi2-check.h"
12 __attribute__((noinline
))
14 calc_pdep_u64 (unsigned long long a
, unsigned long long mask
)
16 unsigned long long res
= 0;
17 unsigned long long i
, k
= 0;
19 for (i
= 0; i
< 64; ++i
)
20 if (mask
& (1LL << i
)) {
21 res
|= ((a
& (1LL << k
)) >> k
) << i
;
32 unsigned long long src
= 0xce7acce7acce7ac;
33 unsigned long long res
, res_ref
;
35 for (i
= 0; i
< 5; ++i
) {
38 res_ref
= calc_pdep_u64 (src
, ~(i
* 3));
39 res
= _pdep_u64 (src
, ~(i
* 3));