Import pre-release gcc-5.0 to new vendor branch
[dragonfly.git] / contrib / gcc-5.0 / libgcc / config / arc / ieee-754 / fixsfsi.S
1 /* Copyright (C) 2008-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 __fixsfsi
30         FUNC(__fixsfsi)
31         .balign 4
32 __fixsfsi:
33         push_s blink
34         bl.d __fixsfsi_c
35         push_s r0
36         ld_s r1,[sp]
37         st_s r0,[sp]
38         bl.d __fixsfsi_asm
39         mov_s r0,r1
40         pop_s r1
41         pop_s blink
42         cmp r0,r1
43         jeq_s [blink]
44         bl abort
45         ENDFUNC(__fixsfsi)
46 #define __fixsfsi __fixsfsi_asm
47 #endif /* DEBUG */
48
49         .global __fixsfsi
50         FUNC(__fixsfsi)
51         .balign 4
52 __fixsfsi:
53         bbit0 r0,30,.Lret0or1
54         lsr r2,r0,23
55         bmsk_s r0,r0,22
56         bset_s r0,r0,23
57         sub_s r2,r2,22;0x7f+23-0x80
58         asl.f 0,r2,24
59         neg r3,r2
60         asl.mi r0,r0,r2
61         lsr.pl r0,r0,r3
62         j_s.d [blink]
63         neg.cs r0,r0
64 .Lret0or1:
65         add.f r0,r0,0x800000
66         lsr_s r0,r0,30
67
68         bmsk_s r0,r0,0
69         j_s.d [blink]
70         neg.mi r0,r0
71         ENDFUNC(__fixsfsi)