From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/560 Path: news.gmane.org!not-for-mail From: Solar Designer Newsgroups: gmane.linux.lib.musl.general Subject: Re: tough choice on thread pointer initialization issue Date: Fri, 10 Feb 2012 15:22:38 +0400 Message-ID: <20120210112238.GA14906@openwall.com> References: <20120210025824.GA25414@brightrain.aerifal.cx> <20120210074002.GA13559@openwall.com> <20120210075818.GG146@brightrain.aerifal.cx> <20120210104252.GA14485@openwall.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1328872965 11649 80.91.229.3 (10 Feb 2012 11:22:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Feb 2012 11:22:45 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-561-gllmg-musl=m.gmane.org@lists.openwall.com Fri Feb 10 12:22:45 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1RvoYs-0000QY-Bb for gllmg-musl@plane.gmane.org; Fri, 10 Feb 2012 12:22:42 +0100 Original-Received: (qmail 3565 invoked by uid 550); 10 Feb 2012 11:22:41 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 3556 invoked from network); 10 Feb 2012 11:22:41 -0000 Content-Disposition: inline In-Reply-To: <20120210104252.GA14485@openwall.com> User-Agent: Mutt/1.4.2.3i Xref: news.gmane.org gmane.linux.lib.musl.general:560 Archived-At: On Fri, Feb 10, 2012 at 02:42:52PM +0400, Solar Designer wrote: > [...] I just did some testing on > a Core 2'ish CPU (E5420), and the instruction is very fast. I put 1000 > instances of: > > movl %ss,%eax > testl %eax,%eax > jz 0 > > one after another, and this runs in just 1 cycle per the three > instructions above (so 1000 cycles for the 1000 instances total). To test my approach to testing this, I tried using: movw %ss,%ax followed by 1000 instances of: movl %eax,%gs or: movw %ax,%gs This executes in about 16.5 cycles per instruction. Indeed, setting a segment register is slow - but reading it apparently is not, at least not on this CPU. Alexander