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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [bmi-tzcnt-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 { bmi && { ! ia32 } } } } */
2
/* { dg-options "-O2 -mbmi -fno-inline" } */
3
 
4
#include <x86intrin.h>
5
 
6
#include "bmi-check.h"
7
 
8
long long calc_tzcnt_u64 (long long src)
9
{
10
  int i;
11
  int res = 0;
12
 
13
  while ( (res<64) && ((src&1) == 0)) {
14
    ++res;
15
    src >>= 1;
16
  }
17
 
18
  return res;
19
}
20
 
21
static void
22
bmi_test ()
23
{
24
  unsigned i;
25
  long long src = 0xfacec0ffeefacec0;
26
  long long res, res_ref;
27
 
28
  for (i=0; i<5; ++i) {
29
    src = i + src << i;
30
 
31
    res_ref = calc_tzcnt_u64 (src);
32
    res = __tzcnt_u64 (src);
33
 
34
    if (res != res_ref)
35
      abort();
36
  }
37
}

powered by: WebSVN 2.1.0

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