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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [avx2-vpmulhrsw-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 } */
2
/* { dg-options "-mavx2 -O2" } */
3
/* { dg-require-effective-target avx2 } */
4
 
5
#include "avx2-check.h"
6
 
7
static void
8
compute_pmulhrsw256 (short *s1, short *s2, short *r)
9
{
10
  int i;
11
  int t0;
12
 
13
  for (i = 0; i < 16; i++)
14
    {
15
      t0 = (((int) s1[i] * (int) s2[i]) >> 14) + 1;
16
      r[i] = (short) (t0 >> 1);
17
    }
18
}
19
 
20
static void
21
avx2_test (void)
22
{
23
  union256i_w s1, s2, res;
24
  short res_ref[16];
25
  int i, j, sign = 1;
26
  int fail = 0;
27
 
28
  for (i = 0; i < 10; i++)
29
    {
30
      for (j = 0; j < 16; j++)
31
        {
32
          s1.a[j] = i * j * sign;
33
          s2.a[j] = (j + 20) * sign;
34
          sign = -sign;
35
        }
36
 
37
      res.x = _mm256_mulhrs_epi16 (s1.x, s2.x);
38
 
39
      compute_pmulhrsw256 (s1.a, s2.a, res_ref);
40
 
41
      fail += check_union256i_w (res, res_ref);
42
    }
43
 
44
  if (fail != 0)
45
    abort ();
46
}

powered by: WebSVN 2.1.0

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