From: Segher Boessenkool <segher@kernel.crashing.org>
To: David Miller <davem@davemloft.net>
Cc: linux-arch@vger.kernel.org, ralf@linux-mips.org
Subject: Re: gcc generating calls to __udivdi3
Date: Fri, 4 May 2007 00:23:19 +0200 [thread overview]
Message-ID: <1fb72105b8d63aa1a1c890d1b17cef2f@kernel.crashing.org> (raw)
In-Reply-To: <20070503.132801.68856382.davem@davemloft.net>
>> Forwarding this to linux-arch mostly as a heads up to other arch
>> maintainers
>> and discussion. With gcc's optimizer getting increasingly smarter
>> I'm not
>> so sure if below patch is the right thing. In timespec_add_ns we
>> would
>> normally except the loop to be interated once at most and gcc should
>> make
>> this assumption due to the unlikely() hint. Anyway, we have to be
>> prepared for more such code transformations to happen so adding a
>> __udivdi3
>> implementation is probably the defensive approach.
>
> I would rather not have it there and therefore know when such
> an expensive operation is being emitted by gcc.
>
> It looks like the divide costs might be set wrong on MIPS
> in gcc if it thinks udivdi3 is cheaper than this loop.
More likely GCC doesn't know how many times this
loop would run on average, making the loop very
expensive indeed. Perhaps the loop->div optimisation
just doesn't see the "unlikely()". How about filing
a bug report? The original mail says this only
happens with SVN versions of GCC, so if it is handled
fast enough you won't have to deal with this in the
kernel at all.
Segher
prev parent reply other threads:[~2007-05-03 22:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-03 17:38 gcc generating calls to __udivdi3 Ralf Baechle
2007-05-03 20:28 ` David Miller
2007-05-03 22:23 ` Segher Boessenkool [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1fb72105b8d63aa1a1c890d1b17cef2f@kernel.crashing.org \
--to=segher@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=linux-arch@vger.kernel.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.