aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorLawrence Crowl <crowl@google.com>2012-09-07 00:06:35 +0000
committerLawrence Crowl <crowl@google.com>2012-09-07 00:06:35 +0000
commitbb28ee173ebc8c4d948a5bbf58dc6311b19652e2 (patch)
tree82231821d6793cd33f15d6b9792a8b82f2ec15d1 /gcc/simplify-rtx.c
parent9083ba36e1d07d95b9c06af3d217e7f2feda6ec6 (diff)
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: https://gcc.gnu.org/svn/gcc/trunk@191047 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index f59150ee2c1..9ed98e671a0 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1986,7 +1986,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
else if (GET_CODE (lhs) == MULT
&& CONST_INT_P (XEXP (lhs, 1)))
{
- coeff0 = shwi_to_double_int (INTVAL (XEXP (lhs, 1)));
+ coeff0 = double_int::from_shwi (INTVAL (XEXP (lhs, 1)));
lhs = XEXP (lhs, 0);
}
else if (GET_CODE (lhs) == ASHIFT
@@ -1994,8 +1994,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
&& INTVAL (XEXP (lhs, 1)) >= 0
&& INTVAL (XEXP (lhs, 1)) < HOST_BITS_PER_WIDE_INT)
{
- coeff0 = double_int_setbit (double_int_zero,
- INTVAL (XEXP (lhs, 1)));
+ coeff0 = double_int_zero.set_bit (INTVAL (XEXP (lhs, 1)));
lhs = XEXP (lhs, 0);
}
@@ -2007,7 +2006,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
else if (GET_CODE (rhs) == MULT
&& CONST_INT_P (XEXP (rhs, 1)))
{
- coeff1 = shwi_to_double_int (INTVAL (XEXP (rhs, 1)));
+ coeff1 = double_int::from_shwi (INTVAL (XEXP (rhs, 1)));
rhs = XEXP (rhs, 0);
}
else if (GET_CODE (rhs) == ASHIFT
@@ -2015,8 +2014,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
&& INTVAL (XEXP (rhs, 1)) >= 0
&& INTVAL (XEXP (rhs, 1)) < HOST_BITS_PER_WIDE_INT)
{
- coeff1 = double_int_setbit (double_int_zero,
- INTVAL (XEXP (rhs, 1)));
+ coeff1 = double_int_zero.set_bit (INTVAL (XEXP (rhs, 1)));
rhs = XEXP (rhs, 0);
}
@@ -2027,7 +2025,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
double_int val;
bool speed = optimize_function_for_speed_p (cfun);
- val = double_int_add (coeff0, coeff1);
+ val = coeff0 + coeff1;
coeff = immed_double_int_const (val, mode);
tem = simplify_gen_binary (MULT, mode, lhs, coeff);
@@ -2165,7 +2163,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
else if (GET_CODE (lhs) == MULT
&& CONST_INT_P (XEXP (lhs, 1)))
{
- coeff0 = shwi_to_double_int (INTVAL (XEXP (lhs, 1)));
+ coeff0 = double_int::from_shwi (INTVAL (XEXP (lhs, 1)));
lhs = XEXP (lhs, 0);
}
else if (GET_CODE (lhs) == ASHIFT
@@ -2173,8 +2171,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
&& INTVAL (XEXP (lhs, 1)) >= 0
&& INTVAL (XEXP (lhs, 1)) < HOST_BITS_PER_WIDE_INT)
{
- coeff0 = double_int_setbit (double_int_zero,
- INTVAL (XEXP (lhs, 1)));
+ coeff0 = double_int_zero.set_bit (INTVAL (XEXP (lhs, 1)));
lhs = XEXP (lhs, 0);
}
@@ -2186,7 +2183,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
else if (GET_CODE (rhs) == MULT
&& CONST_INT_P (XEXP (rhs, 1)))
{
- negcoeff1 = shwi_to_double_int (-INTVAL (XEXP (rhs, 1)));
+ negcoeff1 = double_int::from_shwi (-INTVAL (XEXP (rhs, 1)));
rhs = XEXP (rhs, 0);
}
else if (GET_CODE (rhs) == ASHIFT
@@ -2194,9 +2191,8 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
&& INTVAL (XEXP (rhs, 1)) >= 0
&& INTVAL (XEXP (rhs, 1)) < HOST_BITS_PER_WIDE_INT)
{
- negcoeff1 = double_int_setbit (double_int_zero,
- INTVAL (XEXP (rhs, 1)));
- negcoeff1 = double_int_neg (negcoeff1);
+ negcoeff1 = double_int_zero.set_bit (INTVAL (XEXP (rhs, 1)));
+ negcoeff1 = -negcoeff1;
rhs = XEXP (rhs, 0);
}
@@ -2207,7 +2203,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
double_int val;
bool speed = optimize_function_for_speed_p (cfun);
- val = double_int_add (coeff0, negcoeff1);
+ val = coeff0 + negcoeff1;
coeff = immed_double_int_const (val, mode);
tem = simplify_gen_binary (MULT, mode, lhs, coeff);
@@ -3590,16 +3586,16 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
{
case MINUS:
/* A - B == A + (-B). */
- o1 = double_int_neg (o1);
+ o1 = -o1;
/* Fall through.... */
case PLUS:
- res = double_int_add (o0, o1);
+ res = o0 + o1;
break;
case MULT:
- res = double_int_mul (o0, o1);
+ res = o0 * o1;
break;
case DIV:
@@ -3635,31 +3631,31 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
break;
case AND:
- res = double_int_and (o0, o1);
+ res = o0 & o1;
break;
case IOR:
- res = double_int_ior (o0, o1);
+ res = o0 | o1;
break;
case XOR:
- res = double_int_xor (o0, o1);
+ res = o0 ^ o1;
break;
case SMIN:
- res = double_int_smin (o0, o1);
+ res = o0.smin (o1);
break;
case SMAX:
- res = double_int_smax (o0, o1);
+ res = o0.smax (o1);
break;
case UMIN:
- res = double_int_umin (o0, o1);
+ res = o0.umin (o1);
break;
case UMAX:
- res = double_int_umax (o0, o1);
+ res = o0.umax (o1);
break;
case LSHIFTRT: case ASHIFTRT:
@@ -3674,22 +3670,21 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
o1.low &= GET_MODE_PRECISION (mode) - 1;
}
- if (!double_int_fits_in_uhwi_p (o1)
- || double_int_to_uhwi (o1) >= GET_MODE_PRECISION (mode))
+ if (!o1.fits_uhwi ()
+ || o1.to_uhwi () >= GET_MODE_PRECISION (mode))
return 0;
- cnt = double_int_to_uhwi (o1);
+ cnt = o1.to_uhwi ();
+ unsigned short prec = GET_MODE_PRECISION (mode);
if (code == LSHIFTRT || code == ASHIFTRT)
- res = double_int_rshift (o0, cnt, GET_MODE_PRECISION (mode),
- code == ASHIFTRT);
+ res = o0.rshift (cnt, prec, code == ASHIFTRT);
else if (code == ASHIFT)
- res = double_int_lshift (o0, cnt, GET_MODE_PRECISION (mode),
- true);
+ res = o0.alshift (cnt, prec);
else if (code == ROTATE)
- res = double_int_lrotate (o0, cnt, GET_MODE_PRECISION (mode));
+ res = o0.lrotate (cnt, prec);
else /* code == ROTATERT */
- res = double_int_rrotate (o0, cnt, GET_MODE_PRECISION (mode));
+ res = o0.rrotate (cnt, prec);
}
break;