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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [bmi2-bzhi32-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 { bmi2 } } } */
2
/* { dg-options "-mbmi2 -O2" } */
3
 
4
#include <x86intrin.h>
5
#include "bmi2-check.h"
6
 
7
__attribute__((noinline))
8
unsigned
9
calc_bzhi_u32 (unsigned a, int l)
10
{
11
  unsigned res = a;
12
  int i;
13
  for (i = 0; i < 32 - l; ++i)
14
    res &= ~(1 << (31 - i));
15
 
16
  return res;
17
}
18
 
19
static void
20
bmi2_test ()
21
{
22
  unsigned i;
23
  unsigned src = 0xce7ace0f;
24
  unsigned res, res_ref;
25
 
26
  for (i = 0; i < 5; ++i) {
27
    src = src * (i + 1);
28
 
29
    res_ref = calc_bzhi_u32 (src, i * 2);
30
    res = _bzhi_u32 (src, i * 2);
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.