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/] [sse3-addsubps.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 sse3 } */
3
/* { dg-options "-O2 -msse3 -mfpmath=sse" } */
4
 
5
#ifndef CHECK_H
6
#define CHECK_H "sse3-check.h"
7
#endif
8
 
9
#ifndef TEST
10
#define TEST sse3_test
11
#endif
12
 
13
#include CHECK_H
14
 
15
#include <pmmintrin.h>
16
 
17
static void
18
sse3_test_addsubps (float *i1, float *i2, float *r)
19
{
20
  __m128 t1 = _mm_loadu_ps (i1);
21
  __m128 t2 = _mm_loadu_ps (i2);
22
 
23
  t1 = _mm_addsub_ps (t1, t2);
24
 
25
  _mm_storeu_ps (r, t1);
26
}
27
 
28
static void
29
sse3_test_addsubps_subsume (float *i1, float *i2, float *r)
30
{
31
  __m128 t1 = _mm_load_ps (i1);
32
  __m128 t2 = _mm_load_ps (i2);
33
 
34
  t1 = _mm_addsub_ps (t1, t2);
35
 
36
  _mm_storeu_ps (r, t1);
37
}
38
 
39
static int
40
chk_ps (float *v1, float *v2)
41
{
42
  int i;
43
  int n_fails = 0;
44
 
45
  for (i = 0; i < 4; i++)
46
    if (v1[i] != v2[i])
47
      n_fails += 1;
48
 
49
  return n_fails;
50
}
51
 
52
static float p1[4] __attribute__ ((aligned(16)));
53
static float p2[4] __attribute__ ((aligned(16)));
54
static float p3[4];
55
static float ck[4];
56
 
57
static float vals[80] =
58
  {
59
    100.0,  200.0, 300.0, 400.0, 5.0, -1.0, .345, -21.5,
60
    1100.0, 0.235, 321.3, 53.40, 0.3, 10.0, 42.0, 32.52,
61
    32.6,   123.3, 1.234, 2.156, 0.1, 3.25, 4.75, 32.44,
62
    12.16,  52.34, 64.12, 71.13, -.1, 2.30, 5.12, 3.785,
63
    541.3,  321.4, 231.4, 531.4, 71., 321., 231., -531.,
64
    23.45,  23.45, 23.45, 23.45, 23.45, 23.45, 23.45, 23.45,
65
    23.45,  -1.43, -6.74, 6.345, -20.1, -20.1, -40.1, -40.1,
66
    1.234,  2.345, 3.456, 4.567, 5.678, 6.789, 7.891, 8.912,
67
    -9.32,  -8.41, -7.50, -6.59, -5.68, -4.77, -3.86, -2.95,
68
    9.32,  8.41, 7.50, 6.59, -5.68, -4.77, -3.86, -2.95
69
  };
70
 
71
static void
72
TEST (void)
73
{
74
  int i;
75
  int fail = 0;
76
 
77
  for (i = 0; i < 80; i += 8)
78
    {
79
      p1[0] = vals[i+0];
80
      p1[1] = vals[i+1];
81
      p1[2] = vals[i+2];
82
      p1[3] = vals[i+3];
83
 
84
      p2[0] = vals[i+4];
85
      p2[1] = vals[i+5];
86
      p2[2] = vals[i+6];
87
      p2[3] = vals[i+7];
88
 
89
      ck[0] = p1[0] - p2[0];
90
      ck[1] = p1[1] + p2[1];
91
      ck[2] = p1[2] - p2[2];
92
      ck[3] = p1[3] + p2[3];
93
 
94
      sse3_test_addsubps (p1, p2, p3);
95
 
96
      fail += chk_ps (ck, p3);
97
 
98
      sse3_test_addsubps_subsume (p1, p2, p3);
99
 
100
      fail += chk_ps (ck, p3);
101
    }
102
 
103
  if (fail != 0)
104
    abort ();
105
}

powered by: WebSVN 2.1.0

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