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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [pr30315.c] - Blame information for rev 318

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 318 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O2" } */
3
/* { dg-final { scan-assembler-times "cmp" 4 } } */
4
 
5
extern void abort (void);
6
int c;
7
 
8
#define PLUSCC1(T, t, C)        \
9
T pluscc##t##C (T a, T b)       \
10
{       \
11
  T sum = a + b;        \
12
  if (sum < C)          \
13
    abort ();           \
14
  return sum;           \
15
}
16
#define PLUSCC(T, t) PLUSCC1(T, t, a) PLUSCC1(T, t, b)
17
 
18
#define INCCC1(T, t, C) \
19
T inccc##t##C (T a, T b)        \
20
{       \
21
  T sum = a + b;        \
22
  if (sum < C)          \
23
    c ++;               \
24
  return sum;           \
25
}
26
#define INCCC(T, t) INCCC1(T, t, a) INCCC1(T, t, b)
27
 
28
#define PLUSCCONLY1(T, t, C)    \
29
void pluscconly##t##C (T a, T b)        \
30
{       \
31
  T sum = a + b;        \
32
  if (sum < C)          \
33
    abort ();           \
34
}
35
#define PLUSCCONLY(T, t) PLUSCCONLY1(T, t, a) PLUSCCONLY1(T, t, b)
36
 
37
#define MINUSCC(T, t)   \
38
T minuscc##t (T a, T b) \
39
{       \
40
  T difference = a - b; \
41
  if (difference > a)   \
42
    abort ();           \
43
  return difference;    \
44
}
45
 
46
#define DECCC(T, t)     \
47
T deccc##t (T a, T b)   \
48
{       \
49
  T difference = a - b; \
50
  if (difference > a)   \
51
    c --;               \
52
  return difference;    \
53
}
54
 
55
#define MINUSCCONLY(T, t)       \
56
void minuscconly##t (T a, T b)  \
57
{       \
58
  T difference = a - b; \
59
  if (difference > a)   \
60
    abort ();           \
61
}
62
 
63
#define TEST(T, t)      \
64
  PLUSCC(T, t)          \
65
  PLUSCCONLY(T, t)      \
66
  INCCC(T, t)           \
67
  MINUSCC(T, t)         \
68
  MINUSCCONLY(T, t)     \
69
  DECCC(T, t)
70
 
71
TEST (unsigned long,  l)
72
TEST (unsigned int,   i)
73
TEST (unsigned short, s)
74
TEST (unsigned char,  c)
75
 
76
#define PLUSCCZEXT(C)   \
77
unsigned long pluscczext##C (unsigned int a, unsigned int b)    \
78
{       \
79
  unsigned int sum = a + b;     \
80
  if (sum < C)          \
81
    abort ();           \
82
  return sum;           \
83
}
84
 
85
PLUSCCZEXT(a)
86
PLUSCCZEXT(b)
87
 
88
#define MINUSCCZEXT     \
89
unsigned long minuscczext (unsigned int a, unsigned int b)      \
90
{       \
91
  unsigned int difference = a - b;      \
92
  if (difference > a)           \
93
    abort ();                   \
94
  return difference;            \
95
}
96
 
97
MINUSCCZEXT

powered by: WebSVN 2.1.0

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