Commit | Line | Data |
---|---|---|
93004d61 TJB |
1 | /* This testcase is part of GDB, the GNU debugger. |
2 | ||
3 | Copyright 2007 Free Software Foundation, Inc. | |
4 | ||
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 3 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
17 | ||
18 | #include <stdio.h> | |
19 | #include <stdlib.h> | |
20 | ||
21 | volatile _Decimal32 d32; | |
22 | volatile _Decimal64 d64; | |
23 | volatile _Decimal128 d128; | |
24 | ||
25 | struct decstruct | |
26 | { | |
27 | int int4; | |
28 | long long8; | |
29 | _Decimal32 dec32; | |
30 | _Decimal64 dec64; | |
31 | _Decimal128 dec128; | |
32 | } ds; | |
33 | ||
34 | static _Decimal32 | |
35 | arg0_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2, | |
36 | _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5) | |
37 | { | |
38 | return arg0; | |
39 | } | |
40 | ||
41 | static _Decimal64 | |
42 | arg0_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2, | |
43 | _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5) | |
44 | { | |
45 | return arg0; | |
46 | } | |
47 | ||
48 | static _Decimal128 | |
49 | arg0_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2, | |
50 | _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5) | |
51 | { | |
52 | return arg0; | |
53 | } | |
54 | ||
55 | int main() | |
56 | { | |
57 | /* An finite 32-bits decimal floating point. */ | |
58 | d32 = 1.2345df; /* Initialize d32. */ | |
59 | ||
60 | /* Non-finite 32-bits decimal floating point: infinity and NaN. */ | |
61 | d32 = __builtin_infd32(); /* Positive infd32. */ | |
62 | d32 = -__builtin_infd32(); /* Negative infd32. */ | |
63 | d32 = __builtin_nand32(""); | |
64 | ||
65 | /* An finite 64-bits decimal floating point. */ | |
66 | d64 = 1.2345dd; /* Initialize d64. */ | |
67 | ||
68 | /* Non-finite 64-bits decimal floating point: infinity and NaN. */ | |
69 | d64 = __builtin_infd64(); /* Positive infd64. */ | |
70 | d64 = -__builtin_infd64(); /* Negative infd64. */ | |
71 | d64 = __builtin_nand64(""); | |
72 | ||
73 | /* An finite 128-bits decimal floating point. */ | |
74 | d128 = 1.2345dl; /* Initialize d128. */ | |
75 | ||
76 | /* Non-finite 128-bits decimal floating point: infinity and NaN. */ | |
77 | d128 = __builtin_infd128(); /* Positive infd128. */ | |
78 | d128 = -__builtin_infd128(); /* Negative infd128. */ | |
79 | d128 = __builtin_nand128(""); | |
80 | ||
81 | /* Functions with decimal floating point as parameter and return value. */ | |
82 | d32 = arg0_32 (0.1df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df); | |
83 | d64 = arg0_64 (0.1dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd); | |
84 | d128 = arg0_128 (0.1dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl); | |
85 | ||
86 | ds.int4 = 1; | |
87 | ds.long8 = 2; | |
88 | ds.dec32 = 1.2345df; | |
89 | ds.dec64 = 1.2345dd; | |
90 | ds.dec128 = 1.2345dl; | |
91 | ||
92 | return 0; /* Exit point. */ | |
93 | } |