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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse4_2-popcnt.h] - Rev 318

Compare with Previous | Blame | View Log

#include "sse4_2-check.h"
 
#include <nmmintrin.h>
 
#define NUM 1024
 
static int
compute_popcnt (TYPE v)
{
  int ret;
  int i;
 
 ret = 0;
 for (i = 0; i < sizeof(v) * 8; i++)
   if ((v & ((TYPE)1 << (TYPE) i)))
     ret++;
 
 return ret;
}
 
static void
sse4_2_test (void)
{
  int i;
  TYPE vals[NUM];
  TYPE res;
 
 for (i = 0; i < NUM; i++)
   {
     vals[i] = rand ();
     if (sizeof (TYPE) > 4)
       vals[i] |= (TYPE)rand() << (TYPE)(sizeof (TYPE) * 4);
   }
 
 for (i=0; i < NUM; i++)
   { 
     res = POPCNT (vals[i]);
     if (res != compute_popcnt (vals[i]))
       abort ();
   }
}
 

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.