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-2.c] - Blame information for rev 704

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run { target { bmi } } } */
2
/* { dg-options "-O2 -mbmi -fno-inline" } */
3
 
4
#include <x86intrin.h>
5
 
6
#include "bmi-check.h"
7
 
8
int calc_tzcnt_u32 (int src)
9
{
10
  int i;
11
  int res = 0;
12
 
13
  while ( (res<32) && ((src&1) == 0)) {
14
    ++res;
15
    src >>= 1;
16
  }
17
  return res;
18
}
19
 
20
static void
21
bmi_test ()
22
{
23
  unsigned i;
24
  int src = 0xfacec0ff;
25
  int res, res_ref;
26
 
27
  for (i=0; i<5; ++i) {
28
    src = i + src << i;
29
 
30
    res_ref = calc_tzcnt_u32 (src);
31
    res = __tzcnt_u32 (src);
32
 
33
    if (res != res_ref)
34
      abort();
35
  }
36
}

powered by: WebSVN 2.1.0

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