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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse4_1-extractps.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-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
 
17
int masks[4];
18
 
19
#define msk0 0x00
20
#define msk1 0x01
21
#define msk2 0x02
22
#define msk3 0x03
23
 
24
static void
25
TEST (void)
26
{
27
  union
28
    {
29
      __m128 x;
30
      float f[4];
31
    } val1, val2;
32
  union
33
    {
34
      int i;
35
      float f;
36
    } res[4];
37
  float resm[4];
38
  int i;
39
 
40
  val1.f[0] = 10.;
41
  val1.f[1] = 2.;
42
  val1.f[2] = 3.;
43
  val1.f[3] = 40.;
44
 
45
  val2.f[0] = 77.;
46
  val2.f[1] = 21.;
47
  val2.f[2] = 34.;
48
  val2.f[3] = 49.;
49
 
50
  res[0].i = _mm_extract_ps (val1.x, msk0);
51
  res[1].i = _mm_extract_ps (val1.x, msk1);
52
  res[2].i = _mm_extract_ps (val1.x, msk2);
53
  res[3].i = _mm_extract_ps (val1.x, msk3);
54
 
55
  _MM_EXTRACT_FLOAT (resm[0], val2.x, msk0);
56
  _MM_EXTRACT_FLOAT (resm[1], val2.x, msk1);
57
  _MM_EXTRACT_FLOAT (resm[2], val2.x, msk2);
58
  _MM_EXTRACT_FLOAT (resm[3], val2.x, msk3);
59
 
60
  masks[0] = msk0;
61
  masks[1] = msk1;
62
  masks[2] = msk2;
63
  masks[3] = msk3;
64
 
65
  for( i=0; i < 4; i++ )
66
    {
67
      if (res[i].f != val1.f[masks[i]])
68
        abort ();
69
      if (resm[i] != val2.f[masks[i]])
70
        abort ();
71
    }
72
}

powered by: WebSVN 2.1.0

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