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
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 22 Jan 2002 15:59:02 +0100
- Subject: Re: Optimizations on long long multiply/divide on PowerPC32 don't work
- References: <20011210005444.A23367@redhat.com><3C115A53.2070206@acm.org><20011207164904.C16375@redhat.com><200112100658.fBA6wEh13767@penguin.transmeta.com><20011210005444.A23367@redhat.com>
At 10:14 10.12.2001, you wrote:
>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))
> {
May I move that one to the branch for 3.0.4? Bootstrapped and regtested on
powerpc-linux-gnu and x86-linux-gnu.
Franz.