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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [fixed-point/] [operator-cond.c] - Blame information for rev 753

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

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-std=gnu99 -O0" } */
3
 
4
/* C99 6.5.15 Conditional operator.
5
   Test with fixed-point operands.
6
   Based on the test from ../dfp/.  */
7
 
8
extern void abort (void);
9
volatile int yes, no;
10
 
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; \
20
}
21
 
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)
54
 
55
int
56
main ()
57
{
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 ();
66
 
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)
99
 
100
  return 0;
101
}

powered by: WebSVN 2.1.0

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