Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-cmpdi-1.c
bloba7a9f62003a8e9504852c4400eb860793a00a265
1 /*
2 cmpdi-1.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #define F 140
8 #define T 13
10 #if !(defined(__SDCC_mcs51) && (defined(__SDCC_MODEL_SMALL) || defined(__SDCC_MODEL_MEDIUM))) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
12 #if 0 // Enable when SDCC support K&R-style
13 feq (x, y)
14 long long int x;
15 long long int y;
17 if (x == y)
18 return T;
19 else
20 return F;
23 fne (x, y)
24 long long int x;
25 long long int y;
27 if (x != y)
28 return T;
29 else
30 return F;
33 flt (x, y)
34 long long int x;
35 long long int y;
37 if (x < y)
38 return T;
39 else
40 return F;
43 fge (x, y)
44 long long int x;
45 long long int y;
47 if (x >= y)
48 return T;
49 else
50 return F;
53 fgt (x, y)
54 long long int x;
55 long long int y;
57 if (x > y)
58 return T;
59 else
60 return F;
63 fle (x, y)
64 long long int x;
65 long long int y;
67 if (x <= y)
68 return T;
69 else
70 return F;
73 fltu (x, y)
74 unsigned long long int x;
75 unsigned long long int y;
77 if (x < y)
78 return T;
79 else
80 return F;
83 fgeu (x, y)
84 unsigned long long int x;
85 unsigned long long int y;
87 if (x >= y)
88 return T;
89 else
90 return F;
93 fgtu (x, y)
94 unsigned long long int x;
95 unsigned long long int y;
97 if (x > y)
98 return T;
99 else
100 return F;
103 fleu (x, y)
104 unsigned long long int x;
105 unsigned long long int y;
107 if (x <= y)
108 return T;
109 else
110 return F;
112 #endif
113 long long args[] =
115 0LL,
116 1LL,
117 -1LL,
118 0x7fffffffffffffffLL,
119 0x8000000000000000LL,
120 0x8000000000000001LL,
121 0x1A3F237394D36C58LL,
122 0x93850E92CAAC1B04LL
125 int correct_results[] =
127 T, F, F, T, F, T, F, T, F, T,
128 F, T, T, F, F, T, T, F, F, T,
129 F, T, F, T, T, F, T, F, F, T,
130 F, T, T, F, F, T, T, F, F, T,
131 F, T, F, T, T, F, T, F, F, T,
132 F, T, F, T, T, F, T, F, F, T,
133 F, T, T, F, F, T, T, F, F, T,
134 F, T, F, T, T, F, T, F, F, T,
135 F, T, F, T, T, F, F, T, T, F,
136 T, F, F, T, F, T, F, T, F, T,
137 F, T, F, T, T, F, T, F, F, T,
138 F, T, T, F, F, T, T, F, F, T,
139 F, T, F, T, T, F, T, F, F, T,
140 F, T, F, T, T, F, T, F, F, T,
141 F, T, T, F, F, T, T, F, F, T,
142 F, T, F, T, T, F, T, F, F, T,
143 F, T, T, F, F, T, F, T, T, F,
144 F, T, T, F, F, T, F, T, T, F,
145 T, F, F, T, F, T, F, T, F, T,
146 F, T, T, F, F, T, F, T, T, F,
147 F, T, F, T, T, F, F, T, T, F,
148 F, T, F, T, T, F, F, T, T, F,
149 F, T, T, F, F, T, F, T, T, F,
150 F, T, F, T, T, F, F, T, T, F,
151 F, T, F, T, T, F, F, T, T, F,
152 F, T, F, T, T, F, F, T, T, F,
153 F, T, F, T, T, F, T, F, F, T,
154 T, F, F, T, F, T, F, T, F, T,
155 F, T, F, T, T, F, T, F, F, T,
156 F, T, F, T, T, F, T, F, F, T,
157 F, T, F, T, T, F, F, T, T, F,
158 F, T, F, T, T, F, T, F, F, T,
159 F, T, T, F, F, T, F, T, T, F,
160 F, T, T, F, F, T, F, T, T, F,
161 F, T, T, F, F, T, T, F, F, T,
162 F, T, T, F, F, T, F, T, T, F,
163 T, F, F, T, F, T, F, T, F, T,
164 F, T, T, F, F, T, T, F, F, T,
165 F, T, T, F, F, T, F, T, T, F,
166 F, T, T, F, F, T, T, F, F, T,
167 F, T, T, F, F, T, F, T, T, F,
168 F, T, T, F, F, T, F, T, T, F,
169 F, T, T, F, F, T, T, F, F, T,
170 F, T, T, F, F, T, F, T, T, F,
171 F, T, F, T, T, F, F, T, T, F,
172 T, F, F, T, F, T, F, T, F, T,
173 F, T, T, F, F, T, F, T, T, F,
174 F, T, T, F, F, T, T, F, F, T,
175 F, T, F, T, T, F, F, T, T, F,
176 F, T, F, T, T, F, F, T, T, F,
177 F, T, F, T, T, F, T, F, F, T,
178 F, T, T, F, F, T, T, F, F, T,
179 F, T, F, T, T, F, T, F, F, T,
180 F, T, F, T, T, F, T, F, F, T,
181 T, F, F, T, F, T, F, T, F, T,
182 F, T, F, T, T, F, T, F, F, T,
183 F, T, T, F, F, T, F, T, T, F,
184 F, T, T, F, F, T, F, T, T, F,
185 F, T, T, F, F, T, T, F, F, T,
186 F, T, T, F, F, T, F, T, T, F,
187 F, T, F, T, T, F, F, T, T, F,
188 F, T, F, T, T, F, F, T, T, F,
189 F, T, T, F, F, T, F, T, T, F,
190 T, F, F, T, F, T, F, T, F, T
192 #endif
194 void
195 testTortureExecute (void)
197 #if 0
198 int i, j, *res = correct_results;
200 for (i = 0; i < 8; i++)
202 long long arg0 = args[i];
203 for (j = 0; j < 8; j++)
205 long long arg1 = args[j];
207 if (feq (arg0, arg1) != *res++)
208 ASSERT (0);
209 if (fne (arg0, arg1) != *res++)
210 ASSERT (0);
211 if (flt (arg0, arg1) != *res++)
212 ASSERT (0);
213 if (fge (arg0, arg1) != *res++)
214 ASSERT (0);
215 if (fgt (arg0, arg1) != *res++)
216 ASSERT (0);
217 if (fle (arg0, arg1) != *res++)
218 ASSERT (0);
219 if (fltu (arg0, arg1) != *res++)
220 ASSERT (0);
221 if (fgeu (arg0, arg1) != *res++)
222 ASSERT (0);
223 if (fgtu (arg0, arg1) != *res++)
224 ASSERT (0);
225 if (fleu (arg0, arg1) != *res++)
226 ASSERT (0);
229 #endif
230 return;