Lines Matching +full:1 +full:- +full:9 +full:a +full:- +full:f
9 * 1. Redistributions of source code must retain the above copyright
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?
103 moveq #1,%d1
105 1: swap %d1
125 | args: %d0 = source (single-precision fp value)
129 printf PCONV,"s2e: %p -> %p(",2,%d0,%a0
139 add.w #0x3fff-0x7f,%d1 | re-bias the exponent.
140 9: move.l %d1,(%a0)+ | fp_ext.sign, fp_ext.exp
151 jeq 9b
152 move.w #0x4000-0x7f,%d1
153 jra 9b
158 jra 9b
164 printf PCONV,"d2e: %p%p -> %p(",3,%d0,%d1,%a0
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
203 jra 9b
210 | returns 0 in %d0 for a NaN, otherwise 1
213 printf PCONV,"e2e: %p(",1,%a0
228 printf PCONV,"%p(",1,%a0
231 moveq #1,%d0
240 jpl 9f | zero is closer
243 lsl.b #1,%d0 | check low bits
244 jeq 9f | round to zero
246 addq.l #1,(8,%a0)
247 jcc 9f
248 addq.l #1,(4,%a0)
249 jcc 9f
251 addq.w #1,(2,%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
263 1: tst.b (1,%a0) | to +inf
265 jra 9b | negative, round to zero
275 move.b (-4,%a0),%d0
279 clr.w -(%a0)
281 printf PNORM,"%p(",1,%a0
284 moveq #1,%d0
289 move.w -(%a0),%d2
291 jcc 1f
295 1: move.w %d2,(%a0)+
298 | fancy 64-bit double-shift begins here
308 or.l %d1,-(%a0)
312 move.b (-4,%a0),%d0
315 jcc 1f
316 clr.b (-4,%a0)
320 1: addq.w #8,%d2
322 move.b %d0,(-4,%a0)
331 move.w -(%a0),%d2
333 jcc 1f
337 1: move.w %d2,(%a0)+
342 jcs 1f
347 move.b (-4,%a0),%d0
348 clr.b (-4,%a0)
354 1: neg.w %d1 | lower lword is splitted between
366 move.w -(%a0),%d2
368 jcc 1f
372 1: move.w %d2,(%a0)+
376 jcs 2f
377 1: clr.b (-4,%a0)
379 jcs 1f
384 1: neg.w %d1
388 move.b %d0,(-4,%a0)
393 1: move.l %d0,%d1 | lower lword is splitted between
400 move.l %d0,-(%a0)
405 jne 3f
406 1: tst.l (%a0)
407 jne 4f
408 moveq #1,%d0
410 printf PCONV,"%p(",1,%a0
414 | we have maybe a NaN, shift off the highest bit
415 3: lsl.l #1,%d0
416 jeq 1b
417 | we have a NaN, clear the return value
438 printf PNORM,"ne: %p(",1,%a0
453 printf PNORM,"%p(",1,%a0
464 jpl 9f | zero is closer
467 lsl.b #1,%d0 | check low bits
468 jeq 9f | round to zero
470 addq.l #1,(8,%a0)
471 jcc 9f
472 addq.l #1,(4,%a0)
473 jcc 9f
474 addq.w #1,(2,%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
487 1: tst.b (1,%a0) | to +inf
489 jra 9b | negative, round to zero
500 move.b (-4,%a0),%d0
504 clr.w -(%a0)
506 printf PNORM,"%p(",1,%a0
513 move.w -(%a0),%d2
515 jcc 1f
520 1: move.w %d2,(%a0)+
523 | This is exactly the same 64-bit double shift as seen above.
533 or.l %d1,-(%a0)
537 move.b (-4,%a0),%d0
540 jcc 1f
541 clr.b (-4,%a0)
545 1: addq.w #8,%d2
547 move.b %d0,(-4,%a0)
556 move.w -(%a0),%d2
558 jcc 1f
563 1: move.w %d2,(%a0)+
568 jcs 1f
573 move.b (-4,%a0),%d0
574 clr.b (-4,%a0)
580 1: neg.w %d1 | lower lword is splitted between
592 move.w -(%a0),%d2
594 jcc 1f
598 1: move.w %d2,(%a0)+
602 jcs 2f
603 1: clr.b (-4,%a0)
605 jcs 1f
610 1: neg.w %d1
614 move.b %d0,(-4,%a0)
622 jne 3f
623 1: tst.l (%a0)
624 jne 4f
626 printf PNORM,"%p(",1,%a0
630 | we have maybe a NaN, shift off the highest bit
632 lsl.l #1,%d1
633 jne 4f
634 clr.l (-4,%a0)
635 jra 1b
636 | we have a NaN, test if it is signaling
640 move.l %d0,(-4,%a0)
646 | 1: Round to zero
647 | 2: Round to -Infinity
656 | normalize an extended with double (52-bit) precision
660 printf PNORM,"nd: %p(",1,%a0
668 sub.w #0x4000-0x3ff,%d2 | will the exponent fit?
678 jne fp_nd_checkround | Are they non-zero?
680 9: subq.l #8,%a0
681 printf PNORM,"%p(",1,%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)
704 lsl.l #1,%d0 | check low bits
705 jeq 9b | round to zero
709 jcc 9b | no overflow, good.
710 addq.l #1,-(%a0) | extend to high lword
711 jcc 1f | no overflow, good.
716 addq.w #1,-(%a0)
719 1: subq.l #4,%a0
720 printf PNORM,"%p(",1,%a0
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.
763 | Another 64-bit single shift and store
764 1: sub.w #32,%d2
766 jcc 2f | No, the number is too small.
775 jeq 1f
777 1: move.l %d0,(%a0)
785 moveq #1,%d0 | Smallest possible fraction,
790 jne 1f
792 jne 1f
794 printf PNORM,"%p(",1,%a0
799 | i.e. pathologically small (exponent is 2**-16383) numbers.
800 | It is clearly impossible for even a normal extended number
803 1: fp_set_sr FPSR_EXC_UNFL | Set UNFL bit
805 clr.l -(%a0)
806 move.w #0x3c01,-(%a0) | i.e. 2**-1022
808 moveq #1,%d0
814 jeq 1f
816 1: fp_set_sr FPSR_EXC_OVFL
818 jne 3f | %d2 = 0 round to nearest
819 1: move.w #0x7fff,(-2,%a0)
823 printf PNORM,"%p(",1,%a0
828 jcs 5f | %d2 < 2, round to zero
829 jhi 4f | %d2 > 2, round to +infinity
830 tst.b (-3,%a0) | to -inf
831 jne 1b
832 jra 5f
833 4: tst.b (-3,%a0) | to +inf
834 jeq 1b
835 5: move.w #0x43fe,(-2,%a0)
836 moveq #-1,%d0
844 printf PNORM,"%p(",1,%a0
850 | normalize an extended with single (23-bit) precision
854 printf PNORM,"ns: %p(",1,%a0
862 sub.w #0x4000-0x7f,%d2 | will the exponent fit?
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-
874 1: clr.l (%a0) | zap it from memory.
877 jne fp_ns_checkround | Are they non-zero?
880 printf PNORM,"%p(",1,%a0
886 clr.b -(%a0) | clear low byte of high lword
889 jne 2f | %d2 == 0, round to nearest
891 jpl 9f | zero is closer
895 lsl.b #1,%d0 | check low bits
896 jeq 9f | round to zero
900 jcc 9f | no overflow, good.
905 addq.w #1,-(%a0)
908 9: subq.l #4,%a0
909 printf PNORM,"%p(",1,%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
943 1: tst.l (%a0)
951 moveq #1,%d0 | Smallest possible fraction,
956 jeq 1f
958 1: fp_set_sr FPSR_EXC_OVFL
960 jne 3f | %d2 = 0 round to nearest
961 1: move.w #0x7fff,(-2,%a0)
965 printf PNORM,"%p(",1,%a0
970 jcs 5f | %d2 < 2, round to zero
971 jhi 4f | %d2 > 2, round to +infinity
972 tst.b (-3,%a0) | to -inf
973 jne 1b
974 jra 5f
975 4: tst.b (-3,%a0) | to +inf
976 jeq 1b
977 5: move.w #0x407e,(-2,%a0)
984 jne 1f
986 jne 1f
988 printf PNORM,"%p(",1,%a0
993 | i.e. pathologically small (exponent is 2**-16383) numbers.
994 | It is clearly impossible for even a normal extended number
997 1: fp_set_sr FPSR_EXC_UNFL | Set UNFL bit
999 clr.l -(%a0)
1000 move.w #0x3f81,-(%a0) | i.e. 2**-126
1002 moveq #1,%d0
1007 printf PNORM,"%p(",1,%a0
1013 | normalize an extended with single (23-bit) precision
1019 printf PNORM,"nsf: %p(",1,%a0
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-
1034 1: clr.l (%a0) | zap it from memory.
1037 jne fp_nsf_checkround | Are they non-zero?
1040 printf PNORM,"%p(",1,%a0
1046 clr.b -(%a0) | clear low byte of high lword
1049 jne 2f | %d2 == 0, round to nearest
1051 jpl 9f | zero is closer
1055 lsl.b #1,%d0 | check low bits
1056 jeq 9f | round to zero
1060 jcc 9f | no overflow, good.
1065 addq.w #1,-(%a0)
1068 9: subq.l #4,%a0
1069 printf PNORM,"%p(",1,%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
1088 1: fp_set_sr FPSR_EXC_OVFL
1090 jne 3f | %d2 = 0 round to nearest
1091 1: move.w #0x7fff,(-2,%a0)
1095 printf PNORM,"%p(",1,%a0
1100 jcs 5f | %d2 < 2, round to zero
1101 jhi 4f | %d2 > 2, round to +infinity
1102 tst.b (-3,%a0) | to -inf
1103 jne 1b
1104 jra 5f
1105 4: tst.b (-3,%a0) | to +inf
1106 jeq 1b
1107 5: move.w #0x407e,(-2,%a0)
1114 printf PNORM,"%p(",1,%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
1156 9: tst.w (-4,%a0)
1157 jne 1f
1160 printf PCONV,"-> %p\n",1,%d0
1162 1: neg.\s %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
1181 lsl.l #1,%d1 | check low bits
1184 jeq 9b
1186 addq.l #1,%d0
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,
1205 jpl 9b | zero is closer
1206 lsl.l #1,%d1 | check low bits
1208 jra 9b
1213 jne 1f
1215 jeq 3f
1216 1: subq.l #4,%a0
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
1227 subq.\s #1,%d0
1228 jra 3f
1229 2: tst.w (-4,%a0) | to +inf
1230 jne 3f
1231 addq.\s #1,%d0
1232 3: printf PCONV,"-> %p\n",1,%d0
1237 tst.w (-4,%a0)
1238 jeq 1f
1239 addq.\s #1,%d0
1240 1: printf PCONV,"-> %p\n",1,%d0
1245 jne 1f
1250 1: fp_tst_sr FPSR_EXC_SNAN
1251 jne 1f
1253 1: printf PCONV,"-> %p\n",1,%d0
1268 printf PCONV,"e2d: %p(",1,%a0
1273 jne 1f
1276 jra 2f
1277 1: sub.w #0x3fff-0x3ff,%d2
1279 jmi 2f
1285 lsl.l #1,%d0
1298 getuser.l %a1@(-4),%d0,fp_err_ua2,%a1
1306 printf PCONV,"e2s: %p(",1,%a0
1311 jne 1f
1314 jra 2f
1315 1: sub.w #0x3fff-0x7f,%d1
1317 jmi 2f
1325 printf PCONV,"%08x\n",1,%d0
1356 | printf ,"f: %p\n",1,%a0
1359 subq.w #1,%d0
1361 jne 1f
1363 jra 2f
1364 1: jsr fp_normalize_double
1365 2:| printf ,"f: %p\n",1,%a0
1372 addq.l #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
1388 lsl.l #1,%d2 | ignore high bit
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
1404 jne 1f
1406 jeq 2f
1407 1: bset #FPSR_AEXC_IOP,%d0 | set IOP bit
1409 jeq 1f
1411 1: btst #FPSR_EXC_UNFL,%d0 | EXC_UNFL
1412 jeq 1f
1414 jeq 1f
1416 1: btst #FPSR_EXC_DZ,%d0 | EXC_INEX1
1417 jeq 1f
1419 1: btst #FPSR_EXC_OVFL,%d0 | EXC_OVFL
1420 jne 1f
1422 jne 1f
1424 jeq 2f
1425 1: bset #FPSR_AEXC_INEX,%d0 | set INEX bit
1452 jeq 1f
1454 1: jra fp_end