From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29876 invoked by alias); 18 Nov 2013 23:39:27 -0000 Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org Received: (qmail 29860 invoked by uid 89); 18 Nov 2013 23:39:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: multi.imgtec.com Received: from Unknown (HELO multi.imgtec.com) (194.200.65.239) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 18 Nov 2013 23:39:23 +0000 Message-ID: <1384817878.2484.137.camel@ubuntu-sellcey> Subject: Re: [Patch, mips] Faster strcmp for mips From: Steve Ellcey To: =?iso-8859-2?Q?Ond=F8ej_B=EDlka?= CC: Date: Mon, 18 Nov 2013 23:50:00 -0000 In-Reply-To: <20131115190200.GA28546@domone.podge> References: <1384464221.2484.86.camel@ubuntu-sellcey> <20131114231434.GA5331@domone.podge> <1384539604.2484.102.camel@ubuntu-sellcey> <20131115190200.GA28546@domone.podge> Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit MIME-Version: 1.0 X-SEF-Processed: 7_3_0_01192__2013_11_18_23_39_15 X-SW-Source: 2013-11/txt/msg00034.txt.bz2 On Fri, 2013-11-15 at 20:02 +0100, Ondøej Bílka wrote: > I decided that using ffls was shorter but for some reasons I kept > bitfirst there. A correct version is > > uint64_t bitmask = DETECTNULL8(x) | (x ^ y); > int pos = (ffsl(bitmask) - 1) / 8; > return a[pos] - b[pos]; Yes, that works much better. But it only works in little-endian mode. I think I would need a fls (find last set) or something similar for big-endian wouldn't I? Or else I would need to swap the bytes around before using ffs/ffsl. Steve Ellcey sellcey@mips.com