This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Optimizations on long long multiply/divide on PowerPC32 don't work
On Mon, Dec 10, 2001 at 12:54:44AM -0800, Richard Henderson wrote:
> GCC knows how to do this. It will do this if the target supports
> all of these operations on 64 bit data types and it considers them
> to be cheap enough.
How irritating. I do not like the taste of crow.
While the above is true, powerpc apparently has a rather cheap 32-bit
divide instruction which throws off the heuristics in this case.
r~
Index: expmed.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.97
diff -c -p -d -r1.97 expmed.c
*** expmed.c 2001/11/20 04:12:11 1.97
--- expmed.c 2001/12/10 09:07:20
*************** expand_divmod (rem_flag, code, mode, op0
*** 3271,3277 ****
goto fail1;
}
else if (EXACT_POWER_OF_2_OR_ZERO_P (d)
! && (rem_flag ? smod_pow2_cheap : sdiv_pow2_cheap))
;
else if (EXACT_POWER_OF_2_OR_ZERO_P (abs_d))
{
--- 3271,3286 ----
goto fail1;
}
else if (EXACT_POWER_OF_2_OR_ZERO_P (d)
! && (rem_flag ? smod_pow2_cheap : sdiv_pow2_cheap)
! /* ??? The cheap metric is computed only for
! word_mode. If this operation is wider, this may
! not be so. Assume true if the optab has an
! expander for this mode. */
! && (((rem_flag ? smod_optab : sdiv_optab)
! ->handlers[(int) compute_mode].insn_code
! != CODE_FOR_nothing)
! || (sdivmod_optab->handlers[(int) compute_mode]
! .insn_code != CODE_FOR_nothing)))
;
else if (EXACT_POWER_OF_2_OR_ZERO_P (abs_d))
{