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/] [sse2-vec-6.c] - Blame information for rev 867

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

powered by: WebSVN 2.1.0

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