1 * $NetBSD: MONADIC.R3V6,v 1.2 1994/10/26 07:48:44 cgd Exp $ 2 3 * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP 4 * M68000 Hi-Performance Microprocessor Division 5 * M68040 Software Package 6 * 7 * M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc. 8 * All rights reserved. 9 * 10 * THE SOFTWARE is provided on an "AS IS" basis and without warranty. 11 * To the maximum extent permitted by applicable law, 12 * MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, 13 * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A 14 * PARTICULAR PURPOSE and any warranty against infringement with 15 * regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF) 16 * and any accompanying written materials. 17 * 18 * To the maximum extent permitted by applicable law, 19 * IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER 20 * (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS 21 * PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR 22 * OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE 23 * SOFTWARE. Motorola assumes no responsibility for the maintenance 24 * and support of the SOFTWARE. 25 * 26 * You are hereby granted a copyright license to use, modify, and 27 * distribute the SOFTWARE so long as this entire notice is retained 28 * without alteration in any modified and/or redistributed versions, 29 * and that such modified versions are clearly identified as such. 30 * No licenses are granted by implication, estoppel or otherwise 31 * under any patents or trademarks of Motorola, Inc. 32 33 * 34 * MONADIC.R3V6 1.3 4/30/91 35 * 36 * MONADIC.R3V6 --- MONADIC template for MCD R3V6 native C compiler 37 * 38 * The MCD compiler is old. It returns float and double values 39 * as a double stored in d0/d1. There is no support for single or extended 40 * precision operations. It's not clear whether the float registers 41 * should be preserved, so for speed, they're not. 42 * 43 44 xref tag 45 xref _OPr_ 46 xref _OPz_ 47 xref _OPi_ 48 xref _OPn_ 49 xref _OPm_ 50 51 xdef _OPd_ 52 _OPd_: 53 link a6,#-LOCAL_SIZE 54 fmove.l fpcr,d1 ; user's rounding mode/precision 55 fmove.l #0,fpcr ; force rounding mode/prec to extended,rn 56 * 57 * copy, convert and tag input argument 58 * 59 fmove.d 8(a6),fp0 60 fmove.x fp0,ETEMP(a6) 61 lea ETEMP(a6),a0 62 bsr tag 63 move.b d0,STAG(a6) 64 tst.b d0 65 bne.b _TMP_2 66 bsr _OPr_ ; normalized (regular) number 67 bra.b _TMP_6 68 _TMP_2: 69 cmp.b #$20,d0 ; zero? 70 bne.b _TMP_3 71 bsr _OPz_ 72 bra.b _TMP_6 73 _TMP_3: 74 cmp.b #$40,d0 ; infinity? 75 bne.b _TMP_4 76 bsr _OPi_ 77 bra.b _TMP_6 78 _TMP_4: 79 cmp.b #$60,d0 ; NaN? 80 bne.b _TMP_5 81 bsr _OPn_ 82 bra.b _TMP_6 83 _TMP_5: 84 bsr _OPm_ ; assuming a denorm... 85 86 _TMP_6: 87 fmove.d fp0,USER_D0(a6) ; result goes into d0/d1 pair 88 movem.l USER_D0(a6),d0-d1 89 unlk a6 90 rts 91 92