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-insertps-1.c] - Blame information for rev 329

Go to most recent revision | 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 0x01
19
#define msk1 0x10
20
#define msk2 0x29
21
#define msk3 0x30
22
 
23
#define msk4 0xFC
24
#define msk5 0x05
25
#define msk6 0x0A
26
#define msk7 0x0F
27
 
28
static void
29
TEST (void)
30
{
31
  union
32
    {
33
      __m128 x;
34
      float f[4];
35
    } res[8], val1, val2, tmp;
36
  int masks[8];
37
  int i, j;
38
 
39
  val2.f[0] = 55.0;
40
  val2.f[1] = 55.0;
41
  val2.f[2] = 55.0;
42
  val2.f[3] = 55.0;
43
 
44
  val1.f[0] = 1.;
45
  val1.f[1] = 2.;
46
  val1.f[2] = 3.;
47
  val1.f[3] = 4.;
48
 
49
  res[0].x = _mm_insert_ps (val2.x, val1.x, msk0);
50
  res[1].x = _mm_insert_ps (val2.x, val1.x, msk1);
51
  res[2].x = _mm_insert_ps (val2.x, val1.x, msk2);
52
  res[3].x = _mm_insert_ps (val2.x, val1.x, msk3);
53
 
54
  masks[0] = msk0;
55
  masks[1] = msk1;
56
  masks[2] = msk2;
57
  masks[3] = msk3;
58
 
59
  for (i = 0; i < 4; i++)
60
    res[i + 4].x = _mm_insert_ps (val2.x, val1.x, msk4);
61
 
62
  masks[4] = msk4;
63
  masks[5] = msk4;
64
  masks[6] = msk4;
65
  masks[7] = msk4;
66
 
67
  for (i=0; i < 8; i++)
68
    {
69
      tmp = val2;
70
      tmp.f[(masks[i] & 0x30) >> 4] = val1.f[(masks[i] & 0xC0) >> 6];
71
 
72
      for (j = 0; j < 4; j++)
73
        if (masks[i] & (0x1 << j))
74
          tmp.f[j] = 0.f;
75
 
76
      if (memcmp (&res[i], &tmp, sizeof (tmp)))
77
        abort ();
78
    }
79
}

powered by: WebSVN 2.1.0

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