Re: Implementation of pop count instruction



"Terje Mathisen" <terje.mathisen@xxxxxxxxxxxxx> wrote in message
news:dheo6l$mmu$1@xxxxxxxxxxxxxxxxxxxxxxxxxx
> Dan Koren wrote:
>> Huh ?!?
>>
>> int n = 1000000000;
>> hrtime_t t0, t1;
>> double dt;
>>
>> t0 = gethrtime ();
>> while (n--) popc (whatever);
>> t1 = gethrtime ();
>>
>> dt = t1 - t0;
>>
>> I don't doubt you could have written
>> this yourself ;-)
>
> The code is fine, please show the
> generated asm!

?!?!?

I am no compiler, and I do not have
access to Sun Studio right now being
on vacation. I'm sure you don't need
my help for such an experimen, or do
you?

>>> There must be opportunities for the
>>> compiler to make things evaporate.
>>
>> Only the procedure call since popc is
>> inlined using #pragma inline or the
>> equivalent compiler directives.
>
> As soon as the compiler have inlined the
> table lookups, it is also free to discover
> any additional optimizations, like the
> possibility that 'whatever' is constant
> across the loop.
>
> I hope/assume this wasn't the case here?


Of course not.

You sound obsessively pedantic if I may
say so. If you're willing to take at
face value my statement that the code
has been extensively measured and tested
in a professional manner, fine. If not,
I'm not going to bother to do an online
design and/or code review. This is an
informal discussion group. Lighten up.


dk


.



Relevant Pages

  • Re: RAD Studio Roadmap Updated
    ... Strict private and strict protected provide a means for the compiler ... It will comply according to the specification (of the inline ... the exposure of the implementation details is CRITICAL ...
    (borland.public.delphi.non-technical)
  • Re: OT: C++ overloading operators
    ... way before complex numbers were part of the STL. ... I used the INLINE directive for these trivial functions. ... A compiler can not do inlining without access to the source code. ...
    (comp.dsp)
  • Re: HLA
    ... inline assembler for that compiler. ... different beast from a standalone assembler and IMHO, HLA is most ... It could be added to almost any C compiler without problems... ... then you're no longer programming in the standard form of the ...
    (alt.lang.asm)
  • Re: Inline Functions?
    ... an inline function is a programming language ... that is, it suggests that the compiler ... so the complete body of function func() should actually be placed from ...
    (comp.lang.c)
  • Re: introspection in SML
    ... inline and notinline declarations, and compiler macros. ... still sometimes do it, but with a compiler like MLton, I don't have ... noticed that it did fewer calls to arbitrary precision ...
    (comp.lang.functional)