Add malloc predictor (PR middle-end/83023).
[official-gcc.git] / gcc / testsuite / gcc.dg / fixed-point / operator-cond.c
blob94b0de0a9333dd7f328ec05a632cecfe87805d14
1 /* { dg-do run } */
2 /* { dg-options "-std=gnu99 -O0" } */
4 /* C99 6.5.15 Conditional operator.
5 Test with fixed-point operands.
6 Based on the test from ../dfp/. */
8 extern void abort (void);
9 volatile int yes, no;
11 #define FUNC(TYPE,NAME,PF) \
12 volatile TYPE NAME ## a, NAME ## b, NAME ## c; \
13 void \
14 init_ ## NAME () \
15 { \
16 NAME ## b = 0.2 ## PF; \
17 NAME ## c = 0.3 ## PF; \
18 yes = 1; \
19 no = 0; \
22 FUNC (short _Fract, sf, hr)
23 FUNC (_Fract, f, r)
24 FUNC (long _Fract, lf, lr)
25 FUNC (long long _Fract, llf, llr)
26 FUNC (unsigned short _Fract, usf, uhr)
27 FUNC (unsigned _Fract, uf, ur)
28 FUNC (unsigned long _Fract, ulf, ulr)
29 FUNC (long long _Fract, ullf, ullr)
30 FUNC (_Sat short _Fract, Ssf, hr)
31 FUNC (_Sat _Fract, Sf, r)
32 FUNC (_Sat long _Fract, Slf, lr)
33 FUNC (_Sat long long _Fract, Sllf, llr)
34 FUNC (_Sat unsigned short _Fract, Susf, uhr)
35 FUNC (_Sat unsigned _Fract, Suf, ur)
36 FUNC (_Sat unsigned long _Fract, Sulf, ulr)
37 FUNC (_Sat long long _Fract, Sullf, ullr)
38 FUNC (short _Accum, sa, hk)
39 FUNC (_Accum, a, k)
40 FUNC (long _Accum, la, lk)
41 FUNC (long long _Accum, lla, llk)
42 FUNC (unsigned short _Accum, usa, uhk)
43 FUNC (unsigned _Accum, ua, uk)
44 FUNC (unsigned long _Accum, ula, ulk)
45 FUNC (long long _Accum, ulla, ullk)
46 FUNC (_Sat short _Accum, Ssa, hk)
47 FUNC (_Sat _Accum, Sa, k)
48 FUNC (_Sat long _Accum, Sla, lk)
49 FUNC (_Sat long long _Accum, Slla, llk)
50 FUNC (_Sat unsigned short _Accum, Susa, uhk)
51 FUNC (_Sat unsigned _Accum, Sua, uk)
52 FUNC (_Sat unsigned long _Accum, Sula, ulk)
53 FUNC (_Sat long long _Accum, Sulla, ullk)
55 int
56 main ()
58 #define TEST(NAME) \
59 init_ ## NAME (); \
60 NAME ## a = yes ? NAME ## b : NAME ## c; \
61 if (NAME ## a != NAME ## b) \
62 abort (); \
63 NAME ## a = no ? NAME ## b : NAME ## c; \
64 if (NAME ## a != NAME ## c) \
65 abort ();
67 TEST(sf)
68 TEST(f)
69 TEST(lf)
70 TEST(llf)
71 TEST(usf)
72 TEST(uf)
73 TEST(ulf)
74 TEST(ullf)
75 TEST(Ssf)
76 TEST(Sf)
77 TEST(Slf)
78 TEST(Sllf)
79 TEST(Susf)
80 TEST(Suf)
81 TEST(Sulf)
82 TEST(Sullf)
83 TEST(sa)
84 TEST(a)
85 TEST(la)
86 TEST(lla)
87 TEST(usa)
88 TEST(ua)
89 TEST(ula)
90 TEST(ulla)
91 TEST(Ssa)
92 TEST(Sa)
93 TEST(Sla)
94 TEST(Slla)
95 TEST(Susa)
96 TEST(Sua)
97 TEST(Sula)
98 TEST(Sulla)
100 return 0;