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/] [sse4_1-pinsrb.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 sse4 } */
3
/* { dg-options "-O2 -msse4.1" } */
4
 
5
#ifndef CHECK_H
6
#define CHECK_H "sse4_1-check.h"
7
#endif
8
 
9
#ifndef TEST
10
#define TEST sse4_1_test
11
#endif
12
 
13
#include CHECK_H
14
 
15
#include <smmintrin.h>
16
#include <string.h>
17
 
18
#define msk0 0x00
19
#define msk1 0x01
20
#define msk2 0x02
21
#define msk3 0x03
22
#define msk4 0x04
23
#define msk5 0x05
24
#define msk6 0x06
25
#define msk7 0x07
26
#define msk8 0x08
27
#define msk9 0x09
28
#define mskA 0x0A
29
#define mskB 0x0B
30
#define mskC 0x0C
31
#define mskD 0x0D
32
#define mskE 0x0E
33
#define mskF 0x0F
34
 
35
static void
36
TEST (void)
37
{
38
  union
39
    {
40
      __m128i x;
41
      unsigned int i[4];
42
      unsigned char c[16];
43
    } res [16], val, tmp;
44
  int masks[16];
45
  unsigned char ins[4] = { 3, 4, 5, 6 };
46
  int i;
47
 
48
  val.i[0] = 0x35251505;
49
  val.i[1] = 0x75655545;
50
  val.i[2] = 0xB5A59585;
51
  val.i[3] = 0xF5E5D5C5;
52
 
53
  /* Check pinsrb imm8, r32, xmm.  */
54
  res[0].x = _mm_insert_epi8 (val.x, ins[0], msk0);
55
  res[1].x = _mm_insert_epi8 (val.x, ins[0], msk1);
56
  res[2].x = _mm_insert_epi8 (val.x, ins[0], msk2);
57
  res[3].x = _mm_insert_epi8 (val.x, ins[0], msk3);
58
  res[4].x = _mm_insert_epi8 (val.x, ins[0], msk4);
59
  res[5].x = _mm_insert_epi8 (val.x, ins[0], msk5);
60
  res[6].x = _mm_insert_epi8 (val.x, ins[0], msk6);
61
  res[7].x = _mm_insert_epi8 (val.x, ins[0], msk7);
62
  res[8].x = _mm_insert_epi8 (val.x, ins[0], msk8);
63
  res[9].x = _mm_insert_epi8 (val.x, ins[0], msk9);
64
  res[10].x = _mm_insert_epi8 (val.x, ins[0], mskA);
65
  res[11].x = _mm_insert_epi8 (val.x, ins[0], mskB);
66
  res[12].x = _mm_insert_epi8 (val.x, ins[0], mskC);
67
  res[13].x = _mm_insert_epi8 (val.x, ins[0], mskD);
68
  res[14].x = _mm_insert_epi8 (val.x, ins[0], mskE);
69
  res[15].x = _mm_insert_epi8 (val.x, ins[0], mskF);
70
 
71
  masks[0] = msk0;
72
  masks[1] = msk1;
73
  masks[2] = msk2;
74
  masks[3] = msk3;
75
  masks[4] = msk4;
76
  masks[5] = msk5;
77
  masks[6] = msk6;
78
  masks[7] = msk7;
79
  masks[8] = msk8;
80
  masks[9] = msk9;
81
  masks[10] = mskA;
82
  masks[11] = mskB;
83
  masks[12] = mskC;
84
  masks[13] = mskD;
85
  masks[14] = mskE;
86
  masks[15] = mskF;
87
 
88
  for (i = 0; i < 16; i++)
89
    {
90
      tmp.x = val.x;
91
      tmp.c[masks[i]] = ins[0];
92
      if (memcmp (&tmp, &res[i], sizeof (tmp)))
93
        abort ();
94
    }
95
 
96
  /* Check pinsrb imm8, m8, xmm.  */
97
  for (i = 0; i < 16; i++)
98
    {
99
      res[i].x = _mm_insert_epi8 (val.x, ins[i % 4], msk0);
100
      masks[i] = msk0;
101
    }
102
 
103
  for (i = 0; i < 16; i++)
104
    {
105
      tmp.x = val.x;
106
      tmp.c[masks[i]] = ins[i % 4];
107
      if (memcmp (&tmp, &res[i], sizeof (tmp)))
108
        abort ();
109
    }
110
}

powered by: WebSVN 2.1.0

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