Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1277920

Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with udiv/sdiv instructions

From Måns Rullgård <mans@mansr.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with udiv/sdiv instructions
Date 2015-11-26 02:00 +0100
Message-ID <qyT4J-5eH-3@gated-at.bofh.it> (permalink)
References <qyQgy-3rg-7@gated-at.bofh.it> <qyQgz-3rg-29@gated-at.bofh.it> <qyRFD-4sZ-7@gated-at.bofh.it> <qySim-4XI-9@gated-at.bofh.it> <qySV3-5bm-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Nicolas Pitre <nico@fluxnic.net> writes:

> On Thu, 26 Nov 2015, Måns Rullgård wrote:
>
>> Nicolas Pitre <nico@fluxnic.net> writes:
>> 
>> > 3) In fact I was wondering if the overhead of the branch and back is 
>> >    really significant compared to the non trivial cost of a idiv 
>> >    instruction and all the complex infrastructure required to patch 
>> >    those branches directly, and consequently if the performance 
>> >    difference is actually worth it versus simply doing (2) alone.
>> 
>> Depending on the operands, the div instruction can take as few as 3
>> cycles on a Cortex-A7.
>
> Even the current software based implementation can produce a result with 
> about 5 simple ALU instructions depending on the operands.
>
> The average cycle count is more important than the easy-way-out case. 
> And then how significant the two branches around it are compared to idiv 
> alone from direct patching of every call to it.

If not calling the function saves an I-cache miss, the benefit can be
substantial.  No, I have no proof of this being a problem, but it's
something that could happen.

Of course, none of this is going to be as good as letting the compiler
generate div instructions directly.

-- 
Måns Rullgård
mans@mansr.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/2] ARM: Use udiv/sdiv for __aeabi_{u}idiv library functions Stephen Boyd <sboyd@codeaurora.org> - 2015-11-25 23:00 +0100
  [PATCH v2 1/2] scripts: Add a recorduidiv program Stephen Boyd <sboyd@codeaurora.org> - 2015-11-25 23:00 +0100
    Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-11-26 00:50 +0100
      Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Michal Marek <mmarek@suse.com> - 2015-11-30 16:20 +0100
  [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with udiv/sdiv instructions Stephen Boyd <sboyd@codeaurora.org> - 2015-11-25 23:00 +0100
    Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with  udiv/sdiv instructions Nicolas Pitre <nico@fluxnic.net> - 2015-11-26 00:30 +0100
      Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with  udiv/sdiv instructions Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-11-26 01:10 +0100
      Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with udiv/sdiv instructions Måns Rullgård <mans@mansr.com> - 2015-11-26 01:10 +0100
        Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with  udiv/sdiv instructions Nicolas Pitre <nico@fluxnic.net> - 2015-11-26 01:50 +0100
          Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with udiv/sdiv instructions Måns Rullgård <mans@mansr.com> - 2015-11-26 02:00 +0100
            Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with  udiv/sdiv instructions Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-11-26 02:30 +0100
              Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with udiv/sdiv instructions Måns Rullgård <mans@mansr.com> - 2015-11-26 03:30 +0100
                Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with  udiv/sdiv instructions Nicolas Pitre <nico@fluxnic.net> - 2015-11-26 06:40 +0100
                Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with udiv/sdiv instructions Måns Rullgård <mans@mansr.com> - 2015-11-26 13:50 +0100
    Re: [PATCH v2 2/2] ARM: Replace calls to __aeabi_{u}idiv with  udiv/sdiv instructions Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-11-26 01:10 +0100

csiph-web