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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [avx2-vpacksswb-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 char
8
short_to_byte (short iVal)
9
{
10
  char sVal;
11
 
12
  if (iVal < -128)
13
    sVal = -128;
14
  else if (iVal > 127)
15
    sVal = 127;
16
  else
17
    sVal = iVal;
18
 
19
  return sVal;
20
}
21
 
22
void static
23
avx2_test (void)
24
{
25
  union256i_w s1, s2;
26
  union256i_b u;
27
  char e[32];
28
  int i;
29
 
30
  s1.x = _mm256_set_epi16 (1, 2, 3, 4, 6500, 20, 30, 90,
31
                           88, 44, 33, 22, 11, 98, 78, -1000);
32
 
33
  s2.x = _mm256_set_epi16 (88, 44, 33, 22, 11, 98, 76, -650,
34
                           1, 2, 3, 4, 6500, 20, 30, 90);
35
 
36
  u.x = _mm256_packs_epi16 (s1.x, s2.x);
37
 
38
  for (i = 0; i < 8; i++)
39
    {
40
      e[i] = short_to_byte (s1.a[i]);
41
      e[i + 8] = short_to_byte (s2.a[i]);
42
      e[i + 16] = short_to_byte (s1.a[i + 8]);
43
      e[i + 24] = short_to_byte (s2.a[i + 8]);
44
    }
45
 
46
  if (check_union256i_b (u, e))
47
    abort ();
48
}

powered by: WebSVN 2.1.0

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