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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [opt/] [20050511-1.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-w" } */
3
/* { dg-options "-O3 -w" { target powerpc*-*-* } } */
4
#include 
5
#include 
6
 
7
// The VxWorks kernel headers define their own UINT32
8
#if defined __vxworks && !defined __RTP__
9
#define UINT32 my_UINT32
10
#endif
11
 
12
typedef signed short SINT16 ;
13
typedef unsigned long UINT32 ;
14
typedef unsigned int UINT ;
15
 
16
class A
17
{
18
public:
19
    union
20
    {
21
      SINT16 xy[2];
22
      UINT32 abXY;
23
    };
24
  bool operator==(const A& other) const {return abXY == other.abXY;}
25
  bool operator!=(const A& other) const {return abXY != other.abXY;}
26
};
27
 
28
template  struct pArray { unsigned char u08[16*(((size*1)+15)/16)] __attribute__ ((aligned(16))); };
29
 
30
struct B
31
{
32
  union {
33
    A mvL[2];
34
    pArray<1> xyz;
35
  };
36
} ;
37
 
38
typedef struct
39
{
40
  UINT w;
41
  B b;
42
 
43
}C;
44
 
45
 
46
UINT32 bar (const C * sPtr)
47
{
48
  UINT w = sPtr->w;
49
  A a;
50
 
51
  a.xy[0] = sPtr->b.mvL[w].xy[0]<<2;
52
  a.xy[1] = sPtr->b.mvL[w].xy[1]<<2;
53
 
54
  if (a.xy[0] != ((SINT16) 0xffff << 2))
55
        abort ();
56
}
57
 
58
int main()
59
{
60
        A a;
61
        C c;
62
        a.xy[0] = 0xffff;
63
        a.xy[1] = 0xffff;
64
        c.w=0;
65
        c.b.mvL[0].xy[0] = a.xy[0];
66
        c.b.mvL[0].xy[1] = a.xy[1];
67
 
68
        bar (&c);
69
}
70
 

powered by: WebSVN 2.1.0

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