Merge branch 'vendor/GCC50' - gcc 5.0 snapshot 1 FEB 2015
[dragonfly.git] / contrib / gcc-5.0 / libgcc / config / arc / ieee-754 / extendsfdf2.S
1 /* Copyright (C) 2006-2015 Free Software Foundation, Inc.
2    Contributor: Joern Rennecke <joern.rennecke@embecosm.com>
3                 on behalf of Synopsys Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
20
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24 <http://www.gnu.org/licenses/>.  */
25
26 #include "arc-ieee-754.h"
27
28 #if 0 /* DEBUG */
29         .global __extendsfdf2
30         .balign 4
31         FUNC(__extendsfdf2)
32 __extendsfdf2:
33         push_s blink
34         bl.d __extendsfdf2_c
35         push_s r0
36         ld_s r2,[sp]
37         st_s r1,[sp]
38         push_s r0
39         bl.d __extendsfdf2_asm
40         mov_s r0,r2
41         pop_s r2
42         pop_s r3
43         pop_s blink
44         cmp r0,r2
45         cmp.eq r1,r3
46         jeq_s [blink]
47         bl abort
48         ENDFUNC(__extendsfdf2)
49 #define __extendsfdf2 __extendsfdf2_asm
50 #endif /* DEBUG */
51 #if 0 /* ARC600 */
52 __extendsfdf2:
53         lsr r2,r0,23
54         tst r2,0xff
55         bic.ne.f r2,0xff
56         beq_s .Linf_nan_denorm_0
57 ..
58 .Linf_nan_denorm:
59         bbit1 r0,30,.Linf_nan
60 #endif
61         .global __extendsfdf2
62         .balign 4
63         FUNC(__extendsfdf2)
64 __extendsfdf2:
65         add.f r1,r0,r0
66         norm r3,r1
67 #ifdef __LITTLE_ENDIAN__
68         lsr_s DBL0H,r1,4
69         brhs r3,7,.Linf_nan_denorm_0
70         asl_s DBL0L,r0,29
71         add_s DBL0H,DBL0H, \
72                 0x38000000
73 #else
74         lsr r2,r1,4
75         brhs r3,7,.Linf_nan_denorm_0
76         asl_s DBL0L,r1,28
77         add DBL0H,r2, \
78                 0x38000000
79 #endif
80         j_s.d [blink]
81         bxor.cs DBL0H,DBL0H,31
82         .balign 4
83 .Linf_nan_denorm_0:
84 #ifdef __LITTLE_ENDIAN__
85         mov_s DBL0H,r0
86         jeq.d [blink]
87         mov.eq DBL0L,0
88 #else
89         jeq_s [blink]
90 #endif
91         bmi .Linf_nan
92         asl_s r0,r0,r3
93         rsub r3,r3,0x380+6
94 #ifdef __LITTLE_ENDIAN__
95         asl_s r3,r3,20
96         lsr DBL0H,r0,9
97         asl_s DBL0L,r0,23
98         add_s DBL0H,DBL0H,r3
99         j_s.d [blink]
100         bxor.cs DBL0H,DBL0H,31
101 #else
102         asl DBL0L,r0,23
103         lsr_s DBL0H,r0,9
104         asl_s r3,r3,20
105         bxor.cs DBL0H,DBL0H,31
106         j_s.d [blink]
107         add_l DBL0H,DBL0H,r3
108 #endif
109 .Linf_nan:
110 #ifdef __LITTLE_ENDIAN__
111         lsr DBL0H,r0,3
112
113         or_s DBL0H,DBL0H,r0
114         j_s.d [blink]
115         mov_l DBL0L,0
116 #else
117         lsr r3,r0,3
118         mov_s DBL0L,0
119         j_s.d [blink]
120         or_l DBL0H,r0,r3
121 #endif
122         ENDFUNC(__extendsfdf2)