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/] [sse4a-extract.c] - Blame information for rev 318

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 318 jeremybenn
/* { dg-do run } */
2
/* { dg-require-effective-target sse4a } */
3
/* { dg-options "-O2 -msse4a" } */
4
 
5
#include "sse4a-check.h"
6
 
7
#include <ammintrin.h>
8
 
9
typedef union
10
{
11
  long long i[2];
12
  __m128i vec;
13
} LI;
14
 
15
static long long
16
sse4a_test_extrq (long long in)
17
{
18
  __m128i v1, v2;
19
  long long index_length, pad;
20
  LI v_out;
21
  index_length = 0x0000000000000810LL;
22
  pad = 0x0;
23
  v1 = _mm_set_epi64x (pad, in);
24
  v2 = _mm_set_epi64x (pad, index_length);
25
  v_out.vec = _mm_extract_si64 (v1, v2);
26
  return (v_out.i[0]);
27
}
28
 
29
static long long
30
sse4a_test_extrqi (long long in)
31
{
32
  __m128i v1;
33
  long long pad =0x0;
34
  LI v_out;
35
  v1 = _mm_set_epi64x (pad, in);
36
  v_out.vec = _mm_extracti_si64 (v1, (unsigned int) 0x10,(unsigned int) 0x08);
37
  return (v_out.i[0]);
38
}
39
 
40
static chk (long long i1, long long i2)
41
{
42
  int n_fails =0;
43
  if (i1 != i2)
44
    n_fails +=1;
45
  return n_fails;
46
}
47
 
48
long long vals_in[5] =
49
  {
50
    0x1234567887654321LL,
51
    0x1456782093002490LL,
52
    0x2340909123990390LL,
53
    0x9595959599595999LL,
54
    0x9099038798000029LL
55
  };
56
 
57
long long vals_out[5] =
58
  {
59
    0x0000000000006543LL,
60
    0x0000000000000024LL,
61
    0x0000000000009903LL,
62
    0x0000000000005959LL,
63
    0x0000000000000000LL
64
  };
65
 
66
static void
67
sse4a_test (void)
68
{
69
  int i;
70
  int fail = 0;
71
  long long out;
72
 
73
  for (i = 0; i < 5; i += 1)
74
    {
75
      out = sse4a_test_extrq (vals_in[i]);
76
      fail += chk(out, vals_out[i]);
77
 
78
      out = sse4a_test_extrqi (vals_in[i]);
79
      fail += chk(out, vals_out[i]);
80
    }
81
 
82
  if (fail != 0)
83
    abort ();
84
}

powered by: WebSVN 2.1.0

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