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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [bitfld-3.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
/* Test that operations on bit-fields yield results reduced to bit-field
2
   type.  */
3
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
4
 
5
extern void exit (int);
6
extern void abort (void);
7
 
8
struct s {
9
  unsigned long long u33: 33;
10
  unsigned long long u40: 40;
11
  unsigned long long u41: 41;
12
};
13
 
14
struct s a = { 0x100000, 0x100000, 0x100000 };
15
struct s b = { 0x100000000ULL, 0x100000000ULL, 0x100000000ULL };
16
struct s c = { 0x1FFFFFFFFULL, 0, 0 };
17
 
18
int
19
main (void)
20
{
21
  if (a.u33 * a.u33 != 0 || a.u33 * a.u40 != 0 || a.u40 * a.u33 != 0
22
      || a.u40 * a.u40 != 0)
23
    abort ();
24
  if (a.u33 * a.u41 != 0x10000000000ULL
25
      || a.u40 * a.u41 != 0x10000000000ULL
26
      || a.u41 * a.u33 != 0x10000000000ULL
27
      || a.u41 * a.u40 != 0x10000000000ULL
28
      || a.u41 * a.u41 != 0x10000000000ULL)
29
    abort ();
30
  if (b.u33 + b.u33 != 0)
31
    abort ();
32
  if (b.u33 + b.u40 != 0x200000000ULL
33
      || b.u33 + b.u41 != 0x200000000ULL
34
      || b.u40 + b.u33 != 0x200000000ULL
35
      || b.u40 + b.u40 != 0x200000000ULL
36
      || b.u40 + b.u41 != 0x200000000ULL
37
      || b.u41 + b.u33 != 0x200000000ULL
38
      || b.u41 + b.u40 != 0x200000000ULL
39
      || b.u41 + b.u41 != 0x200000000ULL)
40
    abort ();
41
  if (a.u33 - b.u33 != 0x100100000ULL
42
      || a.u33 - b.u40 != 0xFF00100000ULL
43
      || a.u33 - b.u41 != 0x1FF00100000ULL
44
      || a.u40 - b.u33 != 0xFF00100000ULL
45
      || a.u40 - b.u40 != 0xFF00100000ULL
46
      || a.u40 - b.u41 != 0x1FF00100000ULL
47
      || a.u41 - b.u33 != 0x1FF00100000ULL
48
      || a.u41 - b.u40 != 0x1FF00100000ULL
49
      || a.u41 - b.u41 != 0x1FF00100000ULL)
50
    abort ();
51
  if (++c.u33 != 0 || --c.u40 != 0xFFFFFFFFFFULL || c.u41-- != 0)
52
    abort ();
53
  exit (0);
54
}

powered by: WebSVN 2.1.0

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