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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [avx2-i64gatherpd-4.c] - Blame information for rev 704

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

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run } */
2
/* { dg-require-effective-target avx2 } */
3
/* { dg-options "-O2 -mavx2" } */
4
 
5
#include <string.h>
6
#include "avx2-check.h"
7
 
8
static void
9
compute_i64gatherpd (double *src,
10
                     double *s1,
11
                     long long int *s2, double *mask, int scale, double *r)
12
{
13
  int i;
14
 
15
  for (i = 0; i < 2; ++i)
16
    if ((((long long *) mask)[i] >> 63) & 1)
17
      r[i] = *(double *) (((unsigned char *) s1) + s2[i] * scale);
18
    else
19
      r[i] = src[i];
20
}
21
 
22
void static
23
avx2_test (void)
24
{
25
  int i;
26
  union128i_q idx;
27
  union128d res, src, mask;
28
  double s1[2], res_ref[2] = { 0, 0 };
29
 
30
  for (i = 0; i < 2; ++i)
31
    {
32
      /* Set some stuff */
33
      s1[i] = 2.718281828459045 * (i + 1) * (i + 2);
34
 
35
      /* Set src as something different from s1 */
36
      src.a[i] = -s1[i];
37
 
38
      /* Mask out evens */
39
      ((long long *) mask.a)[i] = i % 2 ? 0 : -1;
40
 
41
      /* About to gather in reverse order,
42
         divide by 2 to demonstrate scale */
43
      idx.a[i] = (16 - (i + 1) * 8) >> 1;
44
    }
45
 
46
  res.x = _mm_mask_i64gather_pd (src.x, s1, idx.x, mask.x, 2);
47
 
48
  compute_i64gatherpd (src.a, s1, idx.a, mask.a, 2, res_ref);
49
 
50
  if (check_union128d (res, res_ref) != 0)
51
    abort ();
52
}

powered by: WebSVN 2.1.0

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