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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ext/] [attribute-test-4.C] - Blame information for rev 801

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
 
3
#define vector __attribute__((vector_size(16)))
4
 
5
extern "C" void abort();
6
 
7
union U {
8
              float f[4];
9
              vector float v;
10
} data;
11
 
12
class Star
13
{
14
  public:
15
        static vector float foo();
16
 
17
        Star()
18
          {
19
            data.f[0] = 1.0; data.f[1] = 2.0; data.f[2] = 3.0, data.f[3] = 4.0;
20
          }
21
 
22
  private:
23
        friend vector float fTest();
24
};
25
 
26
vector float Star::foo()
27
{
28
    return data.v;
29
}
30
 
31
vector float fTest()
32
{
33
    vector float vf = Star::foo();
34
    return vf;
35
}
36
 
37
int main() {
38
 
39
  U data;
40
  Star s;
41
 
42
 
43
  data.v = fTest();
44
  for (int i=0 ; i < 4; i++)
45
     if (data.f[i] != (float)(i+1))
46
       abort();
47
  return 0;
48
}
49
 
50
/* Ignore a warning that is irrelevant to the purpose of this test.  */
51
/* { dg-prune-output ".*GCC vector returned by reference.*" } */

powered by: WebSVN 2.1.0

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