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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse4a-insert.c] - Blame information for rev 724

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 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_insert (long long in1, long long in2)
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, in1);
24
  v2 = _mm_set_epi64x (index_length, in2);
25
  v_out.vec = _mm_insert_si64 (v1, v2);
26
  return (v_out.i[0]);
27
}
28
 
29
static long long
30
sse4a_test_inserti (long long in1, long long in2)
31
{
32
  __m128i v1,v2;
33
  long long pad = 0x0;
34
  LI v_out;
35
  v1 = _mm_set_epi64x (pad, in1);
36
  v2 = _mm_set_epi64x (pad, in2);
37
  v_out.vec = _mm_inserti_si64 (v1, v2, (unsigned int) 0x10, (unsigned int) 0x08);
38
  return (v_out.i[0]);
39
}
40
 
41
static chk (long long i1, long long i2)
42
{
43
  int n_fails =0;
44
  if (i1 != i2)
45
    n_fails +=1;
46
  return n_fails;
47
}
48
 
49
long long vals_in1[5] =
50
  {
51
    0x1234567887654321LL,
52
    0x1456782093002490LL,
53
    0x2340909123990390LL,
54
    0x9595959599595999LL,
55
    0x9099038798000029LL
56
  };
57
 
58
long long vals_in2[5] =
59
  {
60
    0x9ABCDEF00FEDCBA9LL,
61
    0x234567097289672ALL,
62
    0x45476453097BD342LL,
63
    0x23569012AE586FF0LL,
64
    0x432567ABCDEF765DLL
65
  };
66
 
67
long long vals_out[5] =
68
  {
69
    0x1234567887CBA921LL,
70
    0x1456782093672A90LL,
71
    0x2340909123D34290LL,
72
    0x95959595996FF099LL,
73
    0x9099038798765D29LL
74
  };
75
 
76
static void
77
sse4a_test (void)
78
{
79
  int i;
80
  int fail = 0;
81
  long long out;
82
 
83
  for (i = 0; i < 5; i += 1)
84
    {
85
      out = sse4a_test_insert (vals_in1[i], vals_in2[i]);
86
      fail += chk(out, vals_out[i]);
87
 
88
      out = sse4a_test_inserti (vals_in1[i], vals_in2[i]);
89
      fail += chk(out, vals_out[i]);
90
    }
91
 
92
  if (fail != 0)
93
    abort ();
94
}

powered by: WebSVN 2.1.0

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