tf-signs.c revision 1.1 1 1.1 mrg /* Copyright (C) 2008, 2009 Free Software Foundation, Inc.
2 1.1 mrg
3 1.1 mrg This file is part of GCC.
4 1.1 mrg
5 1.1 mrg GCC is free software; you can redistribute it and/or modify it under
6 1.1 mrg the terms of the GNU General Public License as published by the Free
7 1.1 mrg Software Foundation; either version 3, or (at your option) any later
8 1.1 mrg version.
9 1.1 mrg
10 1.1 mrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 1.1 mrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 1.1 mrg FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 1.1 mrg for more details.
14 1.1 mrg
15 1.1 mrg Under Section 7 of GPL version 3, you are granted additional
16 1.1 mrg permissions described in the GCC Runtime Library Exception, version
17 1.1 mrg 3.1, as published by the Free Software Foundation.
18 1.1 mrg
19 1.1 mrg You should have received a copy of the GNU General Public License and
20 1.1 mrg a copy of the GCC Runtime Library Exception along with this program;
21 1.1 mrg see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 1.1 mrg <http://www.gnu.org/licenses/>. */
23 1.1 mrg
24 1.1 mrg union _FP_UNION_Q
25 1.1 mrg {
26 1.1 mrg __float128 flt;
27 1.1 mrg struct
28 1.1 mrg {
29 1.1 mrg unsigned long frac1 : 64;
30 1.1 mrg unsigned long frac0 : 48;
31 1.1 mrg unsigned exp : 15;
32 1.1 mrg unsigned sign : 1;
33 1.1 mrg } bits __attribute__((packed));
34 1.1 mrg };
35 1.1 mrg
36 1.1 mrg __float128 __copysigntf3 (__float128, __float128);
37 1.1 mrg __float128 __fabstf2 (__float128);
38 1.1 mrg
39 1.1 mrg __float128
40 1.1 mrg __copysigntf3 (__float128 a, __float128 b)
41 1.1 mrg {
42 1.1 mrg union _FP_UNION_Q A, B;
43 1.1 mrg
44 1.1 mrg A.flt = a;
45 1.1 mrg B.flt = b;
46 1.1 mrg A.bits.sign = B.bits.sign;
47 1.1 mrg
48 1.1 mrg return A.flt;
49 1.1 mrg }
50 1.1 mrg
51 1.1 mrg __float128
52 1.1 mrg __fabstf2 (__float128 a)
53 1.1 mrg {
54 1.1 mrg union _FP_UNION_Q A;
55 1.1 mrg
56 1.1 mrg A.flt = a;
57 1.1 mrg A.bits.sign = 0;
58 1.1 mrg
59 1.1 mrg return A.flt;
60 1.1 mrg }
61