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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [960311-1.c] - Blame information for rev 688

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
#include <stdio.h>
2
 
3
#ifdef DEBUG
4
#define abort() printf ("error, line %d\n", __LINE__)
5
#endif
6
 
7
int count;
8
 
9
void a1() { ++count; }
10
 
11
void
12
b (unsigned char data)
13
{
14
  if (data & 0x80) a1();
15
  data <<= 1;
16
 
17
  if (data & 0x80) a1();
18
  data <<= 1;
19
 
20
  if (data & 0x80) a1();
21
}
22
 
23
main ()
24
{
25
  count = 0;
26
  b (0);
27
  if (count != 0)
28
    abort ();
29
 
30
  count = 0;
31
  b (0x80);
32
  if (count != 1)
33
    abort ();
34
 
35
  count = 0;
36
  b (0x40);
37
  if (count != 1)
38
    abort ();
39
 
40
  count = 0;
41
  b (0x20);
42
  if (count != 1)
43
    abort ();
44
 
45
  count = 0;
46
  b (0xc0);
47
  if (count != 2)
48
    abort ();
49
 
50
  count = 0;
51
  b (0xa0);
52
  if (count != 2)
53
    abort ();
54
 
55
  count = 0;
56
  b (0x60);
57
  if (count != 2)
58
    abort ();
59
 
60
  count = 0;
61
  b (0xe0);
62
  if (count != 3)
63
    abort ();
64
 
65
#ifdef DEBUG
66
  printf ("Done.\n");
67
#endif
68
  exit (0);
69
}

powered by: WebSVN 2.1.0

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