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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [i386/] [sse4_1-ptest-3.c] - Blame information for rev 691

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run } */
2
/* { dg-require-effective-target sse4 } */
3
/* { dg-options "-O2 -msse4.1" } */
4
 
5
#ifndef CHECK_H
6
#define CHECK_H "sse4_1-check.h"
7
#endif
8
 
9
#ifndef TEST
10
#define TEST sse4_1_test
11
#endif
12
 
13
#include CHECK_H
14
 
15
#include <smmintrin.h>
16
 
17
static void
18
TEST (void)
19
{
20
  union
21
    {
22
      __m128i x;
23
      unsigned int i[4];
24
    } val[4];
25
  int correct_zeros[4];
26
  int correct_ones[4];
27
  int correct_mixed[4];
28
  int zeros[4];
29
  int ones[4];
30
  int mixed[4];
31
  int i;
32
  __m128i v;
33
 
34
  val[0].i[0] = 0x11111111;
35
  val[0].i[1] = 0x00000000;
36
  val[0].i[2] = 0x00000000;
37
  val[0].i[3] = 0x11111111;
38
  correct_zeros[0] = 0;
39
  correct_ones[0] = 0;
40
  correct_mixed[0] = 1;
41
 
42
  val[1].i[0] = 0x00000000;
43
  val[1].i[1] = 0x11111111;
44
  val[1].i[2] = 0x11111111;
45
  val[1].i[3] = 0x00000000;
46
  correct_zeros[1] = 0;
47
  correct_ones[1] = 0;
48
  correct_mixed[1] = 1;
49
 
50
  val[2].i[0] = 0;
51
  val[2].i[1] = 0;
52
  val[2].i[2] = 0;
53
  val[2].i[3] = 0;
54
  correct_zeros[2] = 1;
55
  correct_ones[2] = 0;
56
  correct_mixed[2] = 0;
57
 
58
  val[3].i[0] = 0xffffffff;
59
  val[3].i[1] = 0xffffffff;
60
  val[3].i[2] = 0xffffffff;
61
  val[3].i[3] = 0xffffffff;
62
  correct_zeros[3] = 0;
63
  correct_ones[3] = 1;
64
  correct_mixed[3] = 0;
65
 
66
  for (i=0; i < 4; i++)
67
    zeros[i] = _mm_test_all_zeros (val[i].x, val[i].x);
68
 
69
  for( i=0; i < 4; i++ )
70
    ones[i] = _mm_test_all_ones (val[i].x);
71
 
72
  v = _mm_cmpeq_epi32 (val[0].x, val[0].x);
73
  for( i=0; i < 4; i++ )
74
    mixed[i] = _mm_test_mix_ones_zeros (val[i].x, v);
75
 
76
  for( i=0; i < 4; i++ )
77
    {
78
      if (zeros[i] != correct_zeros[i])
79
        abort ();
80
      if (ones[i] != correct_ones[i])
81
        abort ();
82
      if (mixed[i] != correct_mixed[i])
83
        abort ();
84
    }
85
}

powered by: WebSVN 2.1.0

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