Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / bmi2-mulx32-2.c
blobb8327741c3a052ffabdb1a9476198ee19ebaed48
1 /* { dg-do run } */
2 /* { dg-options "-O3" } */
3 /* { dg-require-effective-target lp64 } */
4 /* { dg-require-effective-target ppc_cpu_supports_hw } */
6 #define NO_WARN_X86_INTRINSICS 1
7 #include <x86intrin.h>
8 #include "bmi2-check.h"
10 __attribute__((noinline))
11 unsigned long long
12 calc_mul_u32 (unsigned volatile a, unsigned b)
14 unsigned long long res = 0;
15 int i;
16 for (i = 0; i < b; ++i)
17 res += a;
19 return res;
22 __attribute__((noinline))
23 unsigned calc_mulx_u32 (unsigned x, unsigned y, unsigned *res_h)
25 return (unsigned) _mulx_u32 (x, y, res_h);
28 static void
29 bmi2_test ()
31 unsigned i;
32 unsigned a = 0xce7ace0;
33 unsigned b = 0xfacefff;
34 unsigned res_l, res_h;
35 unsigned long long res, res_ref;
37 for (i = 0; i < 5; ++i) {
38 a = a * (i + 1);
39 b = b / (i + 1);
41 res_ref = calc_mul_u32 (a, b);
42 res_l = calc_mulx_u32 (a, b, &res_h);
44 res = ((unsigned long long) res_h << 32) | res_l;
46 if (res != res_ref)
47 abort();