OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [bmi2-mulx32-1.c] - Blame information for rev 691

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run { target { bmi2 && { ia32 } } } } */
2
/* { dg-options "-mbmi2 -O2" } */
3
 
4
#include "bmi2-check.h"
5
 
6
__attribute__((noinline))
7
unsigned long long
8
calc_mul_u32 (unsigned volatile a, unsigned b)
9
{
10
  unsigned long long res = 0;
11
  int i;
12
  for (i = 0; i < b; ++i)
13
    res += a;
14
 
15
  return res;
16
}
17
 
18
__attribute__((noinline, regparm (2)))
19
unsigned long long
20
gen_mulx (unsigned a, unsigned b)
21
{
22
  unsigned long long res;
23
 
24
  res = (unsigned long long)a * b;
25
 
26
  return res;
27
}
28
 
29
static void
30
bmi2_test ()
31
{
32
  unsigned i;
33
  unsigned a = 0xce7ace0;
34
  unsigned b = 0xfacefff;
35
  unsigned long long res, res_ref;
36
 
37
  for (i = 0; i < 5; ++i) {
38
    a = a * (i + 1);
39
    b = b / (i + 1);
40
 
41
    res_ref = calc_mul_u32 (a, b);
42
    res = gen_mulx (a, b);
43
 
44
    if (res != res_ref)
45
      abort();
46
  }
47
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.