head     56.1;
access   ;
symbols  ;
locks    ; strict;
comment  @# @;


56.1
date     91.11.05.09.34.03;  author jwh;  state Exp;
branches ;
next     55.1;

55.1
date     91.08.25.10.12.24;  author jwh;  state Exp;
branches ;
next     54.2;

54.2
date     91.08.21.14.39.37;  author jwh;  state Exp;
branches ;
next     54.1;

54.1
date     91.03.18.15.19.24;  author jwh;  state Exp;
branches ;
next     53.1;

53.1
date     91.03.11.19.20.42;  author jwh;  state Exp;
branches ;
next     52.1;

52.1
date     91.02.19.09.04.56;  author jwh;  state Exp;
branches ;
next     51.2;

51.2
date     91.02.10.16.41.19;  author jwh;  state Exp;
branches ;
next     51.1;

51.1
date     91.01.30.16.04.10;  author jwh;  state Exp;
branches ;
next     1.1;

1.1
date     91.01.16.16.05.55;  author jwh;  state Exp;
branches ;
next     ;


desc
@first version.
@


56.1
log
@Automatic bump of revision number for PWS version 3.25
@
text
@@


55.1
log
@Automatic bump of revision number for PWS version 3.25A
@
text
@@


54.2
log
@
pws2rcs automatic delta on Wed Aug 21 13:42:03 MDT 1991
@
text
@@


54.1
log
@Automatic bump of revision number for PWS version 3.24
@
text
@a0 160
*
*       smovecr.sa 3.1 12/10/90
*
*       The entry point sMOVECR returns the constant at the
*       offset given in the instruction field.
*
*       Input: An offset in the instruction word.
*
*       Output: The constant rounded to the user's rounding
*               mode unchecked for overflow.
*
*       Modified: fp0.
*
*
*               Copyright (C) Motorola, Inc. 1990
*                       All Rights Reserved
*
*       THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
*       The copyright notice above does not evidence any
*       actual or intended publication of such source code.



	include fpsp_h

	refr    nrm_set
	refr    round
	refr    PIRN
	refr    PIRZRM
	refr    PIRP
	refr    SMALRN
	refr    SMALRZRM
	refr    SMALRP
	refr    BIGRN
	refr    BIGRZRM
	refr    BIGRP

FZERO   dc.l    00000000
*
*       FMOVECR
*
	def     smovcr
smovcr    equ    *
	bfextu  CMDREG1B(a6){9:7},d0 ;get offset
	bfextu  USER_FPCONTROL(a6){26:2},d1 ;get rmode
*
* check range of offset
*
	tst.b   d0              ;if zero, offset is to pi
	beq.b   PI_TBL          ;it is pi
	cmpi.b  #$0a,d0         ;check range $01 - $0a
	ble.b   Z_VAL           ;if in this range, return zero
	cmpi.b  #$0e,d0         ;check range $0b - $0e
	ble.b   SM_TBL          ;valid constants in this range
	cmpi.b  #$2f,d0         ;check range $10 - $2f
	ble.b   Z_VAL           ;if in this range, return zero
	cmpi.b  #$3f,d0         ;check range $30 - $3f
	ble     BG_TBL          ;valid constants in this range
Z_VAL    equ    *
	fmove.s FZERO,fp0
	rts
PI_TBL    equ    *
	tst.b   d1              ;offset is zero, check for rmode
	beq.b   PI_RN           ;if zero, rn mode
	cmpi.b  #$3,d1          ;check for rp
	beq.b   PI_RP           ;if 3, rp mode
PI_RZRM    equ    *
	lea     PIRZRM,a0       ;rmode is rz or rm, load PIRZRM in a0
	bra     set_finx
PI_RN    equ    *
	lea     PIRN,a0         ;rmode is rn, load PIRN in a0
	bra     set_finx
PI_RP    equ    *
	lea     PIRP,a0         ;rmode is rp, load PIRP in a0
	bra     set_finx
SM_TBL    equ    *
	subi.l  #$b,d0          ;make offset in 0 - 4 range
	tst.b   d1              ;check for rmode
	beq.b   SM_RN           ;if zero, rn mode
	cmpi.b  #$3,d1          ;check for rp
	beq.b   SM_RP           ;if 3, rp mode
SM_RZRM    equ    *
	lea     SMALRZRM,a0     ;rmode is rz or rm, load SMRZRM in a0
	cmpi.b  #$2,d0          ;check if result is inex
	ble     set_finx        ;if 0 - 2, it is inexact
	bra     no_finx         ;if 3, it is exact
SM_RN    equ    *
	lea     SMALRN,a0       ;rmode is rn, load SMRN in a0
	cmpi.b  #$2,d0          ;check if result is inex
	ble     set_finx        ;if 0 - 2, it is inexact
	bra     no_finx         ;if 3, it is exact
SM_RP    equ    *
	lea     SMALRP,a0       ;rmode is rp, load SMRP in a0
	cmpi.b  #$2,d0          ;check if result is inex
	ble     set_finx        ;if 0 - 2, it is inexact
	bra     no_finx         ;if 3, it is exact
BG_TBL    equ    *
	subi.l  #$30,d0         ;make offset in 0 - f range
	tst.b   d1              ;check for rmode
	beq.b   BG_RN           ;if zero, rn mode
	cmpi.b  #$3,d1          ;check for rp
	beq.b   BG_RP           ;if 3, rp mode
BG_RZRM    equ    *
	lea     BIGRZRM,a0      ;rmode is rz or rm, load BGRZRM in a0
	cmpi.b  #$1,d0          ;check if result is inex
	ble     set_finx        ;if 0 - 1, it is inexact
	cmpi.b  #$7,d0          ;second check
	ble     no_finx         ;if 0 - 7, it is exact
	bra     set_finx        ;if 8 - f, it is inexact
BG_RN    equ    *
	lea     BIGRN,a0        ;rmode is rn, load BGRN in a0
	cmpi.b  #$1,d0          ;check if result is inex
	ble     set_finx        ;if 0 - 1, it is inexact
	cmpi.b  #$7,d0          ;second check
	ble     no_finx         ;if 0 - 7, it is exact
	bra     set_finx        ;if 8 - f, it is inexact
BG_RP    equ    *
	lea     BIGRP,a0        ;rmode is rp, load SMRP in a0
	cmpi.b  #$1,d0          ;check if result is inex
	ble     set_finx        ;if 0 - 1, it is inexact
	cmpi.b  #$7,d0          ;second check
	ble     no_finx         ;if 0 - 7, it is exact
*       bra     set_finx        ;if 8 - f, it is inexact
set_finx    equ    *
	ori.l   #inx2a_mask,USER_FPSTATUS(a6) ;set inex2/ainex
no_finx    equ    *
	mulu.l  #12,d0                  ;use offset to point into tables
	move.l  d1,L_SCR1(a6)           ;load mode for round call
	bfextu  USER_FPCONTROL(a6){24:2},d1     ;get precision
	tst.l   d1                      ;check if extended precision
*
* Precision is extended
*
	bne.b   not_ext                 ;if extended, do not call round
	fmovem.x (a0,d0),fp0            ;return result in fp0
	rts
*
* Precision is single or double
*
not_ext    equ    *
	swap    d1                      ;rnd prec in upper word of d1
	add.l   L_SCR1(a6),d1           ;merge rmode in low word of d1
	move.l  (a0,d0),FP_SCR1(a6)     ;load first word to temp storage
	move.l  4(a0,d0),FP_SCR1+4(a6)  ;load second word
	move.l  8(a0,d0),FP_SCR1+8(a6)  ;load third word
	clr.l   d0                      ;clear g,r,s
	lea     FP_SCR1(a6),a0
	btst    #sign_bit,LOCAL_EX(a0)
	sne     LOCAL_SGN(a0)           ;convert to internal ext. format

	bsr     round                   ;go round the mantissa

	bfclr   LOCAL_SGN(a0){0:8}      ;convert back to IEEE ext format
	beq.b   fin_fcr
	bset    #sign_bit,LOCAL_EX(a0)
fin_fcr    equ    *
	fmovem.x (a0),fp0
	rts

	end
@


53.1
log
@Automatic bump of revision number for PWS version 3.24B
@
text
@@


52.1
log
@Automatic bump of revision number for PWS version 3.24A
@
text
@@


51.2
log
@*** empty log message ***
@
text
@@


51.1
log
@Automatic bump of revision number for PWS version 3.24d
@
text
@d24 1
a24 1
	include fpsp.h
@


1.1
log
@Initial revision
@
text
@@
