OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [opt/] [20050511-1.C] - Blame information for rev 154

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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