Lines Matching +full:0 +full:- +full:9 +full:a +full:- +full:f
22 * necessary due to a potential bad interaction between the GPL and
23 * the restrictions contained in a BSD-style copyright.)
27 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
63 tst.l (TASK_MM-8,%a2)
64 jmi 1f
65 tst.l (TASK_MM-4,%a2)
66 jmi 1f
68 jpl 2f
69 1: printf ,"oops:%p,%p,%p\n",3,%a2@(TASK_MM-8),%a2@(TASK_MM-4),%a2@(TASK_MM)
85 * First several conversion functions from a source operand
94 | args: %d0 = source (32-bit long)
98 printf PCONV,"l2e: %p -> %p(",2,%d0,%a0
102 jpl 1f | positive?
106 move.w #0x3fff+31,%d1
125 | args: %d0 = source (single-precision fp value)
129 printf PCONV,"s2e: %p -> %p(",2,%d0,%a0
136 cmp.w #0xff,%d1 | NaN / Inf?
139 add.w #0x3fff-0x7f,%d1 | re-bias the exponent.
140 9: move.l %d1,(%a0)+ | fp_ext.sign, fp_ext.exp
142 clr.l (%a0) | low lword = 0
151 jeq 9b
152 move.w #0x4000-0x7f,%d1
153 jra 9b
157 move.w #0x7fff,%d1
158 jra 9b
162 getuser.l %a1@(0),%d0,fp_err_ua2,%a1
164 printf PCONV,"d2e: %p%p -> %p(",3,%d0,%d1,%a0
174 cmp.w #0x7ff,%d1 | NaN / Inf?
177 add.w #0x3fff-0x3ff,%d1 | re-bias the exponent.
178 9: move.l %d1,(%a0)+ | fp_ext.sign, fp_ext.exp
187 or.l %d1,-(%a0)
196 jeq 9b
197 move.w #0x4000-0x3ff,%d1
198 jra 9b
202 move.w #0x7fff,%d1
203 jra 9b
210 | returns 0 in %d0 for a NaN, otherwise 1
217 cmp.w #0x7fff,%d0 | Inf / NaN?
238 jne fp_e2e_roundother | %d2 == 0, round to nearest
240 jpl 9f | zero is closer
241 btst #0,(11,%a0) | test lsb bit
244 jeq 9f | round to zero
247 jcc 9f
249 jcc 9f
250 move.w #0x8000,(4,%a0)
252 9: printf PNORM,"%p(",1,%a0
258 jcs 9b | %d2 < 2, round to zero
259 jhi 1f | %d2 > 2, round to +infinity
260 tst.b (1,%a0) | to -inf
262 jra 9b | positive, round to zero
265 jra 9b | negative, round to zero
275 move.b (-4,%a0),%d0
279 clr.w -(%a0)
288 bfffo %d0{#0,#32},%d1
289 move.w -(%a0),%d2
291 jcc 1f
298 | fancy 64-bit double-shift begins here
306 and.w #0x1f,%d2
308 or.l %d1,-(%a0)
312 move.b (-4,%a0),%d0
315 jcc 1f
316 clr.b (-4,%a0)
322 move.b %d0,(-4,%a0)
329 bfffo %d0{#0,#32},%d1
331 move.w -(%a0),%d2
333 jcc 1f
342 jcs 1f
347 move.b (-4,%a0),%d0
348 clr.b (-4,%a0)
366 move.w -(%a0),%d2
368 jcc 1f
376 jcs 2f
377 1: clr.b (-4,%a0)
379 jcs 1f
388 move.b %d0,(-4,%a0)
400 move.l %d0,-(%a0)
405 jne 3f
407 jne 4f
414 | we have maybe a NaN, shift off the highest bit
417 | we have a NaN, clear the return value
442 cmp.w #0x7fff,%d0 | Inf / NaN?
462 jne fp_ne_roundother | %d2 == 0, round to nearest
464 jpl 9f | zero is closer
465 btst #0,(11,%a0) | test lsb bit
468 jeq 9f | round to zero
471 jcc 9f
473 jcc 9f
475 move.w #0x8000,(4,%a0)
476 9: printf PNORM,"%p(",1,%a0
482 jcs 9b | %d2 < 2, round to zero
483 jhi 1f | %d2 > 2, round to +infinity
484 tst.b (1,%a0) | to -inf
486 jra 9b | positive, round to zero
489 jra 9b | negative, round to zero
500 move.b (-4,%a0),%d0
504 clr.w -(%a0)
512 bfffo %d0{#0,#32},%d1
513 move.w -(%a0),%d2
515 jcc 1f
523 | This is exactly the same 64-bit double shift as seen above.
531 and.w #0x1f,%d2
533 or.l %d1,-(%a0)
537 move.b (-4,%a0),%d0
540 jcc 1f
541 clr.b (-4,%a0)
547 move.b %d0,(-4,%a0)
554 bfffo %d0{#0,#32},%d1
556 move.w -(%a0),%d2
558 jcc 1f
568 jcs 1f
573 move.b (-4,%a0),%d0
574 clr.b (-4,%a0)
592 move.w -(%a0),%d2
594 jcc 1f
602 jcs 2f
603 1: clr.b (-4,%a0)
605 jcs 1f
614 move.b %d0,(-4,%a0)
622 jne 3f
624 jne 4f
630 | we have maybe a NaN, shift off the highest bit
633 jne 4f
634 clr.l (-4,%a0)
636 | we have a NaN, test if it is signaling
640 move.l %d0,(-4,%a0)
645 | 0: Round to nearest
647 | 2: Round to -Infinity
656 | normalize an extended with double (52-bit) precision
666 cmp.w #0x7fff,%d2
668 sub.w #0x4000-0x3ff,%d2 | will the exponent fit?
670 cmp.w #0x7fe,%d2
678 jne fp_nd_checkround | Are they non-zero?
680 9: subq.l #8,%a0
689 and.w #0xf800,(2,%a0) | clear bits 0-10
691 jne 2f | %d2 == 0, round to nearest
693 jpl 9b | zero is closer
697 | IEEE754-specified "round to even" behaviour. If the guard
699 | in grade-school arithmetic (i.e. 1.5 rounds to 2.0)
705 jeq 9b | round to zero
708 add.l #0x800,(%a0)
709 jcc 9b | no overflow, good.
710 addq.l #1,-(%a0) | extend to high lword
711 jcc 1f | no overflow, good.
713 | only happens when %d1 was 0xfffff800, it is now zero, so
715 move.w #0x8000,(%a0)
716 addq.w #1,-(%a0)
717 cmp.w #0x43ff,(%a0)+ | exponent now overflown?
725 jcs 9b | %d2 < 2, round to zero
726 jhi 3f | %d2 > 2, round to +infinity
727 | Round to +Inf or -Inf. High word of %d2 contains the
729 swap %d2 | to -inf
732 jra 9b | positive, round to zero
736 jra 9b | negative, round to zero
737 | Exponent underflow. Try to make a denormal, and set it to
741 move.w #0x3c01,(-2,%a0) | 2**-1022
744 jcc 1f
745 | Again, another 64-bit double shift.
761 bset #0,%d0 | Yes, so set the "sticky bit".
763 | Another 64-bit single shift and store
766 jcc 2f | No, the number is too small.
775 jeq 1f
776 bset #0,%d0 | Sticky bit.
780 bset #0,%d0
790 jne 1f
792 jne 1f
799 | i.e. pathologically small (exponent is 2**-16383) numbers.
800 | It is clearly impossible for even a normal extended number
805 clr.l -(%a0)
806 move.w #0x3c01,-(%a0) | i.e. 2**-1022
812 move.w #0x7ff,%d0
814 jeq 1f
818 jne 3f | %d2 = 0 round to nearest
819 1: move.w #0x7fff,(-2,%a0)
828 jcs 5f | %d2 < 2, round to zero
829 jhi 4f | %d2 > 2, round to +infinity
830 tst.b (-3,%a0) | to -inf
832 jra 5f
833 4: tst.b (-3,%a0) | to +inf
835 5: move.w #0x43fe,(-2,%a0)
836 moveq #-1,%d0
838 move.w #0xf800,%d0
850 | normalize an extended with single (23-bit) precision
860 cmp.w #0x7fff,%d2
862 sub.w #0x4000-0x7f,%d2 | will the exponent fit?
864 cmp.w #0xfe,%d2
869 jeq 1f
870 | Set a sticky bit if it is non-zero. This should only
871 | affect the rounding in what would otherwise be equal-
873 bset #0,%d0
877 jne fp_ns_checkround | Are they non-zero?
886 clr.b -(%a0) | clear low byte of high lword
889 jne 2f | %d2 == 0, round to nearest
891 jpl 9f | zero is closer
896 jeq 9f | round to zero
899 add.l #0x100,(%a0)
900 jcc 9f | no overflow, good.
901 | Overflow. This means that the %d1 was 0xffffff00, so it
904 move.w #0x8000,(%a0)
905 addq.w #1,-(%a0)
906 cmp.w #0x407f,(%a0)+ | exponent now overflown?
908 9: subq.l #4,%a0
915 jcs 9b | %d2 < 2, round to zero
916 jhi 3f | %d2 > 2, round to +infinity
917 tst.b (-3,%a0) | to -inf
919 jra 9b | positive, round to zero
920 3: tst.b (-3,%a0) | to +inf
922 jra 9b | negative, round to zero
923 | Exponent underflow. Try to make a denormal, and set it to
927 move.w #0x3f81,(-2,%a0) | 2**-126
930 jcc 2f
931 | a 32-bit shift.
940 jeq 1f
941 bset #0,%d0 | Sticky bit.
946 bset #0,%d0 | Sticky bit.
956 jeq 1f
960 jne 3f | %d2 = 0 round to nearest
961 1: move.w #0x7fff,(-2,%a0)
970 jcs 5f | %d2 < 2, round to zero
971 jhi 4f | %d2 > 2, round to +infinity
972 tst.b (-3,%a0) | to -inf
974 jra 5f
975 4: tst.b (-3,%a0) | to +inf
977 5: move.w #0x407e,(-2,%a0)
978 move.l #0xffffff00,(%a0)+
984 jne 1f
986 jne 1f
993 | i.e. pathologically small (exponent is 2**-16383) numbers.
994 | It is clearly impossible for even a normal extended number
999 clr.l -(%a0)
1000 move.w #0x3f81,-(%a0) | i.e. 2**-126
1013 | normalize an extended with single (23-bit) precision
1024 cmp.w #0x7fff,%d2
1029 jeq 1f
1030 | Set a sticky bit if it is non-zero. This should only
1031 | affect the rounding in what would otherwise be equal-
1033 bset #0,%d0
1037 jne fp_nsf_checkround | Are they non-zero?
1046 clr.b -(%a0) | clear low byte of high lword
1049 jne 2f | %d2 == 0, round to nearest
1051 jpl 9f | zero is closer
1056 jeq 9f | round to zero
1059 add.l #0x100,(%a0)
1060 jcc 9f | no overflow, good.
1061 | Overflow. This means that the %d1 was 0xffffff00, so it
1064 move.w #0x8000,(%a0)
1065 addq.w #1,-(%a0)
1066 cmp.w #0x407f,(%a0)+ | exponent now overflown?
1068 9: subq.l #4,%a0
1075 jcs 9b | %d2 < 2, round to zero
1076 jhi 3f | %d2 > 2, round to +infinity
1077 tst.b (-3,%a0) | to -inf
1079 jra 9b | positive, round to zero
1080 3: tst.b (-3,%a0) | to +inf
1082 jra 9b | negative, round to zero
1086 jeq 1f
1090 jne 3f | %d2 = 0 round to nearest
1091 1: move.w #0x7fff,(-2,%a0)
1100 jcs 5f | %d2 < 2, round to zero
1101 jhi 4f | %d2 > 2, round to +infinity
1102 tst.b (-3,%a0) | to -inf
1104 jra 5f
1105 4: tst.b (-3,%a0) | to +inf
1107 5: move.w #0x407e,(-2,%a0)
1108 move.l #0xffffff00,(%a0)+
1120 | Generates a subroutine that converts an extended value to an
1121 | integer of a given size, again, with the appropriate type of
1134 .set inf,(1<<(\b-1))-1 | i.e. MAXINT
1140 jeq fp_e2i_zero\b | zero / denorm (== 0, here)
1141 cmp.w #0x7fff,%d2
1143 sub.w #0x3ffe,%d2
1156 9: tst.w (-4,%a0)
1157 jne 1f
1160 printf PCONV,"-> %p\n",1,%d0
1163 jeq 1f
1165 1: printf PCONV,"-> %p\n",1,%d0
1172 jeq 5f
1176 jne 2f | %d2 == 0, round to nearest
1178 jpl 9b | zero is closer
1179 btst %d2,%d0 | test lsb bit (%d2 still 0)
1184 jeq 9b
1187 jra 9b
1190 jcs 9b | %d2 < 2, round to zero
1191 jhi 3f | %d2 > 2, round to +infinity
1192 tst.w (-4,%a0) | to -inf
1194 jra 9b | positive, round to zero
1195 3: tst.w (-4,%a0) | to +inf
1197 jra 9b | negative, round to zero
1198 | we are only want -2**127 get correctly rounded here,
1203 jne 2b | %d2 == 0, round to nearest
1205 jpl 9b | zero is closer
1208 jra 9b
1213 jne 1f
1215 jeq 3f
1223 jcs 3f | %d2 < 2, round to nearest/zero
1224 jhi 2f | %d2 > 2, round to +infinity
1225 tst.w (-4,%a0) | to -inf
1226 jeq 3f
1228 jra 3f
1229 2: tst.w (-4,%a0) | to +inf
1230 jne 3f
1232 3: printf PCONV,"-> %p\n",1,%d0
1237 tst.w (-4,%a0)
1238 jeq 1f
1240 1: printf PCONV,"-> %p\n",1,%d0
1245 jne 1f
1251 jne 1f
1253 1: printf PCONV,"-> %p\n",1,%d0
1272 cmp.w #0x7fff,%d2
1273 jne 1f
1274 move.w #0x7ff,%d2
1276 jra 2f
1277 1: sub.w #0x3fff-0x3ff,%d2
1279 jmi 2f
1298 getuser.l %a1@(-4),%d0,fp_err_ua2,%a1
1299 getuser.l %a1@(0),%d1,fp_err_ua2,%a1
1310 cmp.w #0x7fff,%d1
1311 jne 1f
1312 move.w #0xff,%d1
1314 jra 2f
1315 1: sub.w #0x3fff-0x7f,%d1
1317 jmi 2f
1356 | printf ,"f: %p\n",1,%a0
1361 jne 1f
1363 jra 2f
1365 2:| printf ,"f: %p\n",1,%a0
1374 jeq 1f
1375 bset #FPSR_CC_NEG-24,%d0 | N bit
1376 1: cmp.w #0x7fff,(%a0)+ | exponent
1377 jeq 2f
1379 moveq #FPSR_CC_Z-24,%d1
1381 jne 9f
1383 jne 9f
1384 jra 8f
1386 2: moveq #FPSR_CC_NAN-24,%d1
1389 jne 8f
1391 jne 8f
1392 moveq #FPSR_CC_INF-24,%d1
1394 9: move.b %d0,(FPD_FPSR+0,FPDATA) | set condition test result
1402 #if 0
1404 jne 1f
1406 jeq 2f
1409 jeq 1f
1412 jeq 1f
1414 jeq 1f
1417 jeq 1f
1420 jne 1f
1422 jne 1f
1424 jeq 2f
1434 and.b #0x08,%d1
1440 or.b #0xdf,%d1
1444 and.b #0x80,%d1
1446 and.b #0xf8,%d0
1452 jeq 1f