From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Mon, 02 Aug 2004 21:04:12 +0100 (BST) Received: from alg145.algor.co.uk ([IPv6:::ffff:62.254.210.145]:18181 "EHLO dmz.algor.co.uk") by linux-mips.org with ESMTP id ; Mon, 2 Aug 2004 21:04:07 +0100 Received: from alg158.algor.co.uk ([62.254.210.158] helo=olympia.mips.com) by dmz.algor.co.uk with esmtp (Exim 3.35 #1 (Debian)) id 1BrjDw-0000wY-00; Mon, 02 Aug 2004 21:15:56 +0100 Received: from highbury.mips.com ([192.168.192.236] helo=mips.com) by olympia.mips.com with esmtp (Exim 3.36 #1 (Debian)) id 1Brj2D-0002WQ-00; Mon, 02 Aug 2004 21:03:49 +0100 Message-ID: <410E9E25.7080104@mips.com> Date: Mon, 02 Aug 2004 21:03:49 +0100 From: Nigel Stephens Organization: MIPS Technologies User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.4) Gecko/20030624 X-Accept-Language: en-gb, en-us, en MIME-Version: 1.0 To: "Maciej W. Rozycki" CC: Ralf Baechle , Richard Henderson , Richard Sandiford , gcc-patches@gcc.gnu.org, linux-mips@linux-mips.org Subject: Re: [patch] MIPS/gcc: Revert removal of DImode shifts for 32-bit targets References: <87hds49bmo.fsf@redhat.com> <20040719213801.GD14931@redhat.com> <20040723202703.GB30931@redhat.com> <20040723211232.GB5138@linux-mips.org> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-MTUK-Scanner: Found to be clean X-MTUK-SpamCheck: not spam, SpamAssassin (score=-3.9, required 4, AWL, BAYES_00, USER_AGENT_MOZILLA_UA) Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 5579 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: nigel@mips.com Precedence: bulk X-list: linux-mips Maciej W. Rozycki wrote: >On Fri, 23 Jul 2004, Ralf Baechle wrote: > > > >>With a bit of hand waiving because haven't done benchmarks I guess Richard >>might be right. The subroutine calling overhead on modern processors is >>rather low and smaller code means better cache hit rates ... >> >> > > Well, I just worry the call may itself include at least the same number >of instructions as the callee if inlined. There would be no way for it to >be faster. > > That may happen for a leaf function -- the call itself, plus $ra >saving/restoration is already four instructions. Now it's sufficient for >two statics to be needed to preserve temporaries across such a call and >the size of the caller is already the same. With three statics, you lose >even for a non-leaf function. That's for a function containing a single >call to such a shift -- if there are more, then you may win (but is it >common?). > > So not only it may not be faster, but the resulting code may be bigger as >well. That said, the current GCC's implementation of these operations is >not exactly optimal for current MIPS processors. That's trivial to deal >with in Linux, but would it be possible to pick a different implementation >from libgcc based on the "-march=" setting, too? > > > I second Maciej. My own recent experience when tuning the hell out of a software floating-point emulator was that efficient 64-bit shifts were really critical. I have a patch against gcc-3.4 which makes the 64-bit inline shifts somewhat smaller on ISAs which include the conditional move (movz/movn) instructions, but more importantly removes all branches from the inline code - which can be very expensive on long pipeline CPUs, since in this sort of code they tend to cause many branch mispredicts. Let me know if you want me to extract the patch - here's a table of the number of instructions generated by the original md pattern and the patched version: Instructions Old New ashldi3 12 9 ashrdi3 12 12 lshrdi3 12 9 If people really don't like the inline expansion, then maybe it could be enabled or disabled by a new -m option. Nigel -- Nigel Stephens Mailto:nigel@mips.com _ _ ____ ___ MIPS Technologies Phone.: +44 1223 706200 |\ /|||___)(___ The Fruit Farm Direct: +44 1223 706207 | \/ ||| ____) Ely Road, Chittering Fax...: +44 1223 706250 TECHNOLOGIES UK Cambridge CB5 9PH Cell..: +44 7976 686470 England http://www.mips.com