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] - Rev 704

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

/* { dg-do run { target { lzcnt && { ! ia32 } } } } */
/* { dg-options "-O2 -mlzcnt -fno-inline" } */
 
#include <x86intrin.h>
 
#include "lzcnt-check.h"
 
long long calc_lzcnt_u64 (long long src)
{
  int i;
  int res = 0;
 
  while ((res < 64) && (((src >> (63 - res)) & 1) == 0))
    ++res;
 
  return res;
}
 
static void
lzcnt_test ()
{
  unsigned i;
  long long src = 0xce7ace0ce7ace0;
  long long res, res_ref;
 
  for (i=0; i<5; ++i) {
    src = src >> i;
 
    res_ref = calc_lzcnt_u64 (src);
    res = __lzcnt64 (src);
 
    if (res != res_ref)
      abort();
  }
}
 

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

powered by: WebSVN 2.1.0

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