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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse-3.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* PR target/21149 */
2
/* { dg-do run } */
3
/* { dg-options "-O2 -msse" } */
4
#include <xmmintrin.h>
5
#include "../../gcc.dg/i386-cpuid.h"
6
 
7
extern void abort (void);
8
 
9
void
10
__attribute__((noinline))
11
check (__m128 x, float a, float b, float c, float d)
12
{
13
  union { __m128 m; float f[4]; } u;
14
  u.m = x;
15
  if (u.f[0] != a || u.f[1] != b || u.f[2] != c || u.f[3] != d)
16
    abort ();
17
}
18
 
19
static inline
20
void
21
foo (__m128 *x)
22
{
23
  __m128 y = _mm_setzero_ps ();
24
  __m128 v = _mm_movehl_ps (y, *x);
25
  __m128 w = _mm_movehl_ps (*x, y);
26
  check (*x, 9, 1, 2, -3);
27
  check (v, 2, -3, 0, 0);
28
  check (w, 0, 0, 2, -3);
29
}
30
 
31
void
32
__attribute__((noinline))
33
run_tests (void)
34
{
35
  __m128 y = _mm_set_ps (-3, 2, 1, 9);
36
  foo (&y);
37
}
38
 
39
int
40
main ()
41
{
42
  unsigned long cpu_facilities;
43
 
44
  cpu_facilities = i386_cpuid ();
45
 
46
  if ((cpu_facilities & (bit_MMX | bit_SSE | bit_CMOV))
47
      != (bit_MMX | bit_SSE | bit_CMOV))
48
    /* If host has no vector support, pass.  */
49
    return 0;
50
 
51
  run_tests ();
52
  return 0;
53
}

powered by: WebSVN 2.1.0

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