Lines Matching +full:0 +full:- +full:9 +full:a +full:- +full:b
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)
65 tst.l (TASK_MM-4,%a2)
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
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?
225 move.b (%a0),%d0
236 clr.b (%a0)
238 jne fp_e2e_roundother | %d2 == 0, round to nearest
239 tst.b %d0 | test guard bit
240 jpl 9f | zero is closer
241 btst #0,(11,%a0) | test lsb bit
243 lsl.b #1,%d0 | check low bits
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
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)
288 bfffo %d0{#0,#32},%d1
289 move.w -(%a0),%d2
298 | fancy 64-bit double-shift begins here
306 and.w #0x1f,%d2
308 or.l %d1,-(%a0)
312 move.b (-4,%a0),%d0
316 clr.b (-4,%a0)
322 move.b %d0,(-4,%a0)
329 bfffo %d0{#0,#32},%d1
331 move.w -(%a0),%d2
347 move.b (-4,%a0),%d0
348 clr.b (-4,%a0)
366 move.w -(%a0),%d2
377 1: clr.b (-4,%a0)
388 move.b %d0,(-4,%a0)
390 move.b %d0,(7,%a0)
400 move.l %d0,-(%a0)
414 | we have maybe a NaN, shift off the highest bit
416 jeq 1b
417 | we have a NaN, clear the return value
419 jra 2b
442 cmp.w #0x7fff,%d0 | Inf / NaN?
450 move.b (%a0),%d0
460 clr.b (%a0)
462 jne fp_ne_roundother | %d2 == 0, round to nearest
463 tst.b %d0 | test guard bit
464 jpl 9f | zero is closer
465 btst #0,(11,%a0) | test lsb bit
467 lsl.b #1,%d0 | check low bits
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
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)
512 bfffo %d0{#0,#32},%d1
513 move.w -(%a0),%d2
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
541 clr.b (-4,%a0)
547 move.b %d0,(-4,%a0)
554 bfffo %d0{#0,#32},%d1
556 move.w -(%a0),%d2
573 move.b (-4,%a0),%d0
574 clr.b (-4,%a0)
592 move.w -(%a0),%d2
603 1: clr.b (-4,%a0)
614 move.b %d0,(-4,%a0)
616 move.b %d0,(7,%a0)
630 | we have maybe a NaN, shift off the highest bit
634 clr.l (-4,%a0)
635 jra 1b
636 | we have a NaN, test if it is signaling
638 jne 2b
640 move.l %d0,(-4,%a0)
641 jra 2b
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
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
727 | Round to +Inf or -Inf. High word of %d2 contains the
729 swap %d2 | to -inf
730 tst.b %d2
732 jra 9b | positive, round to zero
734 tst.b %d2
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
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
776 bset #0,%d0 | Sticky bit.
780 bset #0,%d0
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
818 jne 3f | %d2 = 0 round to nearest
819 1: move.w #0x7fff,(-2,%a0)
830 tst.b (-3,%a0) | to -inf
831 jne 1b
833 4: tst.b (-3,%a0) | to +inf
834 jeq 1b
835 5: move.w #0x43fe,(-2,%a0)
836 moveq #-1,%d0
838 move.w #0xf800,%d0
840 jra 2b
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
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
876 tst.b %d0 | 8 low bits.
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
890 tst.b %d0 | test guard bit
891 jpl 9f | zero is closer
895 lsl.b #1,%d0 | check low bits
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
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
931 | a 32-bit shift.
941 bset #0,%d0 | Sticky bit.
946 bset #0,%d0 | Sticky bit.
955 tst.b (3,%a0)
960 jne 3f | %d2 = 0 round to nearest
961 1: move.w #0x7fff,(-2,%a0)
972 tst.b (-3,%a0) | to -inf
973 jne 1b
975 4: tst.b (-3,%a0) | to +inf
976 jeq 1b
977 5: move.w #0x407e,(-2,%a0)
978 move.l #0xffffff00,(%a0)+
980 jra 2b
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
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
1036 tst.b %d0 | 8 low bits.
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
1050 tst.b %d0 | test guard bit
1051 jpl 9f | zero is closer
1055 lsl.b #1,%d0 | check low bits
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
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
1085 tst.b (3,%a0)
1090 jne 3f | %d2 = 0 round to nearest
1091 1: move.w #0x7fff,(-2,%a0)
1102 tst.b (-3,%a0) | to -inf
1103 jne 1b
1105 4: tst.b (-3,%a0) | to +inf
1106 jeq 1b
1107 5: move.w #0x407e,(-2,%a0)
1108 move.l #0xffffff00,(%a0)+
1110 jra 2b
1120 | Generates a subroutine that converts an extended value to an
1121 | integer of a given size, again, with the appropriate type of
1126 | b: number of bits in that size.
1133 .macro conv_ext2int s,b argument
1134 .set inf,(1<<(\b-1))-1 | i.e. MAXINT
1135 printf PCONV,"e2i%d: %p(",2,#\b,%a0
1140 jeq fp_e2i_zero\b | zero / denorm (== 0, here)
1141 cmp.w #0x7fff,%d2
1142 jeq fp_e2i_huge\b | Inf / NaN
1143 sub.w #0x3ffe,%d2
1144 jcs fp_e2i_small\b
1145 cmp.w #\b,%d2
1146 jhi fp_e2i_large\b
1150 jne fp_e2i_round\b
1152 jne fp_e2i_round\b
1156 9: tst.w (-4,%a0)
1159 jmi fp_e2i_large\b
1160 printf PCONV,"-> %p\n",1,%d0
1164 jpl fp_e2i_large\b
1165 1: printf PCONV,"-> %p\n",1,%d0
1167 fp_e2i_round\b:
1171 .if \b>16
1176 jne 2f | %d2 == 0, round to nearest
1178 jpl 9b | zero is closer
1179 btst %d2,%d0 | test lsb bit (%d2 still 0)
1180 jne fp_e2i_doroundup\b
1182 jne fp_e2i_doroundup\b
1184 jeq 9b
1185 fp_e2i_doroundup\b:
1187 jra 9b
1190 jcs 9b | %d2 < 2, round to zero
1192 tst.w (-4,%a0) | to -inf
1193 jne fp_e2i_doroundup\b | negative, round to infinity
1194 jra 9b | positive, round to zero
1195 3: tst.w (-4,%a0) | to +inf
1196 jeq fp_e2i_doroundup\b | positive, round to infinity
1197 jra 9b | negative, round to zero
1198 | we are only want -2**127 get correctly rounded here,
1201 .if \b>16
1203 jne 2b | %d2 == 0, round to nearest
1205 jpl 9b | zero is closer
1207 jne fp_e2i_doroundup\b
1208 jra 9b
1210 fp_e2i_zero\b:
1218 fp_e2i_small\b:
1225 tst.w (-4,%a0) | to -inf
1229 2: tst.w (-4,%a0) | to +inf
1232 3: printf PCONV,"-> %p\n",1,%d0
1234 fp_e2i_large\b:
1237 tst.w (-4,%a0)
1240 1: printf PCONV,"-> %p\n",1,%d0
1242 fp_e2i_huge\b:
1247 jeq fp_e2i_large\b
1253 1: printf PCONV,"-> %p\n",1,%d0
1264 conv_ext2int b,8
1272 cmp.w #0x7fff,%d2
1274 move.w #0x7ff,%d2
1277 1: sub.w #0x3fff-0x3ff,%d2
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
1312 move.w #0xff,%d1
1315 1: sub.w #0x3fff-0x7f,%d1
1373 tst.b (%a0)+ | sign
1375 bset #FPSR_CC_NEG-24,%d0 | N bit
1376 1: cmp.w #0x7fff,(%a0)+ | exponent
1379 moveq #FPSR_CC_Z-24,%d1
1381 jne 9f
1383 jne 9f
1386 2: moveq #FPSR_CC_NAN-24,%d1
1392 moveq #FPSR_CC_INF-24,%d1
1394 9: move.b %d0,(FPD_FPSR+0,FPDATA) | set condition test result
1402 #if 0
1434 and.b #0x08,%d1
1440 or.b #0xdf,%d1
1441 and.b %d1,%d0
1444 and.b #0x80,%d1
1445 or.b %d1,%d0
1446 and.b #0xf8,%d0
1447 or.b %d0,%d2
1450 move.b (FPD_FPSR+2,FPDATA),%d0
1451 and.b (FPD_FPCR+2,FPDATA),%d0