Re: [PATCH] document optimizing macro for translating PROT_ to VM_bits

From: Miles Bader
Date: Mon Sep 29 2003 - 21:26:41 EST


Maciej Zenczykowski <maze@xxxxxxx> writes:
> That probably also explains why the convoluted long code with division
> above is faster - the division and multiplication most likely gets
> resolved during compile (since we're dealing with compile time constants)
> into a single shift and results in an execution of bitop 'and' followed by
> 'shift left/right', which due to lacking and conditional branches
> (necessary for ?:) is usually significantly faster due to a lack of
> branch mispredictions.

Hmmm, on my arch (v850) gcc-2.9x produce different, but equally
efficient (no branches) code for both the old `obvious' expression and
the new `convoluted' expression. gcc-3.3.x produces the _same_ two
instructions for both expressions, except that the two instructions are
in different orders. :-)

-Miles
--
Freedom's just another word, for nothing left to lose --Janis Joplin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/