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-movsldup.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_movsldup_reg (float *i1, float *r)
25
{
26
  __m128 t1 = _mm_loadu_ps (i1);
27
  __m128 t2 = _mm_moveldup_ps (t1);
28
 
29
  _mm_storeu_ps (r, t2);
30
}
31
 
32
static void
33
sse3_test_movsldup_reg_subsume (float *i1, float *r)
34
{
35
  __m128 t1 = _mm_load_ps (i1);
36
  __m128 t2 = _mm_moveldup_ps (t1);
37
 
38
  _mm_storeu_ps (r, t2);
39
}
40
 
41
static int
42
chk_ps (float *v1, float *v2)
43
{
44
  int i;
45
  int n_fails = 0;
46
 
47
  for (i = 0; i < 4; i++)
48
    if (v1[i] != v2[i])
49
      n_fails += 1;
50
 
51
  return n_fails;
52
}
53
 
54
static float p1[4] __attribute__ ((aligned(16)));
55
static float p2[4];
56
static float p3[4];
57
static float ck[4];
58
 
59
static float vals[80] =
60
  {
61
    100.0,  200.0, 300.0, 400.0, 5.0, -1.0, .345, -21.5,
62
    1100.0, 0.235, 321.3, 53.40, 0.3, 10.0, 42.0, 32.52,
63
    32.6,   123.3, 1.234, 2.156, 0.1, 3.25, 4.75, 32.44,
64
    12.16,  52.34, 64.12, 71.13, -.1, 2.30, 5.12, 3.785,
65
    541.3,  321.4, 231.4, 531.4, 71., 321., 231., -531.,
66
    23.45,  23.45, 23.45, 23.45, 23.45, 23.45, 23.45, 23.45,
67
    23.45,  -1.43, -6.74, 6.345, -20.1, -20.1, -40.1, -40.1,
68
    1.234,  2.345, 3.456, 4.567, 5.678, 6.789, 7.891, 8.912,
69
    -9.32,  -8.41, -7.50, -6.59, -5.68, -4.77, -3.86, -2.95,
70
    9.32,  8.41, 7.50, 6.59, -5.68, -4.77, -3.86, -2.95
71
  };
72
 
73
static void
74
sse3_test (void)
75
{
76
  int i;
77
  int fail = 0;
78
 
79
  for (i = 0; i < 80; i += 2)
80
    {
81
      p1[0] = vals[i+0];
82
      p1[1] = 0.0;
83
      p1[2] = vals[i+1];
84
      p1[3] = 1.0;
85
 
86
      ck[0] = p1[0];
87
      ck[1] = p1[0];
88
      ck[2] = p1[2];
89
      ck[3] = p1[2];
90
 
91
      sse3_test_movsldup_reg (p1, p2);
92
 
93
      fail += chk_ps (ck, p2);
94
 
95
      sse3_test_movsldup_reg_subsume (p1, p2);
96
 
97
      fail += chk_ps (ck, p2);
98
    }
99
 
100
  if (fail != 0)
101
    abort ();
102
}

powered by: WebSVN 2.1.0

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