Lines Matching +full:n +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0
3 #define _GNU_SOURCE 1
5 #define __USE_GNU 1
18 CF = 1 << 0,
19 PF = 1 << 2,
20 ZF = 1 << 6,
28 /* sNaN is s|111 1111 1|1xx xxxx xxxx xxxx xxxx xxxx */
29 /* qNaN is s|111 1111 1|0xx xxxx xxxx xxxx xxxx xxxx (some x must be nonzero) */
40 asm ("\n" in test()
42 " push %0""\n" in test()
43 " popf""\n" in test()
44 " fld1""\n" in test()
45 " fldpi""\n" in test()
46 " fcomi %%st(1), %%st" "\n" in test()
47 " ffree %%st(0)" "\n" in test()
48 " ffree %%st(1)" "\n" in test()
49 " pushf""\n" in test()
50 " pop res_fcomi_1_pi""\n" in test()
52 " push %0""\n" in test()
53 " popf""\n" in test()
54 " fldpi""\n" in test()
55 " fld1""\n" in test()
56 " fcomi %%st(1), %%st" "\n" in test()
57 " ffree %%st(0)" "\n" in test()
58 " ffree %%st(1)" "\n" in test()
59 " pushf""\n" in test()
60 " pop res_fcomi_pi_1""\n" in test()
62 " push %0""\n" in test()
63 " popf""\n" in test()
64 " fld1""\n" in test()
65 " fld1""\n" in test()
66 " fcomi %%st(1), %%st" "\n" in test()
67 " ffree %%st(0)" "\n" in test()
68 " ffree %%st(1)" "\n" in test()
69 " pushf""\n" in test()
70 " pop res_fcomi_1_1""\n" in test()
75 printf("[BAD]\tfcomi_1_pi with flags:%lx\n", flags); in test()
76 return 1; in test()
79 printf("[BAD]\tfcomi_pi_1 with flags:%lx->%lx\n", flags, res_fcomi_pi_1 & ARITH); in test()
80 return 1; in test()
83 printf("[BAD]\tfcomi_1_1 with flags:%lx\n", flags); in test()
84 return 1; in test()
87 printf("[BAD]\tFE_INVALID is set in %s\n", __func__); in test()
88 return 1; in test()
97 asm ("\n" in test_qnan()
98 " push %0""\n" in test_qnan()
99 " popf""\n" in test_qnan()
100 " flds qnan""\n" in test_qnan()
101 " fld1""\n" in test_qnan()
102 " fnclex""\n" // fld of a qnan raised FE_INVALID, clear it in test_qnan()
103 " fcomi %%st(1), %%st" "\n" in test_qnan()
104 " ffree %%st(0)" "\n" in test_qnan()
105 " ffree %%st(1)" "\n" in test_qnan()
106 " pushf""\n" in test_qnan()
107 " pop res_fcomi_nan_1""\n" in test_qnan()
112 printf("[BAD]\tfcomi_qnan_1 with flags:%lx\n", flags); in test_qnan()
113 return 1; in test_qnan()
116 printf("[BAD]\tFE_INVALID is not set in %s\n", __func__); in test_qnan()
117 return 1; in test_qnan()
126 asm ("\n" in testu_qnan()
127 " push %0""\n" in testu_qnan()
128 " popf""\n" in testu_qnan()
129 " flds qnan""\n" in testu_qnan()
130 " fld1""\n" in testu_qnan()
131 " fnclex""\n" // fld of a qnan raised FE_INVALID, clear it in testu_qnan()
132 " fucomi %%st(1), %%st" "\n" in testu_qnan()
133 " ffree %%st(0)" "\n" in testu_qnan()
134 " ffree %%st(1)" "\n" in testu_qnan()
135 " pushf""\n" in testu_qnan()
136 " pop res_fcomi_nan_1""\n" in testu_qnan()
141 printf("[BAD]\tfcomi_qnan_1 with flags:%lx\n", flags); in testu_qnan()
142 return 1; in testu_qnan()
145 printf("[BAD]\tFE_INVALID is set in %s\n", __func__); in testu_qnan()
146 return 1; in testu_qnan()
155 asm ("\n" in testu_snan()
156 " push %0""\n" in testu_snan()
157 " popf""\n" in testu_snan()
158 // " flds snan""\n" // WRONG, this will convert 32-bit fp snan to a *qnan* in 80-bit fp register! in testu_snan()
159 // " fstpt snan1""\n" // if uncommented, it prints "snan1:7fff c111 1100 0000 0000" - c111, not 811… in testu_snan()
160 // " fnclex""\n" // flds of a snan raised FE_INVALID, clear it in testu_snan()
161 " fldt snan80""\n" // fldt never raise FE_INVALID in testu_snan()
162 " fld1""\n" in testu_snan()
163 " fucomi %%st(1), %%st" "\n" in testu_snan()
164 " ffree %%st(0)" "\n" in testu_snan()
165 " ffree %%st(1)" "\n" in testu_snan()
166 " pushf""\n" in testu_snan()
167 " pop res_fcomi_nan_1""\n" in testu_snan()
172 printf("[BAD]\tfcomi_qnan_1 with flags:%lx\n", flags); in testu_snan()
173 return 1; in testu_snan()
175 // printf("snan:%x snan1:%04x %04x %04x %04x %04x\n", snan, snan1[4], snan1[3], snan1[2], snan1[1],… in testu_snan()
177 printf("[BAD]\tFE_INVALID is not set in %s\n", __func__); in testu_snan()
178 return 1; in testu_snan()
187 asm ("\n" in testp()
189 " push %0""\n" in testp()
190 " popf""\n" in testp()
191 " fld1""\n" in testp()
192 " fldpi""\n" in testp()
193 " fcomip %%st(1), %%st" "\n" in testp()
194 " ffree %%st(0)" "\n" in testp()
195 " pushf""\n" in testp()
196 " pop res_fcomi_1_pi""\n" in testp()
198 " push %0""\n" in testp()
199 " popf""\n" in testp()
200 " fldpi""\n" in testp()
201 " fld1""\n" in testp()
202 " fcomip %%st(1), %%st" "\n" in testp()
203 " ffree %%st(0)" "\n" in testp()
204 " pushf""\n" in testp()
205 " pop res_fcomi_pi_1""\n" in testp()
207 " push %0""\n" in testp()
208 " popf""\n" in testp()
209 " fld1""\n" in testp()
210 " fld1""\n" in testp()
211 " fcomip %%st(1), %%st" "\n" in testp()
212 " ffree %%st(0)" "\n" in testp()
213 " pushf""\n" in testp()
214 " pop res_fcomi_1_1""\n" in testp()
219 printf("[BAD]\tfcomi_1_pi with flags:%lx\n", flags); in testp()
220 return 1; in testp()
223 printf("[BAD]\tfcomi_pi_1 with flags:%lx->%lx\n", flags, res_fcomi_pi_1 & ARITH); in testp()
224 return 1; in testp()
227 printf("[BAD]\tfcomi_1_1 with flags:%lx\n", flags); in testp()
228 return 1; in testp()
231 printf("[BAD]\tFE_INVALID is set in %s\n", __func__); in testp()
232 return 1; in testp()
241 asm ("\n" in testp_qnan()
242 " push %0""\n" in testp_qnan()
243 " popf""\n" in testp_qnan()
244 " flds qnan""\n" in testp_qnan()
245 " fld1""\n" in testp_qnan()
246 " fnclex""\n" // fld of a qnan raised FE_INVALID, clear it in testp_qnan()
247 " fcomip %%st(1), %%st" "\n" in testp_qnan()
248 " ffree %%st(0)" "\n" in testp_qnan()
249 " pushf""\n" in testp_qnan()
250 " pop res_fcomi_nan_1""\n" in testp_qnan()
255 printf("[BAD]\tfcomi_qnan_1 with flags:%lx\n", flags); in testp_qnan()
256 return 1; in testp_qnan()
259 printf("[BAD]\tFE_INVALID is not set in %s\n", __func__); in testp_qnan()
260 return 1; in testp_qnan()
269 asm ("\n" in testup_qnan()
270 " push %0""\n" in testup_qnan()
271 " popf""\n" in testup_qnan()
272 " flds qnan""\n" in testup_qnan()
273 " fld1""\n" in testup_qnan()
274 " fnclex""\n" // fld of a qnan raised FE_INVALID, clear it in testup_qnan()
275 " fucomip %%st(1), %%st" "\n" in testup_qnan()
276 " ffree %%st(0)" "\n" in testup_qnan()
277 " pushf""\n" in testup_qnan()
278 " pop res_fcomi_nan_1""\n" in testup_qnan()
283 printf("[BAD]\tfcomi_qnan_1 with flags:%lx\n", flags); in testup_qnan()
284 return 1; in testup_qnan()
287 printf("[BAD]\tFE_INVALID is set in %s\n", __func__); in testup_qnan()
288 return 1; in testup_qnan()
295 printf("[FAIL]\tGot signal %d, exiting\n", sig); in sighandler()
296 exit(1); in sighandler()
303 /* SIGILL triggers on 32-bit kernels w/o fcomi emulation in main()
311 printf("[RUN]\tTesting f[u]comi[p] instructions\n"); in main()
327 printf("[OK]\tf[u]comi[p]\n"); in main()
329 printf("[FAIL]\tf[u]comi[p] errors: %d\n", err); in main()