annotate libgcc/soft-fp/trunctfhf2.c @ 138:fc828634a951

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 08 Nov 2018 14:17:14 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Software floating-point emulation.
kono
parents:
diff changeset
2 Truncate IEEE quad into IEEE half.
kono
parents:
diff changeset
3 Copyright (C) 1997-2015 Free Software Foundation, Inc.
kono
parents:
diff changeset
4 This file is part of the GNU C Library.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 The GNU C Library is free software; you can redistribute it and/or
kono
parents:
diff changeset
7 modify it under the terms of the GNU Lesser General Public
kono
parents:
diff changeset
8 License as published by the Free Software Foundation; either
kono
parents:
diff changeset
9 version 2.1 of the License, or (at your option) any later version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 In addition to the permissions in the GNU Lesser General Public
kono
parents:
diff changeset
12 License, the Free Software Foundation gives you unlimited
kono
parents:
diff changeset
13 permission to link the compiled version of this file into
kono
parents:
diff changeset
14 combinations with other programs, and to distribute those
kono
parents:
diff changeset
15 combinations without any restriction coming from the use of this
kono
parents:
diff changeset
16 file. (The Lesser General Public License restrictions do apply in
kono
parents:
diff changeset
17 other respects; for example, they cover modification of the file,
kono
parents:
diff changeset
18 and distribution when not linked into a combine executable.)
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 The GNU C Library is distributed in the hope that it will be useful,
kono
parents:
diff changeset
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
kono
parents:
diff changeset
23 Lesser General Public License for more details.
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 You should have received a copy of the GNU Lesser General Public
kono
parents:
diff changeset
26 License along with the GNU C Library; if not, see
kono
parents:
diff changeset
27 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 #include "soft-fp.h"
kono
parents:
diff changeset
30 #include "half.h"
kono
parents:
diff changeset
31 #include "quad.h"
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 HFtype
kono
parents:
diff changeset
34 __trunctfhf2 (TFtype a)
kono
parents:
diff changeset
35 {
kono
parents:
diff changeset
36 FP_DECL_EX;
kono
parents:
diff changeset
37 FP_DECL_Q (A);
kono
parents:
diff changeset
38 FP_DECL_H (R);
kono
parents:
diff changeset
39 HFtype r;
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 FP_INIT_ROUNDMODE;
kono
parents:
diff changeset
42 FP_UNPACK_SEMIRAW_Q (A, a);
kono
parents:
diff changeset
43 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
kono
parents:
diff changeset
44 FP_TRUNC (H, Q, 1, 4, R, A);
kono
parents:
diff changeset
45 #else
kono
parents:
diff changeset
46 FP_TRUNC (H, Q, 1, 2, R, A);
kono
parents:
diff changeset
47 #endif
kono
parents:
diff changeset
48 FP_PACK_SEMIRAW_H (r, R);
kono
parents:
diff changeset
49 FP_HANDLE_EXCEPTIONS;
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 return r;
kono
parents:
diff changeset
52 }