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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse-11.c] - Blame information for rev 691

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* PR rtl-optimization/21239 */
2
/* { dg-do run } */
3
/* { dg-options "-O2 -msse2" } */
4
/* { dg-require-effective-target sse2 } */
5
 
6
#include "sse2-check.h"
7
 
8
#include <emmintrin.h>
9
 
10
void
11
foo (unsigned int x, double *y, const double *z)
12
{
13
  __m128d tmp;
14
  while (x)
15
    {
16
      tmp = _mm_load_sd (z);
17
      _mm_store_sd (y, tmp);
18
      --x; ++z; ++y;
19
    }
20
}
21
 
22
void
23
bar (unsigned int x, float *y, const float *z)
24
{
25
  __m128 tmp;
26
  unsigned int i;
27
  for (i = 0; i < x; ++i)
28
    {
29
      tmp = (__m128) { *z, 0, 0, 0 };
30
      *y = __builtin_ia32_vec_ext_v4sf (tmp, 0);
31
      ++z; ++y;
32
    }
33
  for (i = 0; i < x; ++i)
34
    {
35
      tmp = (__m128) { 0, *z, 0, 0 };
36
      *y = __builtin_ia32_vec_ext_v4sf (tmp, 1);
37
      ++z; ++y;
38
    }
39
  for (i = 0; i < x; ++i)
40
    {
41
      tmp = (__m128) { 0, 0, *z, 0 };
42
      *y = __builtin_ia32_vec_ext_v4sf (tmp, 2);
43
      ++z; ++y;
44
    }
45
  for (i = 0; i < x; ++i)
46
    {
47
      tmp = (__m128) { 0, 0, 0, *z };
48
      *y = __builtin_ia32_vec_ext_v4sf (tmp, 3);
49
      ++z; ++y;
50
    }
51
}
52
 
53
static void
54
sse2_test (void)
55
{
56
  unsigned int i;
57
  double a[16], b[16];
58
  float c[16], d[16];
59
  for (i = 0; i < 16; ++i)
60
    {
61
      a[i] = 1;
62
      b[i] = 2;
63
      c[i] = 3;
64
      d[i] = 4;
65
    }
66
  foo (16, a, b);
67
  bar (4, c, d);
68
  for (i = 0; i < 16; ++i)
69
    {
70
      if (a[i] != 2)
71
        abort ();
72
      if (c[i] != 4)
73
        abort ();
74
    }
75
}

powered by: WebSVN 2.1.0

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