~ubuntu-branches/ubuntu/utopic/avr-libc/utopic

« back to all changes in this revision

Viewing changes to libm/fplib/fp_mpack.S

  • Committer: Package Import Robot
  • Author(s): Hakan Ardo
  • Date: 2014-06-03 14:25:22 UTC
  • mfrom: (1.2.6)
  • Revision ID: package-import@ubuntu.com-20140603142522-76ia7366969f7jc2
Tags: 1:1.8.0+Atmel3.4.4-1
* New upstream release from Atmel-AVR-GNU-Toolchain v3.4.4
  (http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-
  Toolchain/3.4.4/) (closes: #740391, #739953, #695514, #719635)
* Moved manpages to the 3avr section of /usr/share/man
* Added avr-man manpage (closes: #733939)
* Added build-arch and build-indep targets
* Moved build to binary-indep target
* Increased standards version to 3.9.5
* Added ${misc:Depends} dependency
* Applied upstream fix to make pgmspace.h ansi compatible (closes:
  #675759)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2002  Michael Stumpf  <mistumpf@de.pepperl-fuchs.com>
2
 
   Copyright (c) 2006  Dmitry Xmelkov
3
 
   All rights reserved.
4
 
 
5
 
   Redistribution and use in source and binary forms, with or without
6
 
   modification, are permitted provided that the following conditions are met:
7
 
 
8
 
   * Redistributions of source code must retain the above copyright
9
 
     notice, this list of conditions and the following disclaimer.
10
 
   * Redistributions in binary form must reproduce the above copyright
11
 
     notice, this list of conditions and the following disclaimer in
12
 
     the documentation and/or other materials provided with the
13
 
     distribution.
14
 
   * Neither the name of the copyright holders nor the names of
15
 
     contributors may be used to endorse or promote products derived
16
 
     from this software without specific prior written permission.
17
 
 
18
 
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
 
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
 
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
 
   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22
 
   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
 
   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
 
   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
 
   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
 
   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
 
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
 
   POSSIBILITY OF SUCH DAMAGE. */
29
 
 
30
 
/* $Id: fp_mpack.S 2191 2010-11-05 13:45:57Z arcanum $ */
31
 
 
32
 
#if !defined(__AVR_TINY__)
33
 
 
34
 
#include "fp32def.h"
35
 
#include "asmdef.h"
36
 
 
37
 
/* float __fp_mpack (<non_standart>);
38
 
     Merge parts of float value.
39
 
 
40
 
  Input:
41
 
     T                  - sign
42
 
     rA3                - exponent
43
 
     rA2.rA1.rA0[.rAE]  - mantissa
44
 
  Possible input combinations:
45
 
     exp==0     -       zero or subnormal, mantissa shift to right is needed
46
 
     exp==1,      rA2 < 0x80         -  subnormal
47
 
     exp==1,      rA2 >= 0x80        -  normal
48
 
     exp==2..254, rA2 >= 0x80        -  normal
49
 
     exp==255,    rA2.rA1.rA0 == 0   -  Infinity
50
 
     exp==255,    rA2.rA1.rA0 != 0   -  NaN
51
 
 
52
 
  The __fp_mpack_finite entry point is intended for case where it is
53
 
  known that the A is a finite number.
54
 
 */
55
 
 
56
 
ENTRY __fp_mpack
57
 
        cpi     rA3, 255
58
 
        breq    1f
59
 
 
60
 
ENTRY __fp_mpack_finite
61
 
        subi    rA3, 1
62
 
        brsh    1f
63
 
        ror     rA2             ; rA2.7 := 1 to restore zero rA3
64
 
        ror     rA1
65
 
        ror     rA0
66
 
        ror     rAE
67
 
 
68
 
1:      lsl     rA2
69
 
        adc     rA3, r1         ; switch (A)
70
 
                                ;  zero:      rA3 is restored to 0
71
 
                                ;  subnormal: rA3 is stayed (or restored to) 0
72
 
                                ;  normal:    rA3 is restored to initial
73
 
                                ;  nonfinite: rA3 is stayed 255
74
 
        lsr     rA3
75
 
        ror     rA2
76
 
        bld     rA3, 7          ; sign
77
 
        ret
78
 
 
79
 
ENDFUNC
80
 
 
81
 
#endif /* !defined(__AVR_TINY__) */