summaryrefslogtreecommitdiff
path: root/gcc/double-int.c
diff options
context:
space:
mode:
authorcrowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-07 00:06:35 +0000
committercrowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-07 00:06:35 +0000
commitcf8f0e636f5ca214299481dff1ff2697ebb02596 (patch)
tree82231821d6793cd33f15d6b9792a8b82f2ec15d1 /gcc/double-int.c
parent0131450a329f26a25432d2904f50215f3e01214c (diff)
downloadgcc-cf8f0e636f5ca214299481dff1ff2697ebb02596.tar.gz
Modify gcc/*.[hc] double_int call sites to use the new interface.
This change entailed adding a few new methods to double_int. The change results in a 0.163% time improvement with a 70% confidence. Tested on x86_64. Index: gcc/ChangeLog 2012-09-06 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::operator &=): New. (double_int::operator ^=): New. (double_int::operator |=): New. (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. (binary double_int::operator *): Remove parameter name. (binary double_int::operator +): Likewise. (binary double_int::operator -): Likewise. (binary double_int::operator &): Likewise. (double_int::operator |): Likewise. (double_int::operator ^): Likewise. (double_int::and_not): Likewise. (double_int::from_shwi): Tidy formatting. (double_int::from_uhwi): Likewise. (double_int::from_uhwi): Likewise. * double-int.c (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. * builtins.c: Modify to use the new double_int interface. * cgraph.c: Likewise. * combine.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * gimple-fold.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimplify-rtx.c: Likewise. * ipa-prop.c: Likewise. * loop-iv.c: Likewise. * optabs.c: Likewise. * stor-layout.c: Likewise. * tree-affine.c: Likewise. * tree-cfg.c: Likewise. * tree-dfa.c: Likewise. * tree-flow-inline.h: Likewise. * tree-object-size.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-sccvn: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vrp.c: Likewise. * tree.h: Likewise. * tree.c: Likewise. * varasm.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191047 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/double-int.c')
-rw-r--r--gcc/double-int.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/gcc/double-int.c b/gcc/double-int.c
index 3a22d15f08c..f3d5e8b3dde 100644
--- a/gcc/double-int.c
+++ b/gcc/double-int.c
@@ -606,7 +606,6 @@ div_and_round_double (unsigned code, int uns,
return overflow;
}
-
/* Returns mask for PREC bits. */
double_int
@@ -754,7 +753,7 @@ double_int::operator * (double_int b) const
*OVERFLOW is set to nonzero. */
double_int
-double_int::mul_with_sign (double_int b, bool unsigned_p, int *overflow) const
+double_int::mul_with_sign (double_int b, bool unsigned_p, bool *overflow) const
{
const double_int &a = *this;
double_int ret;
@@ -774,6 +773,19 @@ double_int::operator + (double_int b) const
return ret;
}
+/* Returns A + B. If the operation overflows according to UNSIGNED_P,
+ *OVERFLOW is set to nonzero. */
+
+double_int
+double_int::add_with_sign (double_int b, bool unsigned_p, bool *overflow) const
+{
+ const double_int &a = *this;
+ double_int ret;
+ *overflow = add_double_with_sign (a.low, a.high, b.low, b.high,
+ &ret.low, &ret.high, unsigned_p);
+ return ret;
+}
+
/* Returns A - B. */
double_int
@@ -1104,6 +1116,20 @@ double_int::ult (double_int b) const
return false;
}
+/* Compares two unsigned values A and B for less-than or equal-to. */
+
+bool
+double_int::ule (double_int b) const
+{
+ if ((unsigned HOST_WIDE_INT) high < (unsigned HOST_WIDE_INT) b.high)
+ return true;
+ if ((unsigned HOST_WIDE_INT) high > (unsigned HOST_WIDE_INT) b.high)
+ return false;
+ if (low <= b.low)
+ return true;
+ return false;
+}
+
/* Compares two unsigned values A and B for greater-than. */
bool
@@ -1132,6 +1158,20 @@ double_int::slt (double_int b) const
return false;
}
+/* Compares two signed values A and B for less-than or equal-to. */
+
+bool
+double_int::sle (double_int b) const
+{
+ if (high < b.high)
+ return true;
+ if (high > b.high)
+ return false;
+ if (low <= b.low)
+ return true;
+ return false;
+}
+
/* Compares two signed values A and B for greater-than. */
bool