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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [complete-port.c] - Blame information for rev 868

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

Line No. Rev Author Line
1 149 jeremybenn
/* This small program uses all the arithmetic operators that may
2
   generate calls to library routines which must be implemented in
3
   port-specific assembly language.  */
4
/* { dg-do link } */
5
 
6
#include <stddef.h>
7
 
8
int foo ();
9
double dfoo ();
10
void discard (int);
11
void ddiscard (double);
12
 
13
int
14
main (void)
15
{
16
  int a = foo (), b = foo ();
17
  unsigned int au = foo (), bu = foo ();
18
  float af = dfoo (), bf = dfoo ();
19
  double ad = dfoo (), bd = dfoo ();
20
 
21
  discard (a * b);
22
  discard (a / b);
23
  discard (a % b);
24
 
25
  discard (au / bu);
26
  discard (au % bu);
27
 
28
  discard (a >> b);
29
  discard (a << b);
30
 
31
  discard (au >> bu);
32
  discard (au << bu);
33
 
34
  ddiscard (ad + bd);
35
  ddiscard (ad - bd);
36
  ddiscard (ad * bd);
37
  ddiscard (ad / bd);
38
  ddiscard (-ad);
39
 
40
  ddiscard (af + bf);
41
  ddiscard (af - bf);
42
  ddiscard (af * bf);
43
  ddiscard (af / bf);
44
  ddiscard (-af);
45
 
46
  discard ((int) ad);
47
  discard ((int) af);
48
 
49
  ddiscard ((double) a);
50
  ddiscard ((float) a);
51
  ddiscard ((float) ad);
52
 
53
  discard (ad == bd);
54
  discard (ad < bd);
55
  discard (ad > bd);
56
  discard (ad != bd);
57
  discard (ad <= bd);
58
  discard (ad >= bd);
59
 
60
  discard (af == bf);
61
  discard (af < bf);
62
  discard (af > bf);
63
  discard (af != bf);
64
  discard (af <= bf);
65
  discard (af >= bf);
66
 
67
  return 0;
68
}
69
 
70
void
71
discard (x)
72
     int x __attribute__((__unused__));
73
{}
74
 
75
void
76
ddiscard (x)
77
     double x __attribute__((__unused__));
78
{}
79
 
80
int
81
foo ()
82
{
83
  static int table[] = {20, 69, 4, 12};
84
  static int idx;
85
 
86
  return table[idx++];
87
}
88
 
89
double
90
dfoo ()
91
{
92
  static double table[] = {20.4, 69.96, 4.4, 202.202};
93
  static int idx;
94
 
95
  return table[idx++];
96
}

powered by: WebSVN 2.1.0

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