1 /* { dg-do run { target { bmi2 && ia32 } } } */
2 /* { dg-options "-mbmi2 -O2" } */
6 #include "bmi2-check.h"
8 __attribute__((noinline
))
10 calc_mul_u32 (unsigned volatile a
, unsigned b
)
12 unsigned long long res
= 0;
14 for (i
= 0; i
< b
; ++i
)
20 __attribute__((noinline
, regparm (2)))
21 unsigned calc_mulx_u32 (unsigned x
, unsigned y
, unsigned *res_h
)
23 return (unsigned) _mulx_u32 (x
, y
, res_h
);
30 unsigned a
= 0xce7ace0;
31 unsigned b
= 0xfacefff;
32 unsigned res_l
, res_h
;
33 unsigned long long res
, res_ref
;
35 for (i
= 0; i
< 5; ++i
) {
39 res_ref
= calc_mul_u32 (a
, b
);
40 res_l
= calc_mulx_u32 (a
, b
, &res_h
);
42 res
= ((unsigned long long) res_h
<< 32) | res_l
;