| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | * $NetBSD: round.sa,v 1.5 2022/04/08 10:17:53 andvar Exp $ | | 1 | * $NetBSD: round.sa,v 1.6 2022/04/08 14:33:24 andvar Exp $ |
2 | | | 2 | |
3 | * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP | | 3 | * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP |
4 | * M68000 Hi-Performance Microprocessor Division | | 4 | * M68000 Hi-Performance Microprocessor Division |
5 | * M68040 Software Package | | 5 | * M68040 Software Package |
6 | * | | 6 | * |
7 | * M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc. | | 7 | * M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc. |
8 | * All rights reserved. | | 8 | * All rights reserved. |
9 | * | | 9 | * |
10 | * THE SOFTWARE is provided on an "AS IS" basis and without warranty. | | 10 | * THE SOFTWARE is provided on an "AS IS" basis and without warranty. |
11 | * To the maximum extent permitted by applicable law, | | 11 | * To the maximum extent permitted by applicable law, |
12 | * MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, | | 12 | * MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, |
13 | * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A | | 13 | * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A |
14 | * PARTICULAR PURPOSE and any warranty against infringement with | | 14 | * PARTICULAR PURPOSE and any warranty against infringement with |
| @@ -520,27 +520,27 @@ no_inex: | | | @@ -520,27 +520,27 @@ no_inex: |
520 | * | | 520 | * |
521 | * The LOCAL_LO and LOCAL_GRS parts of the value are copied to FP_SCR2 | | 521 | * The LOCAL_LO and LOCAL_GRS parts of the value are copied to FP_SCR2 |
522 | * so that bfext can be used to extract the new low part of the mantissa. | | 522 | * so that bfext can be used to extract the new low part of the mantissa. |
523 | * Dnrm_lp can be called with a0 pointing to ETEMP or WBTEMP and there | | 523 | * Dnrm_lp can be called with a0 pointing to ETEMP or WBTEMP and there |
524 | * is no LOCAL_GRS scratch word following it on the fsave frame. | | 524 | * is no LOCAL_GRS scratch word following it on the fsave frame. |
525 | * | | 525 | * |
526 | xdef dnrm_lp | | 526 | xdef dnrm_lp |
527 | dnrm_lp: | | 527 | dnrm_lp: |
528 | move.l d2,-(sp) ;save d2 for temp use | | 528 | move.l d2,-(sp) ;save d2 for temp use |
529 | btst.b #E3,E_BYTE(a6) ;test for type E3 exception | | 529 | btst.b #E3,E_BYTE(a6) ;test for type E3 exception |
530 | beq.b not_E3 ;not type E3 exception | | 530 | beq.b not_E3 ;not type E3 exception |
531 | bfextu WBTEMP_GRS(a6){6:3},d2 ;extract guard,round, sticky bit | | 531 | bfextu WBTEMP_GRS(a6){6:3},d2 ;extract guard,round, sticky bit |
532 | move.l #29,d0 | | 532 | move.l #29,d0 |
533 | lsl.l d0,d2 ;shift g,r,s to their postions | | 533 | lsl.l d0,d2 ;shift g,r,s to their positions |
534 | move.l d2,d0 | | 534 | move.l d2,d0 |
535 | not_E3: | | 535 | not_E3: |
536 | move.l (sp)+,d2 ;restore d2 | | 536 | move.l (sp)+,d2 ;restore d2 |
537 | move.l LOCAL_LO(a0),FP_SCR2+LOCAL_LO(a6) | | 537 | move.l LOCAL_LO(a0),FP_SCR2+LOCAL_LO(a6) |
538 | move.l d0,FP_SCR2+LOCAL_GRS(a6) | | 538 | move.l d0,FP_SCR2+LOCAL_GRS(a6) |
539 | move.l d1,d0 ;copy the denorm threshold | | 539 | move.l d1,d0 ;copy the denorm threshold |
540 | sub.w LOCAL_EX(a0),d1 ;d1 = threshold - uns exponent | | 540 | sub.w LOCAL_EX(a0),d1 ;d1 = threshold - uns exponent |
541 | ble.b no_lp ;d1 <= 0 | | 541 | ble.b no_lp ;d1 <= 0 |
542 | cmp.w #32,d1 | | 542 | cmp.w #32,d1 |
543 | blt.b case_1 ;0 = d1 < 32 | | 543 | blt.b case_1 ;0 = d1 < 32 |
544 | cmp.w #64,d1 | | 544 | cmp.w #64,d1 |
545 | blt.b case_2 ;32 <= d1 < 64 | | 545 | blt.b case_2 ;32 <= d1 < 64 |
546 | bra.w case_3 ;d1 >= 64 | | 546 | bra.w case_3 ;d1 >= 64 |