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


Groups > comp.lang.c > #15511

Re: Function pointer vs conditional branch

From Kaz Kylheku <kaz@kylheku.com>
Newsgroups comp.lang.c
Subject Re: Function pointer vs conditional branch
Date 2012-01-06 23:44 +0000
Organization A noiseless patient Spider
Message-ID <20120106153957.77@kylheku.com> (permalink)
References (1 earlier) <je7bph$g44$1@news.albasani.net> <20120106103120.689@kylheku.com> <slrnjgeqkm.up1.willem@toad.stack.nl> <20120106142547.211@kylheku.com> <je7uf6$pmm$1@news.albasani.net>

Show all headers | View raw


On 2012-01-06, BGB <cr88192@hotmail.com> wrote:
> On 1/6/2012 4:35 PM, Kaz Kylheku wrote:
>> On 2012-01-06, Willem<willem@toad.stack.nl>  wrote:
>>> Kaz Kylheku wrote:
>>> ) On 2012-01-06, BGB<cr88192@hotmail.com>  wrote:
>>> )>  an indirect function call involves call/return magic
>>> )>  (creating/destroying stack frames, passing any arguments, ...), and also
>>> )>  can't generally be branch-predicted
>>> )
>>> ) You can safely predict that an indirect function call is always taken,
>>> ) since it is unconditional.
>>>
>>> But you can't predict *where* it will jump, which is the point.
>>
>> really?
>>
>>    load r1,<whatever>
>>    add r2, r3
>>    jmp [r1]
>>
>> We already know where the jmp [r1] will go as soon as r1 is loaded, and can start
>> prefetching instructions as soon as the value of r1 is stable.
>>
>
> in a use, such as, say:
> ...
> mov eax, [ebp-...]
> mov ecx, [eax]
> call dword [ecx+0x44]
>
> the CPU may not know the address until the memory loads get done (in the 
> call instruction), so the pipeline may not get filled.

You mean that the if there is inadequate prefetch in one instruction,
it may interfere with prefetch in a later instruction?

Earth-shattering!

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Function pointer vs conditional branch Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> - 2012-01-04 22:20 +0000
  Re: Function pointer vs conditional branch Kaz Kylheku <kaz@kylheku.com> - 2012-01-04 22:46 +0000
  Re: Function pointer vs conditional branch Ian Collins <ian-news@hotmail.com> - 2012-01-05 11:47 +1300
  Re: Function pointer vs conditional branch Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-04 20:15 -0500
    Re: Function pointer vs conditional branch Kaz Kylheku <kaz@kylheku.com> - 2012-01-05 01:25 +0000
      Re: Function pointer vs conditional branch Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-04 20:36 -0500
        Re: Function pointer vs conditional branch Kaz Kylheku <kaz@kylheku.com> - 2012-01-05 06:02 +0000
  Re: Function pointer vs conditional branch "BartC" <bc@freeuk.com> - 2012-01-05 01:25 +0000
  Re: Function pointer vs conditional branch Gene <gene.ressler@gmail.com> - 2012-01-04 17:57 -0800
  Re: Function pointer vs conditional branch gordonb.vj0cm@burditt.org (Gordon Burditt) - 2012-01-04 23:54 -0600
  Re: Function pointer vs conditional branch 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-04 23:25 -0800
  Re: Function pointer vs conditional branch 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-04 23:38 -0800
  Re: Function pointer vs conditional branch Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-01-05 13:47 -0700
  Re: Function pointer vs conditional branch Nobody <nobody@nowhere.com> - 2012-01-05 21:29 +0000
    Re: Function pointer vs conditional branch Dr Nick <3-nospam@temporary-address.org.uk> - 2012-01-06 06:44 +0000
  Re: Function pointer vs conditional branch BGB <cr88192@hotmail.com> - 2012-01-06 11:41 -0600
    Re: Function pointer vs conditional branch Kaz Kylheku <kaz@kylheku.com> - 2012-01-06 18:33 +0000
      Re: Function pointer vs conditional branch Willem <willem@toad.stack.nl> - 2012-01-06 21:41 +0000
        Re: Function pointer vs conditional branch Stephen Sprunk <stephen@sprunk.org> - 2012-01-06 16:08 -0600
        Re: Function pointer vs conditional branch Kaz Kylheku <kaz@kylheku.com> - 2012-01-06 22:35 +0000
          Re: Function pointer vs conditional branch BGB <cr88192@hotmail.com> - 2012-01-06 17:00 -0600
            Re: Function pointer vs conditional branch Kaz Kylheku <kaz@kylheku.com> - 2012-01-06 23:44 +0000
          Re: Function pointer vs conditional branch Stephen Sprunk <stephen@sprunk.org> - 2012-01-06 17:08 -0600
            Re: Function pointer vs conditional branch Kaz Kylheku <kaz@kylheku.com> - 2012-01-06 23:49 +0000
              Re: Function pointer vs conditional branch jacob navia <jacob@spamsink.net> - 2012-01-07 00:55 +0100
                Re: Function pointer vs conditional branch Kaz Kylheku <kaz@kylheku.com> - 2012-01-07 00:07 +0000
        Re: Function pointer vs conditional branch "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2012-01-07 06:14 -0800
          Re: Function pointer vs conditional branch "BartC" <bc@freeuk.com> - 2012-01-07 14:44 +0000
            Re: Function pointer vs conditional branch Robert Wessel <robertwessel2@yahoo.com> - 2012-01-07 14:37 -0600
              Re: Function pointer vs conditional branch Kaz Kylheku <kaz@kylheku.com> - 2012-01-07 20:42 +0000
                Re: Function pointer vs conditional branch Stephen Sprunk <stephen@sprunk.org> - 2012-01-07 16:47 -0600
                Re: Function pointer vs conditional branch Robert Wessel <robertwessel2@yahoo.com> - 2012-01-08 01:49 -0600
                Re: Function pointer vs conditional branch Kaz Kylheku <kaz@kylheku.com> - 2012-01-08 08:35 +0000
            Re: Function pointer vs conditional branch Stephen Sprunk <stephen@sprunk.org> - 2012-01-07 17:02 -0600
    Re: Function pointer vs conditional branch "BartC" <bc@freeuk.com> - 2012-01-06 21:29 +0000
      Re: Function pointer vs conditional branch BGB <cr88192@hotmail.com> - 2012-01-06 17:15 -0600
  Re: Function pointer vs conditional branch Michael Angelo Ravera <maravera@prodigy.net> - 2012-01-06 23:00 -0800
  Re: Function pointer vs conditional branch jgk@panix.com (Joe keane) - 2012-01-07 21:04 +0000

csiph-web