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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse4_2-popcnt.h] - Blame information for rev 691

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
#include "sse4_2-check.h"
2
 
3
#include <nmmintrin.h>
4
 
5
#define NUM 1024
6
 
7
static int
8
compute_popcnt (TYPE v)
9
{
10
  int ret;
11
  int i;
12
 
13
 ret = 0;
14
 for (i = 0; i < sizeof(v) * 8; i++)
15
   if ((v & ((TYPE)1 << (TYPE) i)))
16
     ret++;
17
 
18
 return ret;
19
}
20
 
21
static void
22
sse4_2_test (void)
23
{
24
  int i;
25
  TYPE vals[NUM];
26
  TYPE res;
27
 
28
 for (i = 0; i < NUM; i++)
29
   {
30
     vals[i] = rand ();
31
     if (sizeof (TYPE) > 4)
32
       vals[i] |= (TYPE)rand() << (TYPE)(sizeof (TYPE) * 4);
33
   }
34
 
35
 for (i=0; i < NUM; i++)
36
   {
37
     res = POPCNT (vals[i]);
38
     if (res != compute_popcnt (vals[i]))
39
       abort ();
40
   }
41
}

powered by: WebSVN 2.1.0

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