diff options
author | David Edelsohn <dje@gcc.gnu.org> | 2005-09-17 19:08:03 -0400 |
---|---|---|
committer | David Edelsohn <dje@gcc.gnu.org> | 2005-09-17 19:08:03 -0400 |
commit | 5e839bc82015c2659f230cf1141ec868cf5d449c (patch) | |
tree | 898f8154cbfe2d48f72ba1369c93c01ae87fc413 | |
parent | 579ad6bf4260bb249b507a50aa5ac9226442c2a1 (diff) | |
download | gcc-5e839bc82015c2659f230cf1141ec868cf5d449c.zip gcc-5e839bc82015c2659f230cf1141ec868cf5d449c.tar.gz gcc-5e839bc82015c2659f230cf1141ec868cf5d449c.tar.bz2 |
Add comment to expand_mult max_cost change.
From-SVN: r104379
-rw-r--r-- | gcc/expmed.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index 292957c..8f71b8b 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -3022,7 +3022,7 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target, && (unsignedp || !flag_trapv)) { HOST_WIDE_INT coeff = 0; - rtx reg = gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 1); + rtx fake_reg = gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 1); /* synth_mult does an `unsigned int' multiply. As long as the mode is less than or equal in size to `unsigned int' this doesn't matter. @@ -3040,8 +3040,10 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target, && GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT) { /* Its safe to use -INTVAL (op1) even for INT_MIN, as the - result is interpreted as an unsigned coefficient. */ - max_cost = rtx_cost (gen_rtx_MULT (mode, reg, op1), SET) + result is interpreted as an unsigned coefficient. + Exclude cost of op0 from max_cost to match the cost + calculation of the synth_mult. */ + max_cost = rtx_cost (gen_rtx_MULT (mode, fake_reg, op1), SET) - neg_cost[mode]; if (max_cost > 0 && choose_mult_variant (mode, -INTVAL (op1), &algorithm, @@ -3084,7 +3086,9 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target, build_int_cst (NULL_TREE, floor_log2 (coeff)), target, unsignedp); - max_cost = rtx_cost (gen_rtx_MULT (mode, reg, op1), SET); + /* Exclude cost of op0 from max_cost to match the cost + calculation of the synth_mult. */ + max_cost = rtx_cost (gen_rtx_MULT (mode, fake_reg, op1), SET); if (choose_mult_variant (mode, coeff, &algorithm, &variant, max_cost)) return expand_mult_const (mode, op0, coeff, target, |