Update copyright notices with scripts/update-copyrights
[glibc.git] / ports / sysdeps / tile / sfp-machine.h
blobff8beeffa716299160a4a7e18ba1120eba2930c6
1 /* Machine-dependent software floating-point definitions, tile version.
2 Copyright (C) 2013-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library. If not, see
17 <http://www.gnu.org/licenses/>. */
19 #include <bits/wordsize.h>
21 #define _FP_W_TYPE_SIZE __WORDSIZE
22 #define _FP_W_TYPE unsigned long
23 #define _FP_WS_TYPE signed long
24 #define _FP_I_TYPE long
26 #if _FP_W_TYPE_SIZE == 64
28 #define _FP_MUL_MEAT_S(R,X,Y) \
29 _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y)
30 #define _FP_MUL_MEAT_D(R,X,Y) \
31 _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
32 #define _FP_MUL_MEAT_Q(R,X,Y) \
33 _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
35 #define _FP_MUL_MEAT_DW_S(R,X,Y) \
36 _FP_MUL_MEAT_DW_1_imm(_FP_WFRACBITS_S,R,X,Y)
37 #define _FP_MUL_MEAT_DW_D(R,X,Y) \
38 _FP_MUL_MEAT_DW_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
39 #define _FP_MUL_MEAT_DW_Q(R,X,Y) \
40 _FP_MUL_MEAT_DW_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
42 #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm)
43 #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y)
44 #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y)
46 #define _FP_NANFRAC_S _FP_QNANBIT_S
47 #define _FP_NANFRAC_D _FP_QNANBIT_D
48 #define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0
50 #else /* _FP_W_TYPE_SIZE == 32 */
52 #define _FP_MUL_MEAT_S(R,X,Y) \
53 _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
54 #define _FP_MUL_MEAT_D(R,X,Y) \
55 _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
56 #define _FP_MUL_MEAT_Q(R,X,Y) \
57 _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
59 #define _FP_MUL_MEAT_DW_S(R,X,Y) \
60 _FP_MUL_MEAT_DW_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
61 #define _FP_MUL_MEAT_DW_D(R,X,Y) \
62 _FP_MUL_MEAT_DW_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
63 #define _FP_MUL_MEAT_DW_Q(R,X,Y) \
64 _FP_MUL_MEAT_DW_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
66 #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y)
67 #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
68 #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
70 #define _FP_NANFRAC_S _FP_QNANBIT_S
71 #define _FP_NANFRAC_D _FP_QNANBIT_D, 0
72 #define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0, 0, 0
74 #endif
76 #define _FP_NANSIGN_S 1
77 #define _FP_NANSIGN_D 1
78 #define _FP_NANSIGN_Q 1
80 #define _FP_KEEPNANFRACP 1
81 #define _FP_QNANNEGATEDP 0
83 #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
84 do { \
85 if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
86 && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
87 { \
88 R##_s = Y##_s; \
89 _FP_FRAC_COPY_##wc(R,Y); \
90 } \
91 else \
92 { \
93 R##_s = X##_s; \
94 _FP_FRAC_COPY_##wc(R,X); \
95 } \
96 R##_c = FP_CLS_NAN; \
97 } while (0)