2015-12-10 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr30315.c
blob557b4f75174e145093ff37ceb862429901654218
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3 /* { dg-final { scan-assembler-not "cmp" } } */
5 extern void abort (void);
6 int c;
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; \
16 #define PLUSCC(T, t) PLUSCC1(T, t, a) PLUSCC1(T, t, b)
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; \
26 #define INCCC(T, t) INCCC1(T, t, a) INCCC1(T, t, b)
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 (); \
35 #define PLUSCCONLY(T, t) PLUSCCONLY1(T, t, a) PLUSCCONLY1(T, t, b)
37 #define TEST(T, t) \
38 PLUSCC(T, t) \
39 PLUSCCONLY(T, t) \
40 INCCC(T, t)
42 TEST (unsigned long, l)
43 TEST (unsigned int, i)
44 TEST (unsigned short, s)
45 TEST (unsigned char, c)
47 #define PLUSCCZEXT(C) \
48 unsigned long pluscczext##C (unsigned int a, unsigned int b) \
49 { \
50 unsigned int sum = a + b; \
51 if (sum < C) \
52 abort (); \
53 return sum; \
56 PLUSCCZEXT(a)
57 PLUSCCZEXT(b)