comparison gcc/fixed-value.h @ 16:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents 77e2b8dfacca
children 84e7813d76e9
comparison
equal deleted inserted replaced
15:561a7518be6b 16:04ced10e8804
1 /* Fixed-point arithmetic support. 1 /* Fixed-point arithmetic support.
2 Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. 2 Copyright (C) 2006-2017 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify it under 6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free 7 the terms of the GNU General Public License as published by the Free
18 <http://www.gnu.org/licenses/>. */ 18 <http://www.gnu.org/licenses/>. */
19 19
20 #ifndef GCC_FIXED_VALUE_H 20 #ifndef GCC_FIXED_VALUE_H
21 #define GCC_FIXED_VALUE_H 21 #define GCC_FIXED_VALUE_H
22 22
23 #include "machmode.h"
24 #include "real.h"
25 #include "double-int.h"
26
27 struct GTY(()) fixed_value 23 struct GTY(()) fixed_value
28 { 24 {
29 double_int data; /* Store data up to 2 wide integers. */ 25 double_int data; /* Store data up to 2 wide integers. */
30 enum machine_mode mode; /* Use machine mode to know IBIT and FBIT. */ 26 scalar_mode_pod mode; /* Use machine mode to know IBIT and FBIT. */
31 }; 27 };
32 28
33 #define FIXED_VALUE_TYPE struct fixed_value 29 #define FIXED_VALUE_TYPE struct fixed_value
34 30
35 #define MAX_FCONST0 18 /* For storing 18 fixed-point zeros per 31 #define MAX_FCONST0 18 /* For storing 18 fixed-point zeros per
45 #define FCONST1(mode) fconst1[mode - HAmode] 41 #define FCONST1(mode) fconst1[mode - HAmode]
46 42
47 /* Return a CONST_FIXED with value R and mode M. */ 43 /* Return a CONST_FIXED with value R and mode M. */
48 #define CONST_FIXED_FROM_FIXED_VALUE(r, m) \ 44 #define CONST_FIXED_FROM_FIXED_VALUE(r, m) \
49 const_fixed_from_fixed_value (r, m) 45 const_fixed_from_fixed_value (r, m)
50 extern rtx const_fixed_from_fixed_value (FIXED_VALUE_TYPE, enum machine_mode); 46 extern rtx const_fixed_from_fixed_value (FIXED_VALUE_TYPE, machine_mode);
47
48 /* Construct a FIXED_VALUE from a bit payload and machine mode MODE.
49 The bits in PAYLOAD are sign-extended/zero-extended according to MODE. */
50 extern FIXED_VALUE_TYPE fixed_from_double_int (double_int, scalar_mode);
51
52 /* Return a CONST_FIXED from a bit payload and machine mode MODE.
53 The bits in PAYLOAD are sign-extended/zero-extended according to MODE. */
54 static inline rtx
55 const_fixed_from_double_int (double_int payload,
56 scalar_mode mode)
57 {
58 return
59 const_fixed_from_fixed_value (fixed_from_double_int (payload, mode),
60 mode);
61 }
51 62
52 /* Initialize from a decimal or hexadecimal string. */ 63 /* Initialize from a decimal or hexadecimal string. */
53 extern void fixed_from_string (FIXED_VALUE_TYPE *, const char *, 64 extern void fixed_from_string (FIXED_VALUE_TYPE *, const char *,
54 enum machine_mode); 65 scalar_mode);
55 66
56 /* In tree.c: wrap up a FIXED_VALUE_TYPE in a tree node. */ 67 /* In tree.c: wrap up a FIXED_VALUE_TYPE in a tree node. */
57 extern tree build_fixed (tree, FIXED_VALUE_TYPE); 68 extern tree build_fixed (tree, FIXED_VALUE_TYPE);
58 69
59 /* Extend or truncate to a new mode. */ 70 /* Extend or truncate to a new mode. */
60 extern bool fixed_convert (FIXED_VALUE_TYPE *, enum machine_mode, 71 extern bool fixed_convert (FIXED_VALUE_TYPE *, scalar_mode,
61 const FIXED_VALUE_TYPE *, bool); 72 const FIXED_VALUE_TYPE *, bool);
62 73
63 /* Convert to a fixed-point mode from an integer. */ 74 /* Convert to a fixed-point mode from an integer. */
64 extern bool fixed_convert_from_int (FIXED_VALUE_TYPE *, enum machine_mode, 75 extern bool fixed_convert_from_int (FIXED_VALUE_TYPE *, scalar_mode,
65 double_int, bool, bool); 76 double_int, bool, bool);
66 77
67 /* Convert to a fixed-point mode from a real. */ 78 /* Convert to a fixed-point mode from a real. */
68 extern bool fixed_convert_from_real (FIXED_VALUE_TYPE *, enum machine_mode, 79 extern bool fixed_convert_from_real (FIXED_VALUE_TYPE *, scalar_mode,
69 const REAL_VALUE_TYPE *, bool); 80 const REAL_VALUE_TYPE *, bool);
70 81
71 /* Convert to a real mode from a fixed-point. */ 82 /* Convert to a real mode from a fixed-point. */
72 extern void real_convert_from_fixed (REAL_VALUE_TYPE *, enum machine_mode, 83 extern void real_convert_from_fixed (REAL_VALUE_TYPE *, scalar_mode,
73 const FIXED_VALUE_TYPE *); 84 const FIXED_VALUE_TYPE *);
74 85
75 /* Compare two fixed-point objects for bitwise identity. */ 86 /* Compare two fixed-point objects for bitwise identity. */
76 extern bool fixed_identical (const FIXED_VALUE_TYPE *, const FIXED_VALUE_TYPE *); 87 extern bool fixed_identical (const FIXED_VALUE_TYPE *, const FIXED_VALUE_TYPE *);
77 88