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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse3-movddup.c] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
2
/* { dg-options "-O2 -msse3" } */
3
#include <pmmintrin.h>
4
#include <stdlib.h>
5
#include "../../gcc.dg/i386-cpuid.h"
6
 
7
static void sse3_test (void);
8
 
9
int
10
main ()
11
{
12
  unsigned long cpu_facilities;
13
 
14
  cpu_facilities = i386_cpuid_ecx ();
15
 
16
  /* Run SSE3 test only if host has SSE3 support.  */
17
  if ((cpu_facilities & bit_SSE3))
18
    sse3_test ();
19
 
20
  exit (0);
21
}
22
 
23
static void
24
sse3_test_movddup_mem (double *i1, double *r)
25
{
26
  __m128d t1 = _mm_loaddup_pd (i1);
27
 
28
  _mm_storeu_pd (r, t1);
29
}
30
 
31
static double cnst1 [2] = {1.0, 1.0};
32
 
33
static void
34
sse3_test_movddup_reg (double *i1, double *r)
35
{
36
  __m128d t1 = _mm_loadu_pd (i1);
37
  __m128d t2 = _mm_loadu_pd (&cnst1[0]);
38
 
39
  t1  = _mm_mul_pd (t1, t2);
40
  t2  = _mm_movedup_pd (t1);
41
 
42
  _mm_storeu_pd (r, t2);
43
}
44
 
45
static void
46
sse3_test_movddup_reg_subsume_unaligned (double *i1, double *r)
47
{
48
  __m128d t1 = _mm_loadu_pd (i1);
49
  __m128d t2 = _mm_movedup_pd (t1);
50
 
51
  _mm_storeu_pd (r, t2);
52
}
53
 
54
static void
55
sse3_test_movddup_reg_subsume_ldsd (double *i1, double *r)
56
{
57
  __m128d t1 = _mm_load_sd (i1);
58
  __m128d t2 = _mm_movedup_pd (t1);
59
 
60
  _mm_storeu_pd (r, t2);
61
}
62
 
63
static void
64
sse3_test_movddup_reg_subsume (double *i1, double *r)
65
{
66
  __m128d t1 = _mm_load_pd (i1);
67
  __m128d t2 = _mm_movedup_pd (t1);
68
 
69
  _mm_storeu_pd (r, t2);
70
}
71
 
72
static int
73
chk_pd (double *v1, double *v2)
74
{
75
  int i;
76
  int n_fails = 0;
77
 
78
  for (i = 0; i < 2; i++)
79
    if (v1[i] != v2[i])
80
      n_fails += 1;
81
 
82
  return n_fails;
83
}
84
 
85
static double p1[2] __attribute__ ((aligned(16)));
86
static double p2[2];
87
static double ck[2];
88
 
89
static double vals[80] =
90
  {
91
    100.0,  200.0, 300.0, 400.0, 5.0, -1.0, .345, -21.5,
92
    1100.0, 0.235, 321.3, 53.40, 0.3, 10.0, 42.0, 32.52,
93
    32.6,   123.3, 1.234, 2.156, 0.1, 3.25, 4.75, 32.44,
94
    12.16,  52.34, 64.12, 71.13, -.1, 2.30, 5.12, 3.785,
95
    541.3,  321.4, 231.4, 531.4, 71., 321., 231., -531.,
96
    23.45,  23.45, 23.45, 23.45, 23.45, 23.45, 23.45, 23.45,
97
    23.45,  -1.43, -6.74, 6.345, -20.1, -20.1, -40.1, -40.1,
98
    1.234,  2.345, 3.456, 4.567, 5.678, 6.789, 7.891, 8.912,
99
    -9.32,  -8.41, -7.50, -6.59, -5.68, -4.77, -3.86, -2.95,
100
    9.32,  8.41, 7.50, 6.59, -5.68, -4.77, -3.86, -2.95
101
  };
102
 
103
static void
104
sse3_test (void)
105
{
106
  int i;
107
  int fail = 0;
108
 
109
  for (i = 0; i < 80; i += 1)
110
    {
111
      p1[0] = vals[i+0];
112
 
113
      ck[0] = p1[0];
114
      ck[1] = p1[0];
115
 
116
      sse3_test_movddup_mem (p1, p2);
117
 
118
      fail += chk_pd (ck, p2);
119
 
120
      sse3_test_movddup_reg (p1, p2);
121
 
122
      fail += chk_pd (ck, p2);
123
 
124
      sse3_test_movddup_reg_subsume (p1, p2);
125
 
126
      fail += chk_pd (ck, p2);
127
 
128
      sse3_test_movddup_reg_subsume_unaligned (p1, p2);
129
 
130
      fail += chk_pd (ck, p2);
131
 
132
      sse3_test_movddup_reg_subsume_ldsd (p1, p2);
133
 
134
      fail += chk_pd (ck, p2);
135
    }
136
 
137
  if (fail != 0)
138
    abort ();
139
}

powered by: WebSVN 2.1.0

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