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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [pr50444.c] - Blame information for rev 698

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
2
/* { dg-options "-msse2" } */
3
/* { dg-require-effective-target sse2_runtime } */
4
 
5
typedef long long __m128i __attribute__ ((__vector_size__ (16),
6
__may_alias__));
7
typedef int __v4si __attribute__ ((__vector_size__ (16)));
8
typedef long long __v2di __attribute__ ((__vector_size__ (16)));
9
typedef unsigned int uint32_t;
10
 
11
typedef struct {
12
    uint32_t v[4];
13
} a4x32;
14
 
15
a4x32* incr(a4x32* x)
16
{
17
  x->v[0] += 1;
18
  return x;
19
}
20
 
21
typedef struct {
22
    __m128i m;
23
} a1xm128i;
24
 
25
static inline  a1xm128i ssefunc( a1xm128i in,  a1xm128i k)
26
{
27
  a1xm128i ret;
28
  ret.m = (__m128i)__builtin_ia32_pxor128 ((__v2di)in.m, (__v2di)k.m);
29
  return ret;
30
}
31
 
32
static  a4x32  caster( a4x32 c4x32,  a1xm128i k)
33
{
34
  a1xm128i c1x128;
35
  if( sizeof(c4x32) != sizeof(c1x128) ) __builtin_abort();
36
  __builtin_memcpy(&c1x128, &c4x32, sizeof(c1x128));
37
  c1x128 = ssefunc(c1x128, k);
38
  __builtin_memcpy(&c4x32, &c1x128, sizeof(c4x32));
39
  return c4x32;
40
}
41
 
42
typedef struct  {
43
    a1xm128i key;
44
    a4x32 c;
45
    __SIZE_TYPE__ elem;
46
    a4x32 v;
47
} Engine;
48
 
49
void ctor(Engine *e)
50
{
51
  e->elem = 0;
52
  e->key.m = (__m128i)(__v4si){ 0, 0, 0, 0 };
53
  e->c.v[0] = 0;
54
  e->c.v[1] = 0;
55
  e->c.v[2] = 0;
56
  e->c.v[3] = 0;
57
}
58
 
59
uint32_t method( Engine *e)
60
{
61
  if( e->elem == 0 )
62
    {
63
      e->v = caster(*incr(&e->c), e->key);
64
      e->elem = 4;
65
    }
66
  return e->v.v[--e->elem];
67
}
68
 
69
int main()
70
{
71
  Engine e4; ctor(&e4);
72
  Engine e5; ctor(&e5);
73
  if(method(&e4)!=method(&e5))
74
    __builtin_abort ();
75
  return 0;
76
}

powered by: WebSVN 2.1.0

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