xref: /netbsd-src/external/gpl3/gcc.old/dist/libgcc/config/arc/ieee-754/floatunsidf.S (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
1/* Copyright (C) 2008-2020 Free Software Foundation, Inc.
2   Contributor: Joern Rennecke <joern.rennecke@embecosm.com>
3		on behalf of Synopsys Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15for more details.
16
17Under Section 7 of GPL version 3, you are granted additional
18permissions described in the GCC Runtime Library Exception, version
193.1, as published by the Free Software Foundation.
20
21You should have received a copy of the GNU General Public License and
22a copy of the GCC Runtime Library Exception along with this program;
23see 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 __floatunsidf
30	.balign 4
31	FUNC(__floatunsidf)
32__floatunsidf:
33	push_s blink
34	bl.d __floatunsidf_c
35	push_s r0
36	ld_s r2,[sp]
37	st_s r1,[sp]
38	push_s r0
39	bl.d __floatunsidf_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(__floatunsidf)
49#define __floatunsidf __floatunsidf_asm
50#endif /* DEBUG */
51
52	.global __floatunsidf
53	.balign 4
54	FUNC(__floatunsidf)
55__floatunsidf:
56	lsr_s r1,r0
57	breq_s r0,0,.Lret0
58	norm r2,r1
59	mov r12,-0x41d ; -(0x3ff+31-1)
60	rsub.f r3,r2,11
61	add_s r12,r2,r12
62	add_s r2,r2,21
63#ifdef __LITTLE_ENDIAN__
64	lsr DBL0H,r0,r3
65	asl_s DBL0L,r0,r2
66#else
67	asl DBL0L,r0,r2
68	lsr_s DBL0H,r0,r3
69#endif
70	asl_s r12,r12,20
71	mov.lo DBL0H,DBL0L
72	sub_s DBL0H,DBL0H,r12
73.Lret0:	j_s.d [blink]
74	mov.ls DBL0L,0
75	ENDFUNC(__floatunsidf)
76