diff options
author | Anatoly Sokolov <aesok@post.ru> | 2010-06-18 19:58:48 +0400 |
---|---|---|
committer | Anatoly Sokolov <aesok@gcc.gnu.org> | 2010-06-18 19:58:48 +0400 |
commit | fd7de64cee04fd08c9a849a20e9cf0fd8d6906e1 (patch) | |
tree | 43dbfc5a3de6b7b8c559675266ac518bbcabd39a /gcc/double-int.h | |
parent | bc87224e9341b186905d8ac849aeb59463ae4f6b (diff) | |
download | gcc-fd7de64cee04fd08c9a849a20e9cf0fd8d6906e1.zip gcc-fd7de64cee04fd08c9a849a20e9cf0fd8d6906e1.tar.gz gcc-fd7de64cee04fd08c9a849a20e9cf0fd8d6906e1.tar.bz2 |
double-int.h (double_int_to_shwi, [...]): Implement as static inline.
* double-int.h (double_int_to_shwi, double_int_to_uhwi,
double_int_fits_in_uhwi_p): Implement as static inline.
(double_int_xor): New inline function.
(double_int_lrotate, double_int_rrotate, double_int_max,
double_int_umax, double_int_smax, double_int_min, double_int_umin,
double_int_smin): Declare.
(lrotate_double, rrotate_double): Remove declaration.
* double-int.c (double_int_fits_in_uhwi_p, double_int_to_shwi,
double_int_to_uhwi, lrotate_double, rrotate_double): Remove function.
(double_int_lrotate, double_int_rrotate, double_int_max,
double_int_umax, double_int_smax, double_int_min, double_int_umin,
double_int_smin): New function.
* fold-const.c (int_const_binop): Clean up, use double_int_*
functions.
* simplify-rtx.c (simplify_const_binary_operation): Clean up, use
double_int_* and immed_double_int_const functions.
From-SVN: r161002
Diffstat (limited to 'gcc/double-int.h')
-rw-r--r-- | gcc/double-int.h | 62 |
1 files changed, 51 insertions, 11 deletions
diff --git a/gcc/double-int.h b/gcc/double-int.h index c13b112..250951d 100644 --- a/gcc/double-int.h +++ b/gcc/double-int.h @@ -97,6 +97,35 @@ uhwi_to_double_int (unsigned HOST_WIDE_INT cst) return r; } +/* Returns value of CST as a signed number. CST must satisfy + double_int_fits_in_shwi_p. */ + +static inline HOST_WIDE_INT +double_int_to_shwi (double_int cst) +{ + return (HOST_WIDE_INT) cst.low; +} + +/* Returns value of CST as an unsigned number. CST must satisfy + double_int_fits_in_uhwi_p. */ + +static inline unsigned HOST_WIDE_INT +double_int_to_uhwi (double_int cst) +{ + return cst.low; +} + +bool double_int_fits_in_hwi_p (double_int, bool); +bool double_int_fits_in_shwi_p (double_int); + +/* Returns true if CST fits in unsigned HOST_WIDE_INT. */ + +static inline bool +double_int_fits_in_uhwi_p (double_int cst) +{ + return cst.high == 0; +} + /* The following operations perform arithmetics modulo 2^precision, so you do not need to call double_int_ext between them, even if you are representing numbers with precision less than @@ -109,11 +138,6 @@ double_int double_int_neg (double_int); /* You must ensure that double_int_ext is called on the operands of the following operations, if the precision of the numbers is less than 2 * HOST_BITS_PER_WIDE_INT bits. */ -bool double_int_fits_in_hwi_p (double_int, bool); -bool double_int_fits_in_shwi_p (double_int); -bool double_int_fits_in_uhwi_p (double_int); -HOST_WIDE_INT double_int_to_shwi (double_int); -unsigned HOST_WIDE_INT double_int_to_uhwi (double_int); double_int double_int_div (double_int, double_int, bool, unsigned); double_int double_int_sdiv (double_int, double_int, unsigned); double_int double_int_udiv (double_int, double_int, unsigned); @@ -157,9 +181,22 @@ double_int_and (double_int a, double_int b) return a; } +/* Returns A ^ B. */ + +static inline double_int +double_int_xor (double_int a, double_int b) +{ + a.low ^= b.low; + a.high ^= b.high; + return a; +} + + /* Shift operations. */ double_int double_int_lshift (double_int, HOST_WIDE_INT, unsigned int, bool); double_int double_int_rshift (double_int, HOST_WIDE_INT, unsigned int, bool); +double_int double_int_lrotate (double_int, HOST_WIDE_INT, unsigned int); +double_int double_int_rrotate (double_int, HOST_WIDE_INT, unsigned int); /* Returns true if CST is negative. Of course, CST is considered to be signed. */ @@ -173,6 +210,15 @@ double_int_negative_p (double_int cst) int double_int_cmp (double_int, double_int, bool); int double_int_scmp (double_int, double_int); int double_int_ucmp (double_int, double_int); + +double_int double_int_max (double_int, double_int, bool); +double_int double_int_smax (double_int, double_int); +double_int double_int_umax (double_int, double_int); + +double_int double_int_min (double_int, double_int, bool); +double_int double_int_smin (double_int, double_int); +double_int double_int_umin (double_int, double_int); + void dump_double_int (FILE *, double_int, bool); /* Zero and sign extension of numbers in smaller precisions. */ @@ -248,12 +294,6 @@ extern void lshift_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT, extern void rshift_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT, unsigned int, unsigned HOST_WIDE_INT *, HOST_WIDE_INT *, bool); -extern void lrotate_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT, - HOST_WIDE_INT, unsigned int, - unsigned HOST_WIDE_INT *, HOST_WIDE_INT *); -extern void rrotate_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT, - HOST_WIDE_INT, unsigned int, - unsigned HOST_WIDE_INT *, HOST_WIDE_INT *); extern int div_and_round_double (unsigned, int, unsigned HOST_WIDE_INT, HOST_WIDE_INT, unsigned HOST_WIDE_INT, HOST_WIDE_INT, unsigned HOST_WIDE_INT *, |