Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263081AbTI3CYG (ORCPT ); Mon, 29 Sep 2003 22:24:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263083AbTI3CYG (ORCPT ); Mon, 29 Sep 2003 22:24:06 -0400 Received: from TYO201.gate.nec.co.jp ([202.32.8.214]:61344 "EHLO TYO201.gate.nec.co.jp") by vger.kernel.org with ESMTP id S263081AbTI3CYE (ORCPT ); Mon, 29 Sep 2003 22:24:04 -0400 To: Maciej Zenczykowski Cc: Valdis.Kletnieks@vt.edu, Jamie Lokier , Muli Ben-Yehuda , Andrew Morton , Linux-Kernel Subject: Re: [PATCH] document optimizing macro for translating PROT_ to VM_ bits References: Reply-To: Miles Bader System-Type: i686-pc-linux-gnu Blat: Foop From: Miles Bader Date: 30 Sep 2003 11:15:51 +0900 In-Reply-To: Message-ID: Lines: 18 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Maciej Zenczykowski 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/