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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [lzcnt-2.c] - Blame information for rev 848

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

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run { target { lzcnt } } } */
2
/* { dg-options "-O2 -mlzcnt -fno-inline" } */
3
 
4
#include <x86intrin.h>
5
 
6
#include "lzcnt-check.h"
7
 
8
short calc_lzcnt_u16 (short src)
9
{
10
  int i;
11
  short res = 0;
12
 
13
  while ((res < 16) && (((src >> (15 - res)) & 1) == 0))
14
    ++res;
15
 
16
  return res;
17
}
18
 
19
static void
20
lzcnt_test ()
21
{
22
  unsigned i;
23
  short src = 0x7ace;
24
  short res, res_ref;
25
 
26
  for (i=0; i<5; ++i) {
27
    src = src >> i;
28
 
29
    res_ref = calc_lzcnt_u16 (src);
30
    res = __lzcnt16 (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.