1 /* { dg-do run { target { bmi2 && { ! ia32 } } } } */
2 /* { dg-options "-mbmi2 -O2" } */
5 #include "bmi2-check.h"
7 __attribute__((noinline
))
9 calc_mul_u64 (unsigned long long volatile a
, unsigned long long b
)
11 unsigned __int128 res
= 0;
13 for (i
= 0; i
< b
; ++i
)
14 res
+= (unsigned __int128
) a
;
19 __attribute__((noinline
))
21 calc_mulx_u64 (unsigned long long x
,
23 unsigned long long *res_h
)
25 return _mulx_u64 (x
, y
, res_h
);
33 unsigned long long a
= 0xce7ace0ce7ace0;
34 unsigned long long b
= 0xface;
35 unsigned long long res_l
, res_h
;
36 unsigned __int128 res
, res_ref
;
42 res_ref
= calc_mul_u64 (a
, b
);
44 res_l
= calc_mulx_u64 (a
, b
, &res_h
);
46 res
= ((unsigned __int128
) res_h
<< 64) | res_l
;