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/] [sse2-vec-6.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-options "-O2 -msse2" } */
3
/* { dg-require-effective-target sse2 } */
4
 
5
#include "sse2-check.h"
6
 
7
#include <emmintrin.h>
8
#include <string.h>
9
 
10
static void
11
sse2_test (void)
12
{
13
  union
14
    {
15
      __m128i x;
16
      char c[16];
17
      short s[8];
18
      int i[4];
19
      long long ll[2];
20
    } val1, res[16], tmp;
21
  short ins[8] = { 8, 5, 9, 4, 2, 6, 1, 20 };
22
  int masks[8];
23
  int i;
24
 
25
  for (i = 0; i < 16; i++)
26
    val1.c[i] = i;
27
 
28
  res[0].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
29
                                                    ins[0], 0);
30
  res[1].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
31
                                                    ins[0], 1);
32
  res[2].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
33
                                                    ins[0], 2);
34
  res[3].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
35
                                                    ins[0], 3);
36
  res[4].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
37
                                                    ins[0], 4);
38
  res[5].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
39
                                                    ins[0], 5);
40
  res[6].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
41
                                                    ins[0], 6);
42
  res[7].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
43
                                                    ins[0], 7);
44
 
45
  for (i = 0; i < 8; i++)
46
    masks[i] = i;
47
 
48
  for (i = 0; i < 8; i++)
49
    {
50
      tmp.x = val1.x;
51
      tmp.s[masks[i]] = ins[0];
52
      if (memcmp (&tmp, &res[i], sizeof (tmp)))
53
        abort ();
54
    }
55
 
56
  for (i = 0; i < 8; i++)
57
    {
58
      res[i].x = (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)val1.x,
59
                                                        ins[i], 0);
60
      masks[i] = 0;
61
    }
62
 
63
  for (i = 0; i < 8; i++)
64
    {
65
      tmp.x = val1.x;
66
      tmp.s[masks[i]] = ins[i];
67
      if (memcmp (&tmp, &res[i], sizeof (tmp)))
68
        abort ();
69
    }
70
}

powered by: WebSVN 2.1.0

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