diff options
author | Lawrence Crowl <crowl@google.com> | 2012-09-07 00:06:35 +0000 |
---|---|---|
committer | Lawrence Crowl <crowl@gcc.gnu.org> | 2012-09-07 00:06:35 +0000 |
commit | 27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7 (patch) | |
tree | 82231821d6793cd33f15d6b9792a8b82f2ec15d1 /gcc/expr.c | |
parent | 316b938ed79ef024177ab82057a061a7a4b5af67 (diff) | |
download | gcc-27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7.zip gcc-27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7.tar.gz gcc-27bcd47cfab04b1b1e6d2712e34b9b289c7a2dd7.tar.bz2 |
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.
From-SVN: r191047
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 61 |
1 files changed, 26 insertions, 35 deletions
@@ -727,11 +727,11 @@ convert_modes (enum machine_mode mode, enum machine_mode oldmode, rtx x, int uns && GET_MODE_BITSIZE (mode) == HOST_BITS_PER_DOUBLE_INT && CONST_INT_P (x) && INTVAL (x) < 0) { - double_int val = uhwi_to_double_int (INTVAL (x)); + double_int val = double_int::from_uhwi (INTVAL (x)); /* We need to zero extend VAL. */ if (oldmode != VOIDmode) - val = double_int_zext (val, GET_MODE_BITSIZE (oldmode)); + val = val.zext (GET_MODE_BITSIZE (oldmode)); return immed_double_int_const (val, mode); } @@ -6557,9 +6557,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, switch (TREE_CODE (exp)) { case BIT_FIELD_REF: - bit_offset - = double_int_add (bit_offset, - tree_to_double_int (TREE_OPERAND (exp, 2))); + bit_offset += tree_to_double_int (TREE_OPERAND (exp, 2)); break; case COMPONENT_REF: @@ -6574,9 +6572,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, break; offset = size_binop (PLUS_EXPR, offset, this_offset); - bit_offset = double_int_add (bit_offset, - tree_to_double_int - (DECL_FIELD_BIT_OFFSET (field))); + bit_offset += tree_to_double_int (DECL_FIELD_BIT_OFFSET (field)); /* ??? Right now we don't do anything with DECL_OFFSET_ALIGN. */ } @@ -6608,8 +6604,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, break; case IMAGPART_EXPR: - bit_offset = double_int_add (bit_offset, - uhwi_to_double_int (*pbitsize)); + bit_offset += double_int::from_uhwi (*pbitsize); break; case VIEW_CONVERT_EXPR: @@ -6631,11 +6626,10 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, if (!integer_zerop (off)) { double_int boff, coff = mem_ref_offset (exp); - boff = double_int_lshift (coff, - BITS_PER_UNIT == 8 - ? 3 : exact_log2 (BITS_PER_UNIT), - HOST_BITS_PER_DOUBLE_INT, true); - bit_offset = double_int_add (bit_offset, boff); + boff = coff.alshift (BITS_PER_UNIT == 8 + ? 3 : exact_log2 (BITS_PER_UNIT), + HOST_BITS_PER_DOUBLE_INT); + bit_offset += boff; } exp = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); } @@ -6659,15 +6653,13 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, if (TREE_CODE (offset) == INTEGER_CST) { double_int tem = tree_to_double_int (offset); - tem = double_int_sext (tem, TYPE_PRECISION (sizetype)); - tem = double_int_lshift (tem, - BITS_PER_UNIT == 8 - ? 3 : exact_log2 (BITS_PER_UNIT), - HOST_BITS_PER_DOUBLE_INT, true); - tem = double_int_add (tem, bit_offset); - if (double_int_fits_in_shwi_p (tem)) - { - *pbitpos = double_int_to_shwi (tem); + tem = tem.sext (TYPE_PRECISION (sizetype)); + tem = tem.alshift (BITS_PER_UNIT == 8 ? 3 : exact_log2 (BITS_PER_UNIT), + HOST_BITS_PER_DOUBLE_INT); + tem += bit_offset; + if (tem.fits_shwi ()) + { + *pbitpos = tem.to_shwi (); *poffset = offset = NULL_TREE; } } @@ -6676,24 +6668,23 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, if (offset) { /* Avoid returning a negative bitpos as this may wreak havoc later. */ - if (double_int_negative_p (bit_offset)) + if (bit_offset.is_negative ()) { double_int mask - = double_int_mask (BITS_PER_UNIT == 8 + = double_int::mask (BITS_PER_UNIT == 8 ? 3 : exact_log2 (BITS_PER_UNIT)); - double_int tem = double_int_and_not (bit_offset, mask); + double_int tem = bit_offset.and_not (mask); /* TEM is the bitpos rounded to BITS_PER_UNIT towards -Inf. Subtract it to BIT_OFFSET and add it (scaled) to OFFSET. */ - bit_offset = double_int_sub (bit_offset, tem); - tem = double_int_rshift (tem, - BITS_PER_UNIT == 8 - ? 3 : exact_log2 (BITS_PER_UNIT), - HOST_BITS_PER_DOUBLE_INT, true); + bit_offset -= tem; + tem = tem.arshift (BITS_PER_UNIT == 8 + ? 3 : exact_log2 (BITS_PER_UNIT), + HOST_BITS_PER_DOUBLE_INT); offset = size_binop (PLUS_EXPR, offset, double_int_to_tree (sizetype, tem)); } - *pbitpos = double_int_to_shwi (bit_offset); + *pbitpos = bit_offset.to_shwi (); *poffset = offset; } @@ -8720,7 +8711,7 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, if (reduce_bit_field && TYPE_UNSIGNED (type)) temp = expand_binop (mode, xor_optab, op0, immed_double_int_const - (double_int_mask (TYPE_PRECISION (type)), mode), + (double_int::mask (TYPE_PRECISION (type)), mode), target, 1, OPTAB_LIB_WIDEN); else temp = expand_unop (mode, one_cmpl_optab, op0, target, 1); @@ -10407,7 +10398,7 @@ reduce_to_bit_field_precision (rtx exp, rtx target, tree type) } else if (TYPE_UNSIGNED (type)) { - rtx mask = immed_double_int_const (double_int_mask (prec), + rtx mask = immed_double_int_const (double_int::mask (prec), GET_MODE (exp)); return expand_and (GET_MODE (exp), exp, mask, target); } |