From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1112 invoked by alias); 10 Dec 2001 09:15:32 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 894 invoked from network); 10 Dec 2001 09:14:15 -0000 Received: from unknown (HELO dot.cygnus.com) (205.180.230.224) by sources.redhat.com with SMTP; 10 Dec 2001 09:14:15 -0000 Received: (from rth@localhost) by dot.cygnus.com (8.11.2/8.11.2) id fBA9EDu23387; Mon, 10 Dec 2001 01:14:13 -0800 X-Authentication-Warning: dot.cygnus.com: rth set sender to rth@redhat.com using -f Date: Mon, 10 Dec 2001 01:24:00 -0000 From: Richard Henderson To: Linus Torvalds , gcc@gcc.gnu.org Subject: Re: Optimizations on long long multiply/divide on PowerPC32 don't work Message-ID: <20011210011413.A23383@redhat.com> Mail-Followup-To: Richard Henderson , Linus Torvalds , gcc@gcc.gnu.org References: <3C115A53.2070206@acm.org> <20011207164904.C16375@redhat.com> <200112100658.fBA6wEh13767@penguin.transmeta.com> <20011210005444.A23367@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011210005444.A23367@redhat.com>; from rth@redhat.com on Mon, Dec 10, 2001 at 12:54:44AM -0800 X-SW-Source: 2001-12/txt/msg00477.txt.bz2 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)) {