2 /* { dg-options "-O3 -mdejagnu-cpu=power7" } */
3 /* { dg-require-effective-target lp64 } */
4 /* { dg-require-effective-target vsx_hw } */
5 /* { dg-require-effective-target ppc_cpu_supports_hw } */
7 #define NO_WARN_X86_INTRINSICS 1
9 #include "bmi2-check.h"
11 __attribute__((noinline
))
13 calc_pdep_u64 (unsigned long long a
, unsigned long long mask
)
15 unsigned long long res
= 0;
16 unsigned long long i
, k
= 0;
18 for (i
= 0; i
< 64; ++i
)
19 if (mask
& (1LL << i
)) {
20 res
|= ((a
& (1LL << k
)) >> k
) << i
;
31 unsigned long long src
= 0xce7acce7acce7ac;
32 unsigned long long res
, res_ref
;
34 for (i
= 0; i
< 5; ++i
) {
37 res_ref
= calc_pdep_u64 (src
, ~(i
* 3));
38 res
= _pdep_u64 (src
, ~(i
* 3));