diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-06-15 11:07:47 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-06-15 11:07:47 +0000 |
commit | 127cb1cd59c09809a9d240321145612b139e6e4a (patch) | |
tree | 5c72c952d5e64996ab124de5c892988b2985f3d4 /gcc/expmed.c | |
parent | 5ecc7cc35b57c46e6ae0da6525d6bc4bbac04d01 (diff) | |
download | gcc-127cb1cd59c09809a9d240321145612b139e6e4a.tar.gz |
PR tree-optimization/51581
* expr.h (choose_multiplier): New prototype.
* expmed.c (choose_multiplier): No longer static.
Change multiplier_ptr from rtx * to UHWI *.
(expand_divmod): Adjust callers.
* tree-vect-patterns.c (vect_recog_sdivmod_pow2_pattern):
Renamed to...
(vect_recog_divmod_pattern): ... this. Pass bb_vinfo as last
argument to new_stmt_vec_info. Attempt to optimize also divisions
by non-pow2 constants if integer vector division isn't supported.
* tree-vect-stmts.c (vect_analyze_stmt): If node != NULL,
don't look at pattern stmts and sequences.
* gcc.c-torture/execute/pr51581-1.c: New test.
* gcc.c-torture/execute/pr51581-2.c: New test.
* gcc.dg/vect/pr51581-1.c: New test.
* gcc.dg/vect/pr51581-2.c: New test.
* gcc.dg/vect/pr51581-3.c: New test.
* gcc.target/i386/avx-pr51581-1.c: New test.
* gcc.target/i386/avx-pr51581-2.c: New test.
* gcc.target/i386/avx2-pr51581-1.c: New test.
* gcc.target/i386/avx2-pr51581-2.c: New test.
* gcc.dg/vect/slp-26.c (main1): Divide by 0x8031 instead of 3.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188656 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r-- | gcc/expmed.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index 98f7c0916c3..b456bac177c 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2363,8 +2363,6 @@ static bool choose_mult_variant (enum machine_mode, HOST_WIDE_INT, struct algorithm *, enum mult_variant *, int); static rtx expand_mult_const (enum machine_mode, rtx, HOST_WIDE_INT, rtx, const struct algorithm *, enum mult_variant); -static unsigned HOST_WIDE_INT choose_multiplier (unsigned HOST_WIDE_INT, int, - int, rtx *, int *, int *); static unsigned HOST_WIDE_INT invert_mod2n (unsigned HOST_WIDE_INT, int); static rtx extract_high_half (enum machine_mode, rtx); static rtx expand_mult_highpart (enum machine_mode, rtx, rtx, rtx, int, int); @@ -3293,10 +3291,10 @@ ceil_log2 (unsigned HOST_WIDE_INT x) Using this function, x/D will be equal to (x * m) >> (*POST_SHIFT_PTR), where m is the full HOST_BITS_PER_WIDE_INT + 1 bit multiplier. */ -static unsigned HOST_WIDE_INT choose_multiplier (unsigned HOST_WIDE_INT d, int n, int precision, - rtx *multiplier_ptr, int *post_shift_ptr, int *lgup_ptr) + unsigned HOST_WIDE_INT *multiplier_ptr, + int *post_shift_ptr, int *lgup_ptr) { HOST_WIDE_INT mhigh_hi, mlow_hi; unsigned HOST_WIDE_INT mhigh_lo, mlow_lo; @@ -3368,12 +3366,12 @@ choose_multiplier (unsigned HOST_WIDE_INT d, int n, int precision, if (n < HOST_BITS_PER_WIDE_INT) { unsigned HOST_WIDE_INT mask = ((unsigned HOST_WIDE_INT) 1 << n) - 1; - *multiplier_ptr = GEN_INT (mhigh_lo & mask); + *multiplier_ptr = mhigh_lo & mask; return mhigh_lo >= mask; } else { - *multiplier_ptr = GEN_INT (mhigh_lo); + *multiplier_ptr = mhigh_lo; return mhigh_hi; } } @@ -4053,10 +4051,9 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, { if (unsignedp) { - unsigned HOST_WIDE_INT mh; + unsigned HOST_WIDE_INT mh, ml; int pre_shift, post_shift; int dummy; - rtx ml; unsigned HOST_WIDE_INT d = (INTVAL (op1) & GET_MODE_MASK (compute_mode)); @@ -4118,7 +4115,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, = (shift_cost[speed][compute_mode][post_shift - 1] + shift_cost[speed][compute_mode][1] + 2 * add_cost[speed][compute_mode]); - t1 = expand_mult_highpart (compute_mode, op0, ml, + t1 = expand_mult_highpart (compute_mode, op0, + GEN_INT (ml), NULL_RTX, 1, max_cost - extra_cost); if (t1 == 0) @@ -4149,7 +4147,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, extra_cost = (shift_cost[speed][compute_mode][pre_shift] + shift_cost[speed][compute_mode][post_shift]); - t2 = expand_mult_highpart (compute_mode, t1, ml, + t2 = expand_mult_highpart (compute_mode, t1, + GEN_INT (ml), NULL_RTX, 1, max_cost - extra_cost); if (t2 == 0) @@ -4262,8 +4261,7 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, else if (size <= HOST_BITS_PER_WIDE_INT) { choose_multiplier (abs_d, size, size - 1, - &mlr, &post_shift, &lgup); - ml = (unsigned HOST_WIDE_INT) INTVAL (mlr); + &ml, &post_shift, &lgup); if (ml < (unsigned HOST_WIDE_INT) 1 << (size - 1)) { rtx t1, t2, t3; @@ -4275,8 +4273,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, extra_cost = (shift_cost[speed][compute_mode][post_shift] + shift_cost[speed][compute_mode][size - 1] + add_cost[speed][compute_mode]); - t1 = expand_mult_highpart (compute_mode, op0, mlr, - NULL_RTX, 0, + t1 = expand_mult_highpart (compute_mode, op0, + GEN_INT (ml), NULL_RTX, 0, max_cost - extra_cost); if (t1 == 0) goto fail1; @@ -4356,10 +4354,9 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, /* We will come here only for signed operations. */ if (op1_is_constant && HOST_BITS_PER_WIDE_INT >= size) { - unsigned HOST_WIDE_INT mh; + unsigned HOST_WIDE_INT mh, ml; int pre_shift, lgup, post_shift; HOST_WIDE_INT d = INTVAL (op1); - rtx ml; if (d > 0) { @@ -4399,8 +4396,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode, extra_cost = (shift_cost[speed][compute_mode][post_shift] + shift_cost[speed][compute_mode][size - 1] + 2 * add_cost[speed][compute_mode]); - t3 = expand_mult_highpart (compute_mode, t2, ml, - NULL_RTX, 1, + t3 = expand_mult_highpart (compute_mode, t2, + GEN_INT (ml), NULL_RTX, 1, max_cost - extra_cost); if (t3 != 0) { |