~ubuntu-branches/ubuntu/gutsy/avr-libc/gutsy

« back to all changes in this revision

Viewing changes to libm/fplib/fp_split.S

  • Committer: Bazaar Package Importer
  • Author(s): Hakan Ardo
  • Date: 2006-11-15 21:12:47 UTC
  • mfrom: (3.1.2 feisty)
  • Revision ID: james.westby@ubuntu.com-20061115211247-b7qhgnb6o49v5zsg
Tags: 1:1.4.5-2
* Convertion to debheler fixed (closes: #398220)
* Reference to /usr/share/common-licenses in copyright file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*  -*- Mode: Asm -*-  */
2
2
 
3
3
/* Copyright (c) 2002  Michael Stumpf  <mistumpf@de.pepperl-fuchs.com>
 
4
   Copyright (c) 2005  Anatoly Sokolov <aesok@post.ru>
4
5
   All rights reserved.
5
6
 
6
7
 
32
33
   POSSIBILITY OF SUCH DAMAGE. 
33
34
*/
34
35
 
 
36
/* $Id: fp_split.S,v 1.8.2.2 2006/09/29 20:35:42 joerg_wunsch Exp $ */
 
37
 
35
38
/*
36
39
    fp_split.S is part of     FPlib V 0.3.0       ported to avr-as
37
40
    for details see readme.fplib
49
52
 * split 2 incoming operands , x and y, y first
50
53
 */
51
54
 
52
 
#if !defined(DOXYGEN)
 
55
#if !defined(__DOXYGEN__)
53
56
 
54
57
#include "gasava.inc"
 
58
#include "macros.inc"
55
59
#include "fplib.inc"
56
60
 
57
61
          TEXT_SEG(fplib, __fp_split)
65
69
    ADD     rB2,rB2           ; MSB of exponent to carry
66
70
    adc     rB3,rB3           ; whole exponent in rB3, sign in C
67
71
    CPI     rB3,0xFF          ; check for NAN
68
 
    BREQ    fp_split_nan      ; if no jump then C as hidden one is set
 
72
    BREQ    .L_fp_split_nan   ; if no jump then C as hidden one is set
69
73
    CLR     rBE            ; clear fraction extension
70
74
    cp      rBE,rB3        ; set C if nonzero exponent.  -MM 2000-11-25
71
75
    brcs    1f
76
80
    ADD     rA2,rA2        ; MSB of exponent to carry
77
81
    adc     rA3,rA3        ; whole exponent in rA3, sign in C
78
82
    CPI     rA3,0xFF       ; if no jump then C as hidden one is set
79
 
    BREQ    fp_split_nan
 
83
    BREQ    .L_fp_split_nan
80
84
    CLR     rAE            ; clear fraction extension
81
85
    cp      rAE,rA3        ; set C if nonzero exponent.  -MM 2000-11-25
82
86
    brcs    1f
84
88
1:
85
89
    ROR     rA2            ; sets hidden bit
86
90
    RET
87
 
 fp_split_nan:
 
91
.L_fp_split_nan:
 
92
#ifdef __AVR_3_BYTE_PC__
 
93
    POP     rA3
 
94
#endif    
88
95
    POP     rA3
89
96
    POP     rA3            ; pop return adress
90
97
 #ifdef __ERRNO__
95
102
 
96
103
          ENDFUNC
97
104
 
98
 
#endif /* not DOXYGEN */
 
105
/*
 
106
 *----------------------------------------------------------------------------------------------
 
107
 * split up in sign : exp : fraction   : fraction extention
 
108
 *          x  T    : rA3 : rA2:rA1:rA0: rAE
 
109
 *
 
110
 * if defined FPLIB_CHECK_FOR_NAN
 
111
 * does not return to calling function in case of NaN !
 
112
 * -> call fp_split before pushing locals to stack!!!
 
113
 *
 
114
 */
 
115
 
 
116
        FUNCTION(__fp_split_a)
 
117
 
 
118
GLOBAL(__fp_split_a)
 
119
        BST     rA3, 7          ; T = sign
 
120
        
 
121
        ADD     rA2, rA2        ; MSB of exponent to carry
 
122
        adc     rA3, rA3        ; whole exponent in rA3, sign in C
 
123
        CPI     rA3, 0xFF       ; if no jump then C as hidden one is set
 
124
        BREQ    .L_fp_split_a_nan
 
125
        CLR     rAE             ; clear fraction extension
 
126
        CP      rAE, rA3        ; set C if nonzero exponent.  
 
127
        BRCS    1f
 
128
        LDI     rA3, 1          ; zero exponent really means 1 with hidden bit = 0
 
129
1:
 
130
        ROR     rA2             ; sets hidden bit
 
131
        RET
 
132
        
 
133
.L_fp_split_a_nan:
 
134
#ifdef __AVR_3_BYTE_PC__
 
135
        POP     rA3
 
136
#endif    
 
137
        POP     rA3
 
138
        POP     rA3             ; pop return adress
 
139
 #ifdef __ERRNO__
 
140
        LDI     rA3, EDOM       ; NaN is argument domain error !
 
141
 #endif
 
142
        CLR     r1
 
143
        RJMP    _U(__fp_nan)
 
144
 
 
145
        ENDFUNC
 
146
 
 
147
 
 
148
#endif /* not __DOXYGEN__ */