[lkml]   [2000]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Kernel bugs found using inspect tool
    Peter T. Breuer wrote:
    > Nathan Zook <> wrote:
    > > With out-of-order execution, note that if((a == b) | (c == d) | (e < f))
    > > runs faster if c, d, e, and f have no side effects--and the parens ARE
    > > required.
    > Eh? But you are using bitwise or. I had logical or, whose order is
    > defined, being that of lazy left-right evaluation, and whose precedence
    > is looser than that of the relational operators precisely so that you
    > can write boolean propositional compounds without those annoying parens.

    The point is that an out-of-order processor (such as a modern x86)
    doesn't execute instructions in the order emitted by the C compiler. So
    in the above expression, it will typically fetch a, b, c, d, e and f,
    and execute all the comparisons in parallel.

    However, an out of order process will speculatively execute past
    branches, so that || version might be just as fast. And if the branch
    predictor is doing a good job, it might just be faster because you don't
    issue the unlikely instructions. But Nathan is from AMD so I'm sure
    he's right :-)

    > Or am I wrong? It's been at least 15 years since I read K&R ...
    > Nah. No chance.

    Your C is fine.

    -- Jamie

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:56    [W:0.023 / U:11.548 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site