From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261262AbVFOS02 (ORCPT ); Wed, 15 Jun 2005 14:26:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261263AbVFOS01 (ORCPT ); Wed, 15 Jun 2005 14:26:27 -0400 Received: from imf19aec.mail.bellsouth.net ([205.152.59.67]:53923 "EHLO imf19aec.mail.bellsouth.net") by vger.kernel.org with ESMTP id S261262AbVFOS0G (ORCPT ); Wed, 15 Jun 2005 14:26:06 -0400 Message-ID: <000a01c571df$11af6440$2800000a@pc365dualp2> From: To: "Gene Heskett" , References: <000b01c57187$ade6b9b0$2800000a@pc365dualp2> <200506150818.24465.gene.heskett@verizon.net> Subject: Re: .../asm-i386/bitops.h performance improvements Date: Wed, 15 Jun 2005 15:18:42 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1478 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org ----- Original Message ----- From: "Gene Heskett" To: > > > To what cpu families does this apply? eg, this may be true for intel, > but what about amd, via etc? You tell me -- I've included below a small benchmark that compares them. These are the results I've gotten so far: LEA SHL/ADD --------------------------------------- Pentium Pro 200 88sec 96sec AMD K6/2-500 29sec 48sec 386SLC(386SX core) 2966sec 4932sec If LEA isn't fast, those CPU's you mentioned have much bigger problems than these two inline functions because GCC always generates (with the kernel default -O2 at least) an LEA for things like this: unsigned int foo(unsigned int bar) { return ((bar<<3)+bar); } ----------- LEA vs SHL/ADD ---------- #include #include #define ITERATIONS 2000000L #define START start = time(&start); #define STOP stop = time(&stop); delta = stop - start; #define SUMMARY(s) printf(s " [%ld] seconds\n",delta); #define TESTLOOP for (i=0; i