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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20050316-2.c] - Blame information for rev 237

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

Line No. Rev Author Line
1 149 jeremybenn
extern void abort (void);
2
 
3
typedef int V2SI __attribute__ ((vector_size (8)));
4
typedef unsigned int V2USI __attribute__ ((vector_size (8)));
5
typedef float V2SF __attribute__ ((vector_size (8)));
6
typedef short V2HI __attribute__ ((vector_size (4)));
7
typedef unsigned int V2UHI __attribute__ ((vector_size (4)));
8
 
9
long long
10
test1 (V2SF x)
11
{
12
  return (long long) (V2SI) x;
13
}
14
 
15
long long
16
test2 (V2SF x)
17
{
18
  return (long long) x;
19
}
20
 
21
long long
22
test3 (V2SI x)
23
{
24
  return (long long) (V2SF) x;
25
}
26
 
27
int
28
main (void)
29
{
30
  if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
31
    return 0;
32
 
33
  V2SF x = { 2.0, 2.0 };
34
  union { long long l; float f[2]; int i[2]; } u;
35
  u.l = test1 (x);
36
  if (u.f[0] != 2.0 || u.f[1] != 2.0)
37
    abort ();
38
 
39
  V2SF y = { 6.0, 6.0 };
40
  u.l = test2 (y);
41
  if (u.f[0] != 6.0 || u.f[1] != 6.0)
42
    abort ();
43
 
44
  V2SI z = { 4, 4 };
45
  u.l = test3 (z);
46
  if (u.i[0] != 4 || u.i[1] != 4)
47
    abort ();
48
  return 0;
49
}

powered by: WebSVN 2.1.0

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