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/] [sse-init-v4sf-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-options "-O2 -msse" } */
3
/* { dg-require-effective-target sse } */
4
 
5
#include "sse-check.h"
6
 
7
#ifdef DEBUG
8
#include <stdio.h>
9
#endif
10
 
11
#include <xmmintrin.h>
12
 
13
static void
14
__attribute__((noinline))
15
check (__m128 x, float *v, int j)
16
{
17
  union
18
    {
19
      __m128 x;
20
      float f[4];
21
    } u;
22
  unsigned int i;
23
 
24
  u.x = x;
25
 
26
  for (i = 0; i < sizeof (v) / sizeof (v[0]); i++)
27
    if (i == j)
28
      {
29
        if (v[i] != u.f[i])
30
          {
31
#ifdef DEBUG
32
            printf ("%i: %f != %f\n", i, v[i], u.f[i]);
33
#endif
34
            abort ();
35
          }
36
      }
37
    else if (u.f[i] != 0)
38
      {
39
#ifdef DEBUG
40
        printf ("%i: %f != 0\n", i, u.f[i]);
41
#endif
42
        abort ();
43
      }
44
}
45
 
46
static void
47
__attribute__((noinline))
48
test (float *v)
49
{
50
  __m128 x;
51
 
52
  x = _mm_set_ps (0, 0, 0, v[0]);
53
  check (x, v, 0);
54
  x = _mm_set_ps (0, 0, v[1], 0);
55
  check (x, v, 1);
56
  x = _mm_set_ps (0, v[2], 0, 0);
57
  check (x, v, 2);
58
  x = _mm_set_ps (v[3], 0, 0, 0);
59
  check (x, v, 3);
60
}
61
 
62
static void
63
sse_test (void)
64
{
65
  float v[4] = { -3, 2, 1, 9 };
66
  test (v);
67
}

powered by: WebSVN 2.1.0

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