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

Subversion Repositories openrisc

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

powered by: WebSVN 2.1.0

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