~ubuntu-branches/ubuntu/wily/avr-libc/wily-proposed

« back to all changes in this revision

Viewing changes to libm/fplib/ldexp.S

  • Committer: Bazaar Package Importer
  • Author(s): Hakan Ardo
  • Date: 2002-04-15 14:53:38 UTC
  • Revision ID: james.westby@ubuntu.com-20020415145338-c8hi0tn5bx74w7o3
Tags: upstream-20020203
ImportĀ upstreamĀ versionĀ 20020203

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  -*- Mode: Asm -*-  */
 
2
/*
 
3
    ldexp.S is part of     FPlib V 0.3.0       ported to avr-as
 
4
    for copyright and details see readme.fplib
 
5
 
 
6
 *----------------------------------------------------------------------------------------
 
7
 *
 
8
 * A = 2^exp * x
 
9
 * e.g.
 
10
 * double y = ldexp( 3.45, 2 ) = 2^2 * 3.45 = 13.8
 
11
 */
 
12
 
 
13
#include "gasava.inc"
 
14
#include "fplib.inc"
 
15
 
 
16
          TEXT_SEG(fplib, ldexp)
 
17
          FUNCTION(ldexp)
 
18
 
 
19
GLOBAL(ldexp)
 
20
        BST     rA3,7
 
21
        RCALL   _U(__fp_split1)         ; clears rAE
 
22
        TST     rA3                     ;
 
23
        BREQ    _ldexp_01               ; 2^x*0 = 0
 
24
        CPI     rPH,0xFF
 
25
        BREQ    _ldexp_10               ; negative
 
26
        TST     rPH
 
27
        BREQ    _ldexp_10
 
28
                                ; overflow or underflow
 
29
 _dlexp_00:
 
30
        BRPL    _ldexp_NaN              ; overflow
 
31
 _ldexp_01:
 
32
        RJMP    _U(__fp_zero)
 
33
 _ldexp_NaN:
 
34
        RJMP    _U(__fp_nanERANGE)      ; overflow
 
35
 
 
36
 _ldexp_10:
 
37
        ADD     rA3,rPL
 
38
        adc     rT1c,rPH                ;
 
39
                                ; check for overflow
 
40
        BRNE    _ldexp_20
 
41
 _ldexp_20:
 
42
        RJMP    _U(__fp_merge)          ; rT0 must not be cleared : rAE=0 no rounding anyway
 
43
 
 
44
          ENDFUNC
 
45
 
 
46