Re: Kernel bugs found using inspect tool

From: Stephen Satchell (satch@concentric.net)
Date: Wed Feb 23 2000 - 17:30:21 EST


At 07:57 AM 2/23/00 , Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>Thats why its faster using bitwise or. Logical or has a strict left->right
>evaluation rule in C bitwise doesnt so you can generate nicer code, tricks
>like near branchless and sequences using cmp, adc

When I was writing a modem testing tool, I had a situation where I needed
to reduce the code run time as much as possible on x86 architecture. So
for that application I coded up the tests using logical OR and AND, and
bitwise OR and AND, and profiled the difference.

The bitwise-operations version ran about 40 percent faster than its
logical-operations equivalent. Part of the savings was the parallel
testing of multiple bits (this is looking at the modem control register of
a UART), but part of the savings was just in the sheer amount of code that
had to be fetched and executed.

No hand-tweaking of the code was necessary -- the output of the compiler
was plenty good for my purposes.

Satch

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:09 EST